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 1p5KcF-0007DN-4D for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Dec 2022 05:47:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p5KcD-0003fB-VH for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Dec 2022 05:47:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p5KcD-0003ex-5k for pgsql-hackers@lists.postgresql.org; Wed, 14 Dec 2022 05:47:37 +0000 Received: from new2-smtp.messagingengine.com ([66.111.4.224]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p5Kc9-0004RB-5E for pgsql-hackers@postgresql.org; Wed, 14 Dec 2022 05:47:36 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 0CEA15808B6; Wed, 14 Dec 2022 00:47:31 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 14 Dec 2022 00:47:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1670996851; x= 1671004051; bh=s+uoL7ER+b3CLCa9l0EGYrBcrlGleKvYEXy8HstdOv4=; b=V gzlZNR6+2UerHESkBRcKfmK6j5+d8fBDQiEbxXCdhZNEq1UDH0CQRUPocr+ecfDC Bs1eUtNm1hKrIq61kcNzFYMHkR5KGonE42Kjkoc2dvDmFMmJePm50xP54++/+1dc Hg9JiLlp9WprM1xRaNEtqqTf1CyPxcjPYq5OL82Rb23xrRxcIrrxIlOSb08/7rjK IoF5iXUP1WxcRjHfkiMk44JBlqeBrJm6xPXr9dLDAIGSY0hN9JOTHn6/fEkDp/QR w05XcfoYGRvk8tZQ6NDegDBbmL+h9UB8qiW/gb04CoPDgd3PUIkpdpy1mrAHc73Q IfOElmSRPIVHVAJHjGzPw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfedvgdekhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuhffvvehfjggtgfesthekredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvg hrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhepfeejveffhedutdduueeu hfegveefteelffettdefveeikeffieffjeehtdevgeefnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgruhht segvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Feedback-ID: i131946ab:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 14 Dec 2022 00:47:29 -0500 (EST) Message-ID: <6e7d5b72-eaa6-e481-71d4-61a0a057949c@enterprisedb.com> Date: Wed, 14 Dec 2022 06:47:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: Non-decimal integer literals Content-Language: en-US From: Peter Eisentraut To: David Rowley Cc: Dean Rasheed , John Naylor , pgsql-hackers References: <2317133.1643155358@sss.pgh.pa.us> <97aa22d7-b80f-efa1-f368-3dbf73a15980@enterprisedb.com> <071c40f2-15cf-5db3-8799-dbac041bb881@enterprisedb.com> <791aee01-f488-0706-2694-08c5b57a3bdd@enterprisedb.com> <164fea20-dae9-d0fb-9917-772cd0068d29@enterprisedb.com> <404b6297-a22f-afea-cdcb-848543c39193@enterprisedb.com> In-Reply-To: <404b6297-a22f-afea-cdcb-848543c39193@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 08.12.22 12:16, Peter Eisentraut wrote: > On 29.11.22 21:22, David Rowley wrote: >> There seems to be a small bug in the pg_strtointXX functions in the >> code that checks that there's at least 1 digit.  This causes 0x to be >> a valid representation of zero.  That does not seem to be allowed by >> the parser, so I think we should likely reject it in COPY too. >> -- probably shouldn't work >> postgres=# copy a from stdin; >> Enter data to be copied followed by a newline. >> End with a backslash and a period on a line by itself, or an EOF signal. >>>> 0x >>>> \. >> COPY 1 > > Fixed in new patch.  I moved the "require at least one digit" checks > after the loops over the digits, to make it easier to write one check > for all bases. > > This patch is also incorporates your changes to the digit analysis > algorithm.  I didn't check it carefully, but all the tests still pass. ;-) committed