Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tEreP-00ACA9-LR for pgsql-general@arkaria.postgresql.org; Sat, 23 Nov 2024 15:02:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tErdP-001MZy-Cn for pgsql-general@arkaria.postgresql.org; Sat, 23 Nov 2024 15:01:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tErdP-001MZp-1e for pgsql-general@lists.postgresql.org; Sat, 23 Nov 2024 15:01:19 +0000 Received: from webmsr5.webmail.hinet.net ([61.220.15.205]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tErdI-003SS0-Da for pgsql-general@lists.postgresql.org; Sat, 23 Nov 2024 15:01:16 +0000 Received: from sg2000-ap-3 (172-22-5-3.ip.webmail.hinet.net [172.22.5.3] (may be forged)) by webmsr5.webmail.hinet.net (8.15.2/8.15.2) with ESMTP id 4ANF1483023277 for ; Sat, 23 Nov 2024 23:01:04 +0800 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=msa.hinet.net; s=default; t=1732374064; bh=4QKDaub08tML9Tz0XtvP+CHbhcY=; h=Date:From:To:Subject; b=nbP7CDTwzit9cklEk6aaf9A+AeDt2oj8kAYJYIOytct2VcXmIjBA7y8dYfnuZ5tjV lkN+xj/RSbEa6TKWlucqvYlGyQugmKmSemQMDcVwdQORxYYlKGJ4QlwOk4xHIYIkcB RVimmnf2/dQMwCwE1cuvyGhDk0FQYAMLgreGmT2w= Received: from [1.169.89.162] by sg2000-ap-3 via HTTP with ESMTP id ; Sat, 23 Nov 2024 23:01:04 +0800 (CST) Date: Sat, 23 Nov 2024 23:01:04 +0800 (CST) From: Sender: To: pgsql-general@lists.postgresql.org Message-ID: <837985448.725696.1732374064323@sg2000-ap-3> Subject: PQexecParams and "SET TIME ZONE $1" gets 'syntax error at or near "$1" at character 15' MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_725693_726277627.1732374064140" X-Mailer: HiNet WebMail V2.1807a X-Originating-IP: 1.169.89.162 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------=_Part_725693_726277627.1732374064140 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 7bit I get get this same error syntax error at or near "$1" at character 15 if I feed "const char *command" with the following texts. SET TIME ZONE $1 SET TIME ZONE $1::TEXT For some reasons, I can not add quotes around $1 as follows. SET TIME ZONE '$1' SET TIME ZONE '$1'::TEXT Statements like "SELECT ... WHERE $1=..." have been working flawlessly. It looks like PQexecParams doesn't handle statement with "SET ... $1". Are there workarounds for me or PQexecParams needs improvement? Thank you! ------=_Part_725693_726277627.1732374064140 Content-Type: text/html;charset=utf-8 Content-Transfer-Encoding: quoted-printable

I get get this same error

syntax error at or near "$1" at charact= er 15

if I feed "const char *command" with the following texts.

SET TIME ZONE $1
SET TIME ZONE $1::TEXT

For some reasons, I can not add quotes around $1 as follows.

SET TIME ZONE '$1'
SET TIME ZONE '$1'::TEXT

Statements like "SELECT ... WHERE $1=3D..." have been working flawlessly= .

It looks like PQexecParams doesn't handle statement with "SET ... = $1". 

Are there workarounds for me or PQexecParams needs improvement?

Thank you!


--- =E6=9C=AC=E9= =83=B5=E4=BB=B6=E4=BE=86=E8=87=AAHiNet WebMail ---
------=_Part_725693_726277627.1732374064140--