Обсуждение: pg_dump/load quoting.

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

pg_dump/load quoting.

От
Bob Parkinson
Дата:
Dear All,

pg_dump is dumping INSERT commands that fail to reload.

I'm putting stuff into a table using perl DBI; dbh->quote. A select
shows a row like:

 1047676 | 1047673 | CAB    | breeders' associations

pg_dump creates a line

INSERT INTO "keywords" ("key","extkey","system","str") VALUES (1047676,1047673,'CAB','breeders'' associations');

which throws a parser editor when I try to reload it.

dev_templates=# INSERT INTO
"keywords" ("key","extkey","system","str") VALUES
(1047676,1047673,'CAB','breeders'' associations');
ERROR:  parser: parse error at or near "associations"

Whats happening please? Its quoted correctly, isn't it? I've just read the
example/para about 'dianne''s horse'

Cheers,

Bob

Bob Parkinson
rwp@biome.ac.uk
------------------------------------------------------------------
Technical Manager:         Biome             http://biome.ac.uk/

Greenfield Medical Library,
Queens Medical Centre,
Nottingham.                          0115 9249924 x 42059
------------------------------------------------------------------
                        We are stardust


Re: pg_dump/load quoting.

От
Tom Lane
Дата:
Bob Parkinson <rwp@biome.ac.uk> writes:
> dev_templates=# INSERT INTO
> "keywords" ("key","extkey","system","str") VALUES
> (1047676,1047673,'CAB','breeders'' associations');
> ERROR:  parser: parse error at or near "associations"

> Whats happening please? Its quoted correctly, isn't it?

There's nothing wrong with that statement, and it works for me:

regression=# INSERT INTO "keywords" ("key","extkey","system","str") VALUES
regression-# (1047676,1047673,'CAB','breeders'' associations');
ERROR:  Relation 'keywords' does not exist

(I didn't bother to make the table, but the point here is that it gets
past the "parse error" stage.)

Are you using a 7.0 production release of psql?  I seem to recall that
some early beta versions had bugs with doubled quotes, such that what
they sent the backend wasn't what you typed.  You could check this by
starting psql with -e to see what it's sending...

            regards, tom lane