Re: Compatible Dumps

From: Richard Huxton <dev(at)archonet(dot)com>
To: Jake Stride <nsuk(at)users(dot)sourceforge(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Compatible Dumps
Date: 2005-03-03 14:51:06
Message-ID: 4227245A.2080309@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-03-03 15:17:15 Re: [Auth] "ident" method and LDAP user accounts
Previous Message Jake Stride 2005-03-03 14:02:39 Re: Compatible Dumps