From: | Mikhail Terekhov <terekhov(at)emc(dot)com> |
---|---|
To: | hackers(at)postgresql(dot)org |
Subject: | pg_dump again |
Date: | 1999-01-13 20:47:39 |
Message-ID: | 369D066B.697D19BB@emc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
It seems that pg_dump (in 6.4.2) still has a problem when quoting
\ and ' when these characters appears together.
Consider the following example:
terekhov=> create table test (i int, t text);
CREATE
terekhov=> insert into test values (1,'');
INSERT 19066 1
terekhov=> insert into test values (2,'abcd');
INSERT 19067 1
terekhov=> insert into test values (3,'\\');
INSERT 19068 1
terekhov=> insert into test values (4,'\'');
INSERT 19069 1
terekhov=> insert into test values (5,'\\\'');
INSERT 19070 1
terekhov=> select * from test;
i|t
-+----
1|
2|abcd
3|\
4|'
5|\'
(5 rows)
terekhov=> \q
terekhov(575)~>pg_dump -d -D -f ter.db terekhov
terekhov(576)~>cat ter.db
CREATE TABLE "test" (
"i" int4,
"t" text);
INSERT INTO "test" ("i","t") values (1,'');
INSERT INTO "test" ("i","t") values (2,'abcd');
INSERT INTO "test" ("i","t") values (3,'\');
INSERT INTO "test" ("i","t") values (4,'''');
INSERT INTO "test" ("i","t") values (5,'\''');
^
wrong quoting here -----|
terekhov(577)~>psql
Welcome to the POSTGRESQL interactive sql monitor:
Please read the file COPYRIGHT for copyright terms of POSTGRESQL
type \? for help on slash commands
type \q to quit
type \g or terminate with semicolon to execute query
You are currently connected to the database: terekhov
terekhov=> alter table test rename to test0;
RENAME
terekhov=> \q
terekhov(578)~>psql -e <ter.db
CREATE TABLE "test" (
"i" int4,
"t" text);
QUERY: CREATE TABLE "test" (
"i" int4,
"t" text);
CREATE
INSERT INTO "test" ("i","t") values (1,'');
QUERY: INSERT INTO "test" ("i","t") values (1,'');
INSERT 19082 1
INSERT INTO "test" ("i","t") values (2,'abcd');
QUERY: INSERT INTO "test" ("i","t") values (2,'abcd');
INSERT 19083 1
INSERT INTO "test" ("i","t") values (3,'\');
INSERT INTO "test" ("i","t") values (4,'''');
INSERT INTO "test" ("i","t") values (5,'\''');
\? -- help
\a -- toggle field-alignment (currently on)
\C [<captn>] -- set html3 caption (currently '')
\connect <dbname|-> <user> -- connect to new database (currently 'terekhov')
\copy table {from | to} <fname>
\d [<table>] -- list tables and indices, columns in <table>, or * for all
\da -- list aggregates
\dd [<object>]- list comment for table, field, type, function, or operator.
\df -- list functions
\di -- list only indices
\do -- list operators
\ds -- list only sequences
\dS -- list system tables and indexes
\dt -- list only tables
\dT -- list types
\e [<fname>] -- edit the current query buffer or <fname>
\E [<fname>] -- edit the current query buffer or <fname>, and execute
\f [<sep>] -- change field separater (currently '|')
\g [<fname>] [|<cmd>] -- send query to backend [and results in <fname> or pipe]
\h [<cmd>] -- help on syntax of sql commands, * for all commands
\H -- toggle html3 output (currently off)
\i <fname> -- read and execute queries from filename
\l -- list all databases
\m -- toggle monitor-like table display (currently off)
\o [<fname>] [|<cmd>] -- send all query results to stdout, <fname>, or pipe
\p -- print the current query buffer
\q -- quit
\r -- reset(clear) the query buffer
\s [<fname>] -- print history or save it in <fname>
\t -- toggle table headings and row count (currently on)
\T [<html>] -- set html3.0 <table ...> options (currently '')
\x -- toggle expanded output (currently off)
\w <fname> -- output current buffer to a file
\z -- list current grant/revoke permissions
\! [<cmd>] -- shell escape or command
EOF
Regards,
Mikhail Terekhov
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Elphick | 1999-01-13 21:09:21 | Re: PostgreSQL 6.4.2 build problems on Linux/Alpha |
Previous Message | Jackson, DeJuan | 1999-01-13 19:50:01 | RE: [HACKERS] CONSTRAINTS... |