Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2002
    Location
    Toronto, Canada
    Posts
    76

    Unanswered: problem loading dump that has \N

    Is there a way to remove \N from the dump file?

    I'm doing something that requires me to modify the dump, and I alwayz get the same problem with \N. When I load the file, I get:

    invalid command \N

  2. #2
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    \n

    I don't have any problems with \N

    But If you have problems with that why don't you use regular expressions to get rid of the problem
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

  3. #3
    Join Date
    Sep 2002
    Location
    Toronto, Canada
    Posts
    76
    How could I use regular expressions to remove \N from a file?

    In perl, while reading the lines one by one. I tried substituting the \N with nothing.

    For example: $line =~ s/\N//;
    but it complains that \N needs open braces or something along that line.

  4. #4
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    \N

    I have looked at some dumps of mine but I did not found \N
    in the files

    What ist this \N? Is this the NULL - Value
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

  5. #5
    Join Date
    Jan 2003
    Posts
    2
    is it really in the file as "\n"? if so, then the regexp needs to be /\\n/ otherwise you'll just strip out the newlines and the noise will still be there.

    from the commandline:

    perl -pi.bak -e 's/\\n//g' filename

    the -p tells perl to loop over the whole file
    the -i.bak says make a backup of the orginal input files and append them with .bak
    the rest you know, cheers!
    Last edited by bageler; 01-16-03 at 19:15.

  6. #6
    Join Date
    Apr 2010
    Posts
    1

    Post

    Cud someone tell me What
    \N in postgresql dump file means.

    How does postgresql interpret \N.

    Whats the equivalent of this other databases.

  7. #7
    Join Date
    Apr 2010
    Posts
    16
    \N means NULL in CSV/text SQL File generated using COPY Command or pg_dump/pg_dumpall.

    This is valid only in CSV and would be readable by Copy Command. You cannot directly use it in SQL Command.

    If you are planning to use in SQL Commands, then "NULL" is available for All databases.

    Regards,
    Vibhor Kumar
    (PCP,OCP)
    ITIL V3 Certified\n

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •