Re: pg_restore (libpq? parser?) bug in 8

From: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
To: <pjw(at)rhyme(dot)com(dot)au>
Cc: <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_restore (libpq? parser?) bug in 8
Date: 2004-08-12 09:06:59
Message-ID: 4181.24.211.141.25.1092301619.squirrel@www.dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Philip Warner said:
> At 12:15 PM 12/08/2004, Tom Lane wrote:
>>You might need to bite the bullet and implement a flex
>>lexer.
>
> I'd like to avoid this if I can; AFAICT, for statement detection on
> pg_restore, I can require white space before the $tag. Since I also
> skip over all quoted text, the bodies of functions are ignored. The
> only issues will be attribute names with ' $' in them, but they will
> be quoted as well (so ignored).
>
> So to recognize a tag, I look for a '$' after white space, and assume
> it's a tag start. If I subsequently read an invalid tag char, I just
> go back into scan mode on that character and assume the '$...' was
> some other valid sql element.
>
> From other threads, it sounds like removing the statement detection
> code
> entirely is not an option.
>
>

See the discussions that culminated here before Tom bit the bullet and
implemented a flex scanner for psql:

http://archives.postgresql.org/pgsql-patches/2004-02/msg00182.php

It's not as easy as you might think.

I had a thought that might short-circuit this - do we even need pg_dump to
use dollar quoting for non-text output, such as is required by pg_restore?
IIRC, the idea was to have text dumps that didn't undo what the user had
done in using dollar quoting, but I am not sure that consideration applies
to non-text output. Turning it off should be very easy - we already have the
switch.

Thoughts?

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Harald Fuchs 2004-08-12 09:30:13 Re: Add Missing From?
Previous Message Fabien COELHO 2004-08-12 07:24:57 Re: [COMMITTERS] pgsql-server: PostgreSQL extension makefile