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 ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster