Обсуждение: export-import problem

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

export-import problem

От
GreyGeek
Дата:
I export data from a table that contains a varchar field that stores  whole
names in it.  Some of the names include the apostrophe character....
O'Neal, etc...  When I attempt to import the data (using the copy command
the apostrophe kills the import.  If I export the data with quotes around
the varchar field the quotes get stored inside the varchar field.
What the magic incantation to get apostrophes in textual data without
surrounding the data with quotes?
--
--
GreyGeek

Re: export-import problem

От
Oliver Elphick
Дата:
On Thu, 2004-10-28 at 19:39 -0500, GreyGeek wrote:
> I export data from a table that contains a varchar field that stores  whole
> names in it.  Some of the names include the apostrophe character....
> O'Neal, etc...  When I attempt to import the data (using the copy command
> the apostrophe kills the import.  If I export the data with quotes around
> the varchar field the quotes get stored inside the varchar field.
> What the magic incantation to get apostrophes in textual data without
> surrounding the data with quotes?

Quotes have no special effect in COPY input:

        junk=# create table jj (id INTEGER, jname text);
        CREATE TABLE
        junk=# copy jj from stdin;
        Enter data to be copied followed by a newline.
        End with a backslash and a period on a line by itself.
        >> 1    O'Neil
        >> 2    O'Grady
        >> \.
        junk=#

What precisely are you doing?

--
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
     "But they that wait upon the LORD shall renew their
      strength; they shall mount up with wings as eagles;
      they shall run, and not be weary; and they shall walk,
      and not faint."            Isaiah 40:31