Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7aQj-0003Ob-0m for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Jan 2022 10:00:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n7aQh-0004kB-Qp for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Jan 2022 10:00:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7aQg-0004k1-4o for pgsql-hackers@lists.postgresql.org; Wed, 12 Jan 2022 10:00:31 +0000 Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7aQc-0008KN-J4 for pgsql-hackers@postgresql.org; Wed, 12 Jan 2022 10:00:28 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.west.internal (Postfix) with ESMTP id 108772B00241 for ; Wed, 12 Jan 2022 05:00:23 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 12 Jan 2022 05:00:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=yU7taLe6e4U6WJKWUbyHo5RYHmpQzHsQCHKTEPrHR 1o=; b=E9mmesULC6P+2No+pfru6vrSP5x6m0fa66mH9e92GTdE2A4bT3hSjVTJd KRQGkQQPAtnzDFuNhsX1+QsMbAypbgOoSV1kqQsrylibmfuzAjJa++yF2nVYsn2d /mBY/UC/ezol6fGYLhlLBr3/KzgKPvvZFhtDuwg8wC90loeWCMs6m8sgR4bm/ZXX rkxzJmqei6sB+qAdy40jIyoCLRobauZE+E8aRSNxr3rc7p3KJWvsMCFBNs35OEEC BCasFJ4USXeCrDHpKRpYJYHQqcB6ymuSn7pWGnQAX+8OULpoDJ8mWHY+xIkWjV8U rxTM5VucKs6vtTK1kSR6y0OcD54Tw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrudehhedguddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgovfgvgihtqfhnlhihqddqufhprghmsghothdqkg egvdduqdehudculdeftddtmdenucfjughrpefkffggfgfuhffvfhgjtgfgsehtkeertddt feejnecuhfhrohhmpefrvghtvghrucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvih hsvghnthhrrghuthesvghnthgvrhhprhhishgvuggsrdgtohhmqeenucggtffrrghtthgv rhhnpefhhfelteefteevfeejkeeikeefteeujeehudelvefhffeikeekfeffgeeiudehle enucffohhmrghinhepphhgtgdrlhgsnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvghrph hrihhsvggusgdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 12 Jan 2022 05:00:22 -0500 (EST) Message-ID: <217295c2-efd8-7c2e-b4a9-5f0c2cee1059@enterprisedb.com> Date: Wed, 12 Jan 2022 11:00:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: small bug in ecpg unicode identifier error handling Content-Language: en-US From: Peter Eisentraut To: pgsql-hackers References: <82fafa79-331c-9d65-e51b-8b5d1b2383fc@enterprisedb.com> In-Reply-To: <82fafa79-331c-9d65-e51b-8b5d1b2383fc@enterprisedb.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10.01.22 14:14, Peter Eisentraut wrote: > I think this patch is necessary: > > diff --git a/src/interfaces/ecpg/preproc/pgc.l > b/src/interfaces/ecpg/preproc/pgc.l > index 07fee80a9c..3529b2ea86 100644 > --- a/src/interfaces/ecpg/preproc/pgc.l > +++ b/src/interfaces/ecpg/preproc/pgc.l > @@ -753,7 +753,7 @@ cppline > {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ >                  } >  {dquote}    { >                      BEGIN(state_before_str_start); > -                    if (literallen == 2) /* "U&" */ > +                    if (literallen == 0) >                          mmerror(PARSE_ERROR, ET_ERROR, "zero-length > delimited identifier"); >                      /* The backend will truncate the identifier here. > We do not as it does not change the result. */ >                      base_yylval.str = psprintf("U&\"%s\"", literalbuf); > > The old code doesn't make sense.  The literallen is the length of the > data in literalbuf, which clearly doesn't include the "U&" as the > comment suggests. > > A test case is to preprocess a file like this (ecpg test.pgc): > > exec sql select u&" > > which currently does *not* give the above error, but it should. Committed. For the record, the correct test case was actually exec sql select u&"";