Re: [HACKERS] pg_restore direct to database is broken for --insert dumps

2012-01-05 Thread Tom Lane
I wrote: > Not easily: there could be newlines embedded in data strings or SQL > identifiers. I'm not seeing any way around this except to restore the > minimal lexing capability. One thing we could probably do is to > restrict it to be used only when reading table data, and continue to > assume

Re: [HACKERS] pg_restore direct to database is broken for --insert dumps

2012-01-05 Thread Tom Lane
Andrew Dunstan writes: > On 01/04/2012 06:20 PM, Tom Lane wrote: >> Not easily: there could be newlines embedded in data strings or SQL >> identifiers. > Should we look at eliminating those newlines for the future by using > U&"" identifiers where there are embedded newlines and unicode escapes

Re: [HACKERS] pg_restore direct to database is broken for --insert dumps

2012-01-05 Thread Andrew Dunstan
On 01/04/2012 06:20 PM, Tom Lane wrote: Could we detect an appropriate line ending in ahwrite() after it's been decompressed and buffer partial lines accordingly? Not easily: there could be newlines embedded in data strings or SQL identifiers. Should we look at eliminating those ne

Re: [HACKERS] pg_restore direct to database is broken for --insert dumps

2012-01-04 Thread Tom Lane
Andrew Dunstan writes: > On 01/04/2012 06:20 PM, Tom Lane wrote: >> But we'd have to deal with >> standard-conforming strings some way. The idea I had about that, since >> we have an open database connection at hand, is to check the connected >> backend's standard_conforming_strings state via PQp

Re: [HACKERS] pg_restore direct to database is broken for --insert dumps

2012-01-04 Thread Andrew Dunstan
On 01/04/2012 06:20 PM, Tom Lane wrote: But we'd have to deal with standard-conforming strings some way. The idea I had about that, since we have an open database connection at hand, is to check the connected backend's standard_conforming_strings state via PQparameterStatus. If it doesn't hav

Re: [HACKERS] pg_restore direct to database is broken for --insert dumps

2012-01-04 Thread Tom Lane
Andrew Dunstan writes: > On 01/04/2012 01:13 PM, Tom Lane wrote: >> Not entirely sure what to do about this. We could consider reverting >> the aforesaid patch and trying to find another way of fixing that code's >> failure to cope with standard-conforming strings, but I'm not sure that >> there'

Re: [HACKERS] pg_restore direct to database is broken for --insert dumps

2012-01-04 Thread Andrew Dunstan
On 01/04/2012 01:13 PM, Tom Lane wrote: In http://archives.postgresql.org/pgsql-admin/2012-01/msg8.php it's pointed out that recent versions of pg_restore fall over on archives made with -Fc --inserts (or --column-inserts), but only when restoring direct to database; if you ask for text out