Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bdVIC-0005qJ-Cq for pgsql-jdbc@arkaria.postgresql.org; Sat, 27 Aug 2016 04:32:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bdVIB-00040e-OM for pgsql-jdbc@arkaria.postgresql.org; Sat, 27 Aug 2016 04:32:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bdVHg-0003TQ-6f for pgsql-jdbc@postgresql.org; Sat, 27 Aug 2016 04:31:56 +0000 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bdVHX-0005VC-OX for pgsql-jdbc@postgresql.org; Sat, 27 Aug 2016 04:31:55 +0000 Received: by mail-pa0-x235.google.com with SMTP id di2so32847673pad.3 for ; Fri, 26 Aug 2016 21:31:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=labkey-com.20150623.gappssmtp.com; s=20150623; h=to:from:subject:message-id:date:user-agent:mime-version; bh=gIX3KgmZgIjBLyoyMbbuaIGVnLGye0DV2Uqa95a3dbk=; b=zgxeKT84VKJZ9b5EeAAOjqV9JL2bUh2snFSsiYHGFXF9ZwRFBq6iXPciuJ4iS7nWK/ hJ3AkH/2f20Pfjegj8coG4+oOi83a91l4oO0+MBqHU7ODVwdOIlf5E+yt0k/cNnlsx0W Os3tVNg2+LBLUZmLIaFXMa0JuI6ClFH2H9if3PP+LWvaOKCNZLlYaJsc6MOvW5xyTxPL 7VXdoW0BZIpdOIIgRbZLiMgPGxuoMnRhLFQmhsXVDttMJM6AtqzjmXO8T8uXqDE1jVF6 77ZspvfCC++yCjn2ZlLa9Kg8G7Wc/yJRirggatnuRMXCyeFtPsnIkr4Wbw+/TdOE0kCE si7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version; bh=gIX3KgmZgIjBLyoyMbbuaIGVnLGye0DV2Uqa95a3dbk=; b=jDcqnmNkNS1tpg6k2rxiXddRGHkhLKWitY3A1yvBQPOg6ZwcDjcq8rPjD4eP7jcwb0 2kdoaq4PHrqd/I+uCFoZkVJNTxyZEY1GgYSC00UluHQ0OCZUICAOiGLqlwjrh9xlYOD7 Jw/saBaEhcGB+ib0yrAfRY4L/bujU9C6vB8hMriOBfUx3Pjt0bi3EP8PL42UIrhBsgge ckZi0FZa8IOcCYavH7TyW6W3v5KfrWiNKs7P2b7qqMXyXjwZ8SfWLLg0qEpfn3D+lotl fPlKgfyTvxpMzjEplfXrqbZxieX3I63l8oDCB1j75zJmhCICefgsee7Dpc4Z0eVcNr+A T6Ww== X-Gm-Message-State: AE9vXwOj9eU9rlhm7EOVUww+/7PLnjRhiiJw4aECWncDQfs4cdlj/cJMmfgQ2/Hi0iIDZg== X-Received: by 10.66.233.166 with SMTP id tx6mr7829923pac.120.1472272305486; Fri, 26 Aug 2016 21:31:45 -0700 (PDT) Received: from [192.168.1.136] ([24.19.58.248]) by smtp.googlemail.com with ESMTPSA id 89sm32190446pft.96.2016.08.26.21.31.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Aug 2016 21:31:45 -0700 (PDT) To: "pgsql-jdbc@postgresql.org" From: Adam Rauch Subject: Simple queries with JDBC escaped scalar functions result in exceptions Message-ID: <02c61eb2-e2da-4e9c-281b-18bf60ea48b1@labkey.com> Date: Fri, 26 Aug 2016 21:31:40 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------192790BBED37AAE29DD3914A" X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org This is a multi-part message in MIME format. --------------192790BBED37AAE29DD3914A Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit I upgraded to postgresql-9.4.1209.jar and fixed all the places in our code that used JDBC escaped scalar functions (e.g., {fn now()}) inside function definitions. However, we continued to see the telltale exception (org.postgresql.util.PSQLException: ERROR: syntax error at or near "{") when executing straightforward SELECT queries that included scalar functions. I tracked this down to comments; a simple repro is to execute the following query via JDBC: SELECT /* $ */ {fn curdate()} The original comments included many characters, but the dollar sign seems to be the culprit. I think this indicates a problem with the parser that's attempting to detect string literals. Thanks, Adam --------------192790BBED37AAE29DD3914A Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit I upgraded to postgresql-9.4.1209.jar and fixed all the places in our code that used JDBC escaped scalar functions (e.g., {fn now()}) inside function definitions. However, we continued to see the telltale exception (org.postgresql.util.PSQLException: ERROR: syntax error at or near "{") when executing straightforward SELECT queries that included scalar functions. I tracked this down to comments; a simple repro is to execute the following query via JDBC:
SELECT /* $ */ {fn curdate()}
The original comments included many characters, but the dollar sign seems to be the culprit. I think this indicates a problem with the parser that's attempting to detect string literals.

Thanks,
Adam

--------------192790BBED37AAE29DD3914A--