pg_dump and backslash escapes

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: pg_dump and backslash escapes
Date: 2006-05-13 19:38:08
Message-ID: 200605131938.k4DJc8a01419@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

pg_dump is designed to produce dumps that can be loaded into newer
PostgreSQL versions, and it can read from older database versions.

The new backslash escape warning and sql standard strings might cause
problems for people moving from older versions of PostgreSQL, because
pg_dump assumes identifiers and strings allow escape processing. (COPY
is unaffected.)

We have a few possible solutions. One would be to backpatch older
backends to understand E'', and use that in pg_dump. Another solution
is to use SET to turn off backslash warnings and SQL standard strings,
and have the older backend servers either ignore 'off' commands for
these, or wrap them in a way that they are invisible to the user if they
fail.

I have chosen the last option; patch attached. It will output this at
the top of dump files for releases 7.3.X, 7.4.X and 8.0.X. 8.1 and CVS
HEAD are fine. The new dump output lines are:

-- Set escape environment for possible loading into version >= 8.2.
-- If variables are not supported, suppress error messages.
SET client_min_messages = panic;
SET log_min_messages = log;
SET log_min_error_statement = panic;
SET escape_string_warning = off;
SET standard_conforming_strings = off;
RESET log_min_error_statement;
RESET log_min_messages;
RESET client_min_messages;

--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
unknown_filename text/plain 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-05-13 20:03:03 Re: pg_dump and backslash escapes
Previous Message Martijn van Oosterhout 2006-05-13 19:35:09 Re: [PATCH] Improve EXPLAIN ANALYZE overhead by sampling