Re: [HACKERS] sequence data type

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: [HACKERS] sequence data type
Дата
Msg-id e6c30aaa-9ae1-a807-5515-c4ecb8f0cb3f@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: [HACKERS] sequence data type  (Steve Singer <steve@ssinger.info>)
Ответы Re: [HACKERS] sequence data type  (Michael Paquier <michael.paquier@gmail.com>)
Re: [HACKERS] sequence data type  ("Daniel Verite" <daniel@manitou-mail.org>)
Список pgsql-hackers
On 1/8/17 2:39 PM, Steve Singer wrote:
> The only concern I have with the functionality is that there isn't a way 
> to change the type of a sequence.

If we implement the NEXT VALUE FOR expression (or anything similar that
returns a value from the sequence), then the return type of that
expression would be the type of the sequence.  Then, changing the type
of the sequence would require reparsing all expressions involving the
sequence.  This could probably be sorted out somehow, but I don't want
to be too lax now and cause problems for later features.  There is a
similar case, namely changing the return type of a function, which we
also prohibit.

> @@ -1236,7 +1239,15 @@ init_params(ParseState *pstate, List *options, 
> bool isInit,
>          {
>                  DefElem    *defel = (DefElem *) lfirst(option);
> 
> -               if (strcmp(defel->defname, "increment") == 0)
> +               if (strcmp(defel->defname, "as") == 0)
> +               {
> +                       if (as_type)
> +                               ereport(ERROR,
> + (errcode(ERRCODE_SYNTAX_ERROR),
> +                                                errmsg("conflicting or 
> redundant options")));
> +                       as_type = defel;
> +               }
> +               else if (strcmp(defel->defname, "increment") == 0)
> 
> Should we including parser_errposition(pstate, defel->location)));  like 
> for the other errors below this?

Yes, good catch.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: [HACKERS] Add support to COMMENT ON CURRENT DATABASE
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Add support to COMMENT ON CURRENT DATABASE