pg_dump again

Поиск
Список
Период
Сортировка
Искать

pg_dump again

От:
Mikhail Terekhov <terekhov@luc0134.uc>
Дата:

It seems that pg_dump (in 6.4.2) still has problem with quoting \ and ' when they appears together.
The following example illustrates this.


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 -h luc0134 -p 5434 
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 queryYou are currently connected to the database: terekhov

terekhov=> alter table test rename to test0;
RENAME
terekhov=> \q
terekhov(578)~>psql -h luc0134 -p 5434 -e ] -- set html3 caption (currently '')\connect   -- connect to new database (currently 'terekhov')\copy table {from | to} \d [] -- list tables and indices, columns in 
, or * for all\da -- list aggregates\dd []- 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 [] -- edit the current query buffer or \E [] -- edit the current query buffer or , and execute\f [] -- change field separater (currently '|')\g [] [|] -- send query to backend [and results in or pipe]\h [] -- help on syntax of sql commands, * for all commands\H -- toggle html3 output (currently off)\i -- read and execute queries from filename\l -- list all databases\m -- toggle monitor-like table display (currently off)\o [] [|] -- send all query results to stdout, , or pipe\p -- print the current query buffer\q -- quit\r -- reset(clear) the query buffer\s [] -- print history or save it in \t -- toggle table headings and row count (currently on)\T [] -- set html3.0
options (currently '')\x -- toggle expanded output (currently off)\w -- output current buffer to a file\z -- list current grant/revoke permissions\! [] -- shell escape or command EOF terekhov(579)~> Regards, Mikhail Terekhov
FAQ