Re: CREATE SEQUENCE with RESTART option

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Cary Huang <cary(dot)huang(at)highgo(dot)ca>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: CREATE SEQUENCE with RESTART option
Date: 2021-07-28 16:58:41
Message-ID: e91c54bb-c2c4-3e43-abdc-23c47ee4aed7@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021/07/28 23:53, Bharath Rupireddy wrote:
> On Wed, Jul 28, 2021 at 11:50 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>>
>> On Mon, Jul 26, 2021 at 04:57:53PM +0900, Michael Paquier wrote:
>>> FWIW, like Ashutosh upthread, my vote would be to do nothing here in
>>> terms of behavior changes as this is just breaking a behavior for the
>>> sake of breaking it, so there are chances that this is going to piss
>>> some users that relied accidentally on the existing behavior.
>>
>> In short, I would be tempted with something like the attached, that
>> documents RESTART in CREATE SEQUENCE, while describing its behavior
>> according to START. In terms of regression tests, there is already a
>> lot in this area with ALTER SEQUENCE, but I think that having two
>> tests makes sense for CREATE SEQUENCE: one for RESTART without a
>> value and one with, where both explicitely set START.
>>
>> Thoughts?
>
> -1. IMHO, this is something creating more confusion to the user. We
> say that we allow both START and RESTART that RESTART is accepted as a
> consequence of our internal option handling in gram.y. Instead, I
> recommend throwing errorConflictingDefElem or errmsg("START and
> RESTART are mutually exclusive options"). We do throw these errors in
> a lot of other places for various options. Others may have better
> thoughts though.

Per docs, CREATE SEQUENCE conforms to the SQL standard, with some exceptions.
So I'd agree with Michael if CREATE SEQUENCE with RESTART also conforms to
the SQL standard, but I'd agree with Bharath otherwise.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-07-28 17:05:44 Re: Have I found an interval arithmetic bug?
Previous Message Tom Lane 2021-07-28 16:49:24 Re: Out-of-memory error reports in libpq