export-import problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • GreyGeek

    #1

    export-import problem

    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
  • Oliver Elphick

    #2
    Re: export-import problem

    On Thu, 2004-10-28 at 19:39 -0500, GreyGeek wrote:[color=blue]
    > 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?[/color]

    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.[color=blue][color=green]
    >> 1 O'Neil
    >> 2 O'Grady
    >> \.[/color][/color]
    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


    ---------------------------(end of broadcast)---------------------------
    TIP 8: explain analyze is your friend

    Comment

    • Oliver Elphick

      #3
      Re: export-import problem

      On Thu, 2004-10-28 at 19:39 -0500, GreyGeek wrote:[color=blue]
      > 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?[/color]

      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.[color=blue][color=green]
      >> 1 O'Neil
      >> 2 O'Grady
      >> \.[/color][/color]
      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


      ---------------------------(end of broadcast)---------------------------
      TIP 8: explain analyze is your friend

      Comment

      Working...