Search Postgresql Archives

Re: Compatible Dumps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux