diff options
author | Bruce Momjian <bruce@momjian.us> | 1999-12-14 00:08:21 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1999-12-14 00:08:21 +0000 |
commit | bcaabc5698f6b81a990f1bb7cfa3a6bb9583d03e (patch) | |
tree | 033e217115e218a514a6c33fc181a517649382cf /doc/src | |
parent | a82f9ffde6646624203c2d6a1f49e16088ef6b57 (diff) | |
download | postgresql-bcaabc5698f6b81a990f1bb7cfa3a6bb9583d03e.tar.gz postgresql-bcaabc5698f6b81a990f1bb7cfa3a6bb9583d03e.zip |
Depending on my interpreting (and programming) skills, this might solve
anywhere from zero to two TODO items.
* Allow flag to control COPY input/output of NULLs
I got this:
COPY table .... [ WITH NULL AS 'string' ]
which does what you'd expect. The default is \N, otherwise you can use
empty strings, etc. On Copy In this acts like a filter: every data item
that looks like 'string' becomes a NULL. Pretty straightforward.
This also seems to be related to
* Make postgres user have a password by default
If I recall this discussion correctly, the problem was actually that the
default password for the postgres (or any) user is in fact "\N", because
of the way copy is used. With this change, the file pg_pwd is copied out
with nulls as empty strings, so if someone doesn't have a password, the
password is just '', which one would expect from a new account. I don't
think anyone really wants a hard-coded default password.
Peter Eisentraut Sernanders väg 10:115
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ref/copy.sgml | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml index 3653ae9ef60..adbaa4c8e91 100644 --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v 1.10 1999/10/29 23:52:20 momjian Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v 1.11 1999/12/14 00:08:12 momjian Exp $ Postgres documentation --> @@ -20,15 +20,17 @@ Postgres documentation </refnamediv> <refsynopsisdiv> <refsynopsisdivinfo> - <date>1999-07-20</date> + <date>1999-12-11</date> </refsynopsisdivinfo> <synopsis> COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ] FROM { '<replaceable class="parameter">filename</replaceable>' | <filename>stdin</filename> } [ [USING] DELIMITERS '<replaceable class="parameter">delimiter</replaceable>' ] + [ WITH NULL AS '<replaceable class="parameter">null string</replaceable>' ] COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ] TO { '<replaceable class="parameter">filename</replaceable>' | <filename>stdout</filename> } [ [USING] DELIMITERS '<replaceable class="parameter">delimiter</replaceable>' ] + [ WITH NULL AS '<replaceable class="parameter">null string</replaceable>' ] </synopsis> <refsect2 id="R2-SQL-COPY-1"> @@ -104,6 +106,25 @@ COPY [ BINARY ] <replaceable class="parameter">table</replaceable> [ WITH OIDS ] </para> </listitem> </varlistentry> + + <varlistentry> + <term><replaceable class="parameter">null print</replaceable></term> + <listitem> + <para> + A string to represent NULL values. The default is + <quote><literal>\N</literal></quote> (backslash-N), for historical + reasons. You might prefer an empty string, for example. + </para> + <note> + <para> + On a copy in, any data item that matches this string will be stored as + a NULL value, so you should make sure that you use the same string + as you used on copy out. + </para> + </hote> + </listitem> + </varlistentry> + </variablelist> </para> </refsect2> @@ -287,15 +308,16 @@ ERROR: <replaceable>reason</replaceable> encountered before this special end-of-file pattern is found. </para> <para> - The backslash character has other special meanings. NULL attributes are - represented as "\N". A literal backslash character is represented as two + The backslash character has other special meanings. A literal backslash + character is represented as two consecutive backslashes ("\\"). A literal tab character is represented as a backslash and a tab. A literal newline character is represented as a backslash and a newline. When loading text data not generated by <acronym>Postgres</acronym>, you will need to convert backslash characters ("\") to double-backslashes ("\\") to ensure that they are loaded - properly. + properly. (The sequence "\N" will always be interpreted as a backslash and + an "N", for compatibility. The more general solution is "\\N".) </para> </refsect2> |