Skip site navigation (1) Skip section navigation (2)

dollar quoting and pg_dump

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: dollar quoting and pg_dump
Date: 2004-03-23 19:53:06
Message-ID: 406095A2.7060205@dunslane.net (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches

Here's my attempt, as discussed earlier today. As always, comments 
welcome.  I did provide (and use) a fallback mechanism after all, for 
the case of a function with a non-empty probin. A few examples from a 
dump of the regression db:

--
-- Name: tg_hub_adjustslots(character, integer, integer); Type: 
FUNCTION; Schema
: public; Owner: andrew
--

CREATE FUNCTION tg_hub_adjustslots(character, integer, integer) RETURNS 
integer
    AS $_$
declare
    hname   alias for $1;
    oldnslots   alias for $2;
    newnslots   alias for $3;
begin
    if newnslots = oldnslots then
        return 0;
    end if;
    if newnslots < oldnslots then
        delete from HSlot where hubname = hname and slotno > newnslots;
    return 0;
    end if;
    for i in oldnslots + 1 .. newnslots loop
        insert into HSlot (slotname, hubname, slotno, slotlink)
        values ('HS.dummy', hname, i, '');
    end loop;
    return 0;
end;
$_$
    LANGUAGE plpgsql;

--
-- Name: ttdummy(); Type: FUNCTION; Schema: public; Owner: andrew
--

CREATE FUNCTION ttdummy() RETURNS "trigger"
    AS '/home/andrew/pgwork/tip/pgsql/src/test/regress/regress.so', 
'ttdummy'
    LANGUAGE c;


--
-- Name: user_relns(); Type: FUNCTION; Schema: public; Owner: andrew
--

CREATE FUNCTION user_relns() RETURNS SETOF name
    AS $$select relname
       from pg_class c, pg_namespace n
       where relnamespace = n.oid and
             (nspname !~ 'pg_.*' and nspname <> 'information_schema') and
             relkind <> 'i' $$
    LANGUAGE sql;



cheers

andrew



Attachment: dumpdq.patch
Description: text/plain (6.9 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2004-03-23 19:59:58
Subject: Re: linked list rewrite
Previous:From: Tom LaneDate: 2004-03-23 19:47:00
Subject: Re: linked list rewrite

pgsql-patches by date

Next:From: Bruce MomjianDate: 2004-03-23 20:02:21
Subject: Fix for dumoing WITH/WITHOUT oids
Previous:From: Alvaro HerreraDate: 2004-03-23 18:28:43
Subject: Re: Two-phase commit

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group