From c5be74ca4e2f5f26b00bd6f02c98f43df6b8407b Mon Sep 17 00:00:00 2001 From: jinhua luo Date: Thu, 27 Jun 2019 13:16:35 +0800 Subject: [PATCH] send simple query if no args no need to parse and sanitize the sql string when no args. --- query.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/query.go b/query.go index 14df853f..5c6cbf7f 100644 --- a/query.go +++ b/query.go @@ -522,6 +522,10 @@ func (c *Conn) readUntilRowDescription() ([]FieldDescription, error) { } func (c *Conn) sanitizeAndSendSimpleQuery(sql string, args ...interface{}) (err error) { + if len(args) == 0 { + return c.sendSimpleQuery(sql) + } + if c.RuntimeParams["standard_conforming_strings"] != "on" { return errors.New("simple protocol queries must be run with standard_conforming_strings=on") }