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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-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 Content-Type Size
dumpdq.patch text/plain 6.9 KB

In response to

Responses

Browse pgsql-hackers by date

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

Browse pgsql-patches by date

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