diff options
author | Bruce Momjian <bruce@momjian.us> | 2002-04-05 11:56:55 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2002-04-05 11:56:55 +0000 |
commit | 97b4e5ad309b169886a218189804cede0a1eed26 (patch) | |
tree | d0b792fc6508a95b6bbdece3fec75b5f853b55b2 /src/backend/parser/analyze.c | |
parent | aab0b8f5eb6d1ad9ea09cc59bfe75e4e4d15718c (diff) |
Add INSERT(..., DEFAULT, ).
Rod Taylor
Diffstat (limited to 'src/backend/parser/analyze.c')
-rw-r--r-- | src/backend/parser/analyze.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index 080392b97f5..0de9c5bb851 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.226 2002/04/02 06:30:34 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.227 2002/04/05 11:56:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -518,13 +518,29 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt, TargetEntry *tle = (TargetEntry *) lfirst(tl); ResTarget *col; - Assert(!tle->resdom->resjunk); if (icolumns == NIL || attnos == NIL) elog(ERROR, "INSERT has more expressions than target columns"); col = (ResTarget *) lfirst(icolumns); - Assert(IsA(col, ResTarget)); - updateTargetListEntry(pstate, tle, col->name, lfirsti(attnos), + + /* + * When the value is to be set to the column default we can simply + * drop it now and handle it later on using methods for missing + * columns. + */ + if (!IsA(tle, InsertDefault)) + { + Assert(IsA(col, ResTarget)); + Assert(!tle->resdom->resjunk); + updateTargetListEntry(pstate, tle, col->name, lfirsti(attnos), col->indirection); + } + else + { + icolumns = lremove(icolumns, icolumns); + attnos = lremove(attnos, attnos); + qry->targetList = lremove(tle, qry->targetList); + } + icolumns = lnext(icolumns); attnos = lnext(attnos); } |