Re: Can't query the sequence table of a serial primary key.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Can't query the sequence table of a serial primary key.
Дата
Msg-id 4387.1330025723@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Can't query the sequence table of a serial primary key.  ("Fred Parkinson" <FredP@abag.ca.gov>)
Список pgsql-admin
"Fred Parkinson" <FredP@abag.ca.gov> writes:
> We have moved some databases from 7.x to 8.4
> Previously I could query the sequencing table of a 'serial primary key' by simply running
> select * from mytable_id_seq;
> where mytable has id as a serial primary key and mytable_id_seq is the postgresql relation which manages the key.

That naming relationship isn't guaranteed, and AFAIR it wasn't
guaranteed in 7.4 either; in case of name collision you'd get something
like mytable_id_seq1 instead.

> When I do \d I see the table and the sequencer under 'List of relations'.
> But when I run select * from mytable_id_seq; postgresql responds with:
> relation 'mytable_id_seq' does not exist.

Maybe the sequence is in a schema that's not in your search_path.

            regards, tom lane

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

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: Can't query the sequence table of a serial primary key.
Следующее
От: "Fred Parkinson"
Дата:
Сообщение: Re: Can't query the sequence table of a serial primary key.