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 /src/backend/parser/gram.y | |
| parent | a82f9ffde6646624203c2d6a1f49e16088ef6b57 (diff) | |
| download | postgresql-bcaabc5698f6b81a990f1bb7cfa3a6bb9583d03e.tar.gz | |
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 'src/backend/parser/gram.y')
| -rw-r--r-- | src/backend/parser/gram.y | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index d3fb629180..25f8dd02bb 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.121 1999/12/10 07:37:35 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.122 1999/12/14 00:08:15 momjian Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -147,7 +147,7 @@ static Node *doNegate(Node *n); %type <str> TriggerEvents, TriggerFuncArg -%type <str> relation_name, copy_file_name, copy_delimiter, def_name, +%type <str> relation_name, copy_file_name, copy_delimiter, copy_null, def_name, database_name, access_method_clause, access_method, attr_name, class, index_name, name, func_name, file_name, aggr_argtype @@ -802,7 +802,7 @@ opt_id: ColId { $$ = $1; } * *****************************************************************************/ -CopyStmt: COPY opt_binary relation_name opt_with_copy copy_dirn copy_file_name copy_delimiter +CopyStmt: COPY opt_binary relation_name opt_with_copy copy_dirn copy_file_name copy_delimiter copy_null { CopyStmt *n = makeNode(CopyStmt); n->binary = $2; @@ -811,6 +811,7 @@ CopyStmt: COPY opt_binary relation_name opt_with_copy copy_dirn copy_file_name n->direction = $5; n->filename = $6; n->delimiter = $7; + n->null_print = $8; $$ = (Node *)n; } ; @@ -850,6 +851,8 @@ opt_using: USING { $$ = TRUE; } | /*EMPTY*/ { $$ = TRUE; } ; +copy_null: WITH NULL_P AS Sconst { $$ = $4; } + | /*EMPTY*/ { $$ = "\\N"; } /***************************************************************************** * |
