From: | Philip Warner <pjw(at)rhyme(dot)com(dot)au> |
---|---|
To: | "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | pg_restore (libpq? parser?) bug in 8 |
Date: | 2004-08-11 15:46:52 |
Message-ID: | 6.1.1.1.0.20040812012815.04cfbf90@203.8.195.10 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Just found this:
createdb zzz
createlang plpgsql zzz
psql zzz
create function xxx() returns integer as
$$ begin return 1; end; $$
language plpgsql;
\q
pg_dump -Fc zzz > zzz.bck
dropdb zzz
createdb zzz
createlang plpgsql zzz
pg_restore --function="xxx()" -d zzz zzz.bck
results in 'unterminated dollar-quoted string' errors.
Doing:
pg_restore --function="xxx()" zzz.bck > zzz.sql
then running the sql file, works fine.
The statements that are sent to the backend (using log_statements) by
pg_restore include the comment strings. Not sure if this is relevant.
The sql is:
--
-- PostgreSQL database dump
--
SET client_encoding = 'LATIN1';
SET check_function_bodies = false;
SET search_path = public, pg_catalog;
--
-- Name: xxx(); Type: FUNCTION; Schema: public; Owner: birds
--
CREATE FUNCTION xxx() RETURNS integer
AS $$ begin return 1; end; $$
LANGUAGE plpgsql;
ALTER FUNCTION public.xxx() OWNER TO birds;
--
-- PostgreSQL database dump complete
--
The error log is:
2004-08-12 01:38:48 EST<zzz,birds>: LOG: statement: --
-- PostgreSQL database dump
--
SET client_encoding = 'LATIN1';
2004-08-12 01:38:48 EST<zzz,birds>: LOG: statement: SET
check_function_bodies = false;
2004-08-12 01:38:48 EST<zzz,birds>: LOG: statement: SET search_path =
public, pg_catalog
2004-08-12 01:38:48 EST<zzz,birds>: LOG: statement:
--
-- Name: xxx(); Type: FUNCTION; Schema: public; Owner: birds
--
CREATE FUNCTION xxx() RETURNS integer
AS $$ begin return 1;
2004-08-12 01:38:48 EST<zzz,birds>: ERROR: unterminated dollar-quoted
string at or near "$$ begin return 1;" at character 115
2004-08-12 01:38:48 EST<zzz,birds>: LOG: statement: end;
2004-08-12 01:38:48 EST<zzz,birds>: WARNING: there is no transaction in
progress
2004-08-12 01:38:48 EST<zzz,birds>: LOG: statement: $$
LANGUAGE plpgsql;
2004-08-12 01:38:48 EST<zzz,birds>: ERROR: unterminated dollar-quoted
string at or near "$$
LANGUAGE plpgsql;" at character 2
2004-08-12 01:38:48 EST<zzz,birds>: LOG: statement: ALTER FUNCTION
public.xxx() OWNER TO birds;
Not sure I see the problem; I can only guess it may relate to the whole
comments being passed.
Running the extracted sql in psql gives the following log:
2004-08-12 01:45:02 EST<zzz,birds>: LOG: statement: SET client_encoding =
'LATIN1';
2004-08-12 01:45:02 EST<zzz,birds>: LOG: statement: SET
check_function_bodies = false;
2004-08-12 01:45:02 EST<zzz,birds>: LOG: statement: SET search_path =
public, pg_catalog;
2004-08-12 01:45:02 EST<zzz,birds>: LOG: statement: CREATE FUNCTION xxx()
RETURNS integer
AS $$ begin return 1; end; $$
LANGUAGE plpgsql;
2004-08-12 01:45:02 EST<zzz,birds>: LOG: statement: ALTER FUNCTION
public.xxx() OWNER TO birds;
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 03 5330 3172 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp.mit.edu:11371 |/
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-08-11 15:47:35 | Re: Does psql use nested transactions? |
Previous Message | Tom Lane | 2004-08-11 15:36:59 | Re: fsync, fdatasync, open_sync, and open_datasync, -- Linux insanity |