Re: Downgrade database and problem with sequences

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: Downgrade database and problem with sequences
Дата
Msg-id
7269.1229695416@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
index compatible date_trunc in postgres? Bryce Nesbitt <bryce2@obviously.com>
Re: index compatible date_trunc in postgres? Tom Lane <tgl@sss.pgh.pa.us>
Re: index compatible date_trunc in postgres? Bryce Nesbitt <bryce2@obviously.com>
Re: index compatible date_trunc in postgres? "Scott Marlowe" <scott.marlowe@gmail.com>
Downgrade database and problem with sequences "Sebastian Rychter" <srychter@anvet.com.ar>
Re: Downgrade database and problem with sequences Tom Lane <tgl@sss.pgh.pa.us>
Re: index compatible date_trunc in postgres? Alvaro Herrera <alvherre@commandprompt.com>
"Sebastian Rychter"  writes:
> I am currently using postgresql 8.3 and whenever I want to get the last
> inserted ID use :
> Select currval(pg_get_serial_sequence(table, field))

> Then, I had to downgrade a database for certain customer to use postgresql
> 8.1, and when I execute that same function I found that
> pg_get_serial_sequence returns nothing.

Probably because the column wasn't actually declared SERIAL to 8.1.
I imagine you ignored the failure of the ALTER SEQUENCE OWNED BY
command in the 8.3 dump, but that is exactly what the missing piece
is here.  8.1 did not have an explicit OWNED BY command, and the only
way to make the right dependency magic happen was to use the SERIAL
keyword while creating the table.
		regards, tom lane

В списке pgsql-sql по дате отправления
От: Sebastian Rychter
Дата:
От: Bryce Nesbitt
Дата:
FAQ