Re: BUG #15096: Unable to CREATE TABLE LIKE with bigint identity column

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, evgeni-klimov(at)yandex(dot)ru, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15096: Unable to CREATE TABLE LIKE with bigint identity column
Date: 2018-03-13 06:22:14
Message-ID: 20180313062214.GB23071@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Mar 12, 2018 at 01:45:26PM -0400, Peter Eisentraut wrote:
> On 3/8/18 03:08, Michael Paquier wrote:
>> Here are some comments for patch 2.
>>
>> + if (endptr != token + length || errno == ERANGE ||
>> + /* check for overflow of int4 */
>> + val != (long) ((int32) val))
>> return T_Float;
>> It would be nice to have this check be consistent with the new
>> definition of ival and int32, One suggestion is to use directly int32 or
>> just have a static assertion that sizeof(int) == sizeof(int32)? Or
>> that's too much nannyism?
>
> Fixed in the attached next version.

Thanks, this looks good to me.

>> If you care about those, you
>> could also remove the ones in interval.c and datetime.c...
>
> Actually, we could just use the strtoint() defined there and apply it
> everywhere, so avoid repeating these patterns. Done so in an additional
> patch.

OK, that's a good idea.

+/*
+ * strtoint --- just like strtol, but returns int not long
+ */
It would be nice to document that caller should check for errno for
sanity checks, in which case caller should not rely on the returned
result.

Worth noting that pgbench has its own view of things with strtoint64.
Not worth bothering anyway.
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2018-03-13 12:12:16 BUG #15108: Initialization problem postgresql-10-setup initdb
Previous Message Patrick Krecker 2018-03-13 02:05:42 Re: BUG #15104: Double free in the main function in ecpg.c