Re: pg_restore direct to database is broken for --insert dumps
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Dunstan <andrew@dunslane.net>, pgsql-hackers@postgresql.org
Date: 2012-01-06T00:01:23Z
Lists: pgsql-hackers
Attachments
- pg-restore-lexer.patch (text/x-patch) patch
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 that object creation commands can be emitted as-is. That would > at least get us out of needing to parse dollar-quoted literals, which > aren't used in the INSERT commands. Attached is a patch that restores a much-simplified version of the mini lexer; it deals only with the sorts of things that dumpTableData_insert actually emits. Fixing the standard_conforming_strings issue turns out to be really a one-liner, because the setting is in fact readily available to this code. Maybe we should have done it that way to begin with :-( ... though I admit to being glad to have gotten rid of the very questionable dollar-quote-recognition code that was there before. Barring objections to the approach, I'll apply and back-patch this tomorrow. regards, tom lane