Re: Compatible Dumps

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Compatible Dumps
Дата
Msg-id 4227245A.2080309@archonet.com
обсуждение исходный текст
Ответ на Re: Compatible Dumps  (Jake Stride <nsuk@users.sourceforge.net>)
Ответы Re: Compatible Dumps  (Greg Stark <gsstark@mit.edu>)
Список pgsql-general
Jake Stride wrote:
> That helps a bit, but I still have the following issue:
>
> ERROR:  function pg_catalog.pg_get_serial_sequence("unknown", "unknown")
> does not exist
>
> Any ideas how to get around this?

Hmm - before 8.0 there wasn't an easy way to figure out the name of a
sequence attached to a column. This function is the easy way to do that,
but is (of course) not present in 7.x

Assuming your sequences all have default names, and are in the public
schema, you could write a simple function:

CREATE FUNCTION my_pg_get_serial_sequence(text,text) RETURNS text AS '
   SELECT ''public.'' || $1 || ''_'' || $2 || ''_seq'';
' LANGUAGE SQL;

Then a quick bit of sed/perl search & replace-ing and you're away.

This *will* break if the target table (1st param) is in a different
schema than public, or if you have non-default sequence names.
--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: Jake Stride
Дата:
Сообщение: Re: Compatible Dumps
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [Auth] "ident" method and LDAP user accounts