X-Original-To: pgsql-admin-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id E374B9FA5D8 for ; Wed, 14 Jun 2006 11:04:57 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 20809-02 for ; Wed, 14 Jun 2006 11:04:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp107.plus.mail.re2.yahoo.com (smtp107.plus.mail.re2.yahoo.com [206.190.53.32]) by postgresql.org (Postfix) with SMTP id 722779F9CAA for ; Wed, 14 Jun 2006 11:04:48 -0300 (ADT) Received: (qmail 88334 invoked from network); 14 Jun 2006 14:04:46 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type; b=F+KPDCzpwcc5ooUz5s55fsB0Q39ye0OxQfbZdXgxeoiXs0GwBblN3Xx/L5317bUmbKHMjZpvm6ss6WCJgrNqwcgyKaaOk99Xk3iJsm+Xm9/LHmDt+2L1bxF5srnUvL/5YNMCyVdEDnN3/ye9B0QdtioJtMf1DUn0v9eBcAUObiY= ; Received: from unknown (HELO ?192.168.20.100?) (renneyt@68.81.191.20 with plain) by smtp107.plus.mail.re2.yahoo.com with SMTP; 14 Jun 2006 14:04:46 -0000 Message-ID: <4490177D.2080303@yahoo.com> Date: Wed, 14 Jun 2006 10:04:45 -0400 From: "renneyt@yahoo.com" User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: "Jim C. Nasby" CC: postgres Subject: Re: pg_dump/restore problem References: <448DD3C6.8050801@yahoo.com> <20060612205630.GF34196@pervasive.com> <448F1FFF.50600@yahoo.com> <20060613230242.GO34196@pervasive.com> In-Reply-To: <20060613230242.GO34196@pervasive.com> Content-Type: multipart/alternative; boundary="------------020101020502030901050209" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/119 X-Sequence-Number: 22081 This is a multi-part message in MIME format. --------------020101020502030901050209 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Jim C. Nasby wrote: > On Tue, Jun 13, 2006 at 04:28:47PM -0400, renneyt@yahoo.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. --------------020101020502030901050209 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Jim C. Nasby wrote:
On Tue, Jun 13, 2006 at 04:28:47PM -0400, renneyt@yahoo.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.
--------------020101020502030901050209--