Re: Non-decimal integer literals

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, John Naylor <john(dot)naylor(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Non-decimal integer literals
Date: 2022-12-14 05:47:28
Message-ID: 6e7d5b72-eaa6-e481-71d4-61a0a057949c@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shiy.fnst@fujitsu.com 2022-12-14 06:34:19 RE: Perform streaming logical transactions by background workers and parallel apply
Previous Message Kyotaro Horiguchi 2022-12-14 05:45:09 Re: Shortening the Scope of Critical Section in Creation of New MultiXacts