From 38bb77a5d15aa022248488bc8c0147139ce120a9 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 2 Aug 2002 18:15:10 +0000 Subject: ALTER TABLE DROP COLUMN works. Patch by Christopher Kings-Lynne, code review by Tom Lane. Remaining issues: functions that take or return tuple types are likely to break if one drops (or adds!) a column in the table defining the type. Need to think about what to do here. Along the way: some code review for recent COPY changes; mark system columns attnotnull = true where appropriate, per discussion a month ago. --- src/backend/parser/parse_target.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/backend/parser/parse_target.c') diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c index 608ca7613dc..1e51f23d704 100644 --- a/src/backend/parser/parse_target.c +++ b/src/backend/parser/parse_target.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.85 2002/06/20 20:29:33 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.86 2002/08/02 18:15:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -385,8 +385,12 @@ checkInsertTargets(ParseState *pstate, List *cols, List **attrnos) for (i = 0; i < numcol; i++) { - ResTarget *col = makeNode(ResTarget); + ResTarget *col; + if (attr[i]->attisdropped) + continue; + + col = makeNode(ResTarget); col->name = pstrdup(NameStr(attr[i]->attname)); col->indirection = NIL; col->val = NULL; @@ -407,7 +411,7 @@ checkInsertTargets(ParseState *pstate, List *cols, List **attrnos) int attrno; /* Lookup column name, elog on failure */ - attrno = attnameAttNum(pstate->p_target_relation, name); + attrno = attnameAttNum(pstate->p_target_relation, name, false); /* Check for duplicates */ if (intMember(attrno, *attrnos)) elog(ERROR, "Attribute '%s' specified more than once", name); -- cgit v1.2.3