From: | "renneyt(at)yahoo(dot)com" <renneyt(at)yahoo(dot)com> |
---|---|
To: | "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com> |
Cc: | postgres <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: pg_dump/restore problem |
Date: | 2006-06-14 14:04:45 |
Message-ID: | 4490177D.2080303@yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Jim C. Nasby wrote:
> On Tue, Jun 13, 2006 at 04:28:47PM -0400, renneyt(at)yahoo(dot)com wrote:
>
>> Does pg_get_serial_sequence() exist as plpgsql code? Where may I find
>> it? I would like to retrofit it into a 7.4.8 PG database.
>>
>
> No, but it shouldn't be terribly hard to do it in plpgsql; you just need
> to build the right sequence name (assuming you haven't been messing with
> the sequence names).
>
Because of time and my unfamiliarity with pg_depend, I did a quick and
dirty hack that worked for me.
My schema is foo.
CREATE or REPLACE FUNCTION foo.pg_get_serial_sequence(varchar(500),
varchar(500)) RETURNS varchar(500) AS '
DECLARE
totcomments integer;
begin
return $1||''_''||$2||''_seq'';
end;
' language 'plpgsql';
,
Because it is a hosted ISP version of PG and I do not have write access
to pg_catalog I had to run the backup dump through sed to change the
schema from pg_catalog to foo.
cat pgsql.dmp | sed
's/pg_catalog.pg_get_serial_sequence/foo\.pg_get_serial_sequence/g'
> pgsql.dmp2
Thanks to all for all the suggestions.
From | Date | Subject | |
---|---|---|---|
Next Message | Rojas, Fernando (CIAT) | 2006-06-14 15:41:53 | FW: Error starting backend |
Previous Message | Jaime Casanova | 2006-06-14 02:49:44 | Re: PLPGSQL/EXCEPTION HANDLING |