mirror of
https://github.com/postgres/postgres.git
synced 2025-08-22 21:53:06 +03:00
The attached patch (against HEAD) implements
COPY x (a,d,c,b) from stdin; COPY x (a,c) to stdout; as well as the corresponding changes to pg_dump to use the new functionality. This functionality is not available when using the BINARY option. If a column is not specified in the COPY FROM statement, its default values will be used. In addition to this functionality, I tweaked a couple of the error messages emitted by the new COPY <options> checks. Brent Verner
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.343 2002/07/18 04:41:45 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.344 2002/07/18 04:43:50 momjian Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@@ -1262,31 +1262,32 @@ opt_id: ColId { $$ = $1; }
|
||||
/*****************************************************************************
|
||||
*
|
||||
* QUERY :
|
||||
* COPY <relname> FROM/TO [WITH options]
|
||||
* COPY <relname> ['(' columnList ')'] FROM/TO [WITH options]
|
||||
*
|
||||
* BINARY, OIDS, and DELIMITERS kept in old locations
|
||||
* for backward compatibility. 2002-06-18
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
CopyStmt: COPY opt_binary qualified_name opt_oids copy_from
|
||||
copy_file_name copy_delimiter opt_with copy_opt_list
|
||||
CopyStmt: COPY opt_binary qualified_name opt_column_list opt_oids
|
||||
copy_from copy_file_name copy_delimiter opt_with copy_opt_list
|
||||
{
|
||||
CopyStmt *n = makeNode(CopyStmt);
|
||||
n->relation = $3;
|
||||
n->is_from = $5;
|
||||
n->filename = $6;
|
||||
n->attlist = $4;
|
||||
n->is_from = $6;
|
||||
n->filename = $7;
|
||||
|
||||
n->options = NIL;
|
||||
/* Concatenate user-supplied flags */
|
||||
if ($2)
|
||||
n->options = lappend(n->options, $2);
|
||||
if ($4)
|
||||
n->options = lappend(n->options, $4);
|
||||
if ($7)
|
||||
n->options = lappend(n->options, $7);
|
||||
if ($9)
|
||||
n->options = nconc(n->options, $9);
|
||||
if ($5)
|
||||
n->options = lappend(n->options, $5);
|
||||
if ($8)
|
||||
n->options = lappend(n->options, $8);
|
||||
if ($10)
|
||||
n->options = nconc(n->options, $10);
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
;
|
||||
|
Reference in New Issue
Block a user