Re: bytea vs. pg_dump - Mailing list pgsql-hackers

From Tom Lane
Subject Re: bytea vs. pg_dump
Date
Msg-id 7092.1241624877@sss.pgh.pa.us
Whole thread Raw
In response to Re: bytea vs. pg_dump  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: bytea vs. pg_dump  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> For distinguishing various input formats, we could use the backslash
> to escape the format specification without breaking backward
> compatibilty, e.g.,

Oh, you're right!  I had been thinking that byteain treats \x as
just meaning x if x isn't an octal digit, but actually it throws
an error for anything except octal digits and backslashes:

regression=# select E'\\x'::bytea;
ERROR:  invalid input syntax for type bytea
LINE 1: select E'\\x'::bytea;              ^

and a quick check verifies it has always done that.

So the ambiguous-input problem is solved if we define the new format(s)
to be started by backslash and something that the old code would reject.
I'd keep it short, like "\x", but there's still room for multiple
formats if anyone really wants to go to the trouble.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Some questions about PostgreSQL source code
Next
From: Alvaro Herrera
Date:
Subject: Re: text_pattern_ops and complex regexps