From: | "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | dump of functions does not handle backslashes correctly |
Date: | 2000-12-01 17:19:28 |
Message-ID: | 0012011219280T.00289@comptechnews |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
If you create a function from psql like:
CREATE FUNCTION "plpgsql_call_handler" ( ) RETURNS opaque AS
'/usr/local/pgsql/lib/plpgsql.so' LANGUAGE 'C';
CREATE TRUSTED PROCEDURAL LANGUAGE 'plpgsql' HANDLER "plpgsql_call_handler"
LANCOMPILER 'PL/pgSQL';
CREATE FUNCTION "atestfun" ( ) RETURNS text AS 'DECLARE mtt TEXT; BEGIN mtt
:= ''This is a \\\\ test.''; RETURN mtt; END;' LANGUAGE 'plpgsql';
Then use pg_dump on it, you get:
CREATE FUNCTION "plpgsql_call_handler" ( ) RETURNS opaque AS
'/usr/local/pgsql/lib/plpgsql.so' LANGUAGE 'C';
CREATE TRUSTED PROCEDURAL LANGUAGE 'plpgsql' HANDLER "plpgsql_call_handler"
LANCOMPILER 'PL/pgSQL';
CREATE FUNCTION "atestfun" ( ) RETURNS text AS 'DECLARE mtt TEXT; BEGIN mtt
:= ''This is a \\ test.''; RETURN mtt; END;' LANGUAGE 'plpgsql';
In the function, the variable "mtt" loses half of the '\' characters. When
you reload this dump, the embedded '\' is lost. When you do a
SELECT atestfun();
The ouput should be:
atestfun
------------------
This is a \ test.
(1 row)
But instead, it returns:
atestfun
------------------
This is a test.
(1 row)
Is this a pg_dump bug or is there there some way to do this right?
--
-------- Robert B. Easter reaster(at)comptechnews(dot)com ---------
- CompTechNews Message Board http://www.comptechnews.com/ -
- CompTechServ Tech Services http://www.comptechserv.com/ -
---------- http://www.comptechnews.com/~reaster/ ------------
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2000-12-01 17:39:02 | Re: [NOVICE] RE: iofflush psql 7.0.3 coredump on RH 6.1 |
Previous Message | Rasputin | 2000-12-01 15:52:57 | Re: [NOVICE] RE: iofflush psql 7.0.3 coredump on RH 6.1 |