Re: pl/pgSQL sequence question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pl/pgSQL sequence question
Дата
Msg-id 18539.1072130892@sss.pgh.pa.us
обсуждение исходный текст
Ответ на pl/pgSQL sequence question  ("Stephen Shorrock" <smsh@bas.ac.uk>)
Список pgsql-novice
"Stephen Shorrock" <smsh@bas.ac.uk> writes:
>       createtable := ''CREATE TABLE debugtab(idcol INTEGER PRIMARY KEY DEFAULT NEXTVAL(tmp_seq), value int )'';

>       --why can it not find tmp_seq??

You need quotes.  For mostly historic reasons, nextval takes a string
argument containing the name of the sequence, which is not what you
wrote here.

You could avoid messing directly with the sequence if you defined the
column as "idcol SERIAL PRIMARY KEY", instead.

            regards, tom lane

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: data/index file size info
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Incorrect (?) escape of the $1