aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/not_in.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-08-02 18:15:10 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-08-02 18:15:10 +0000
commit38bb77a5d15aa022248488bc8c0147139ce120a9 (patch)
treed01573bceae2db61eb97421f91c6068ef8522b66 /src/backend/utils/adt/not_in.c
parent5e6528adf726429463a5c1f3edf712f98d6b5f7e (diff)
downloadpostgresql-38bb77a5d15aa022248488bc8c0147139ce120a9.tar.gz
postgresql-38bb77a5d15aa022248488bc8c0147139ce120a9.zip
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.
Diffstat (limited to 'src/backend/utils/adt/not_in.c')
-rw-r--r--src/backend/utils/adt/not_in.c29
1 files changed, 3 insertions, 26 deletions
diff --git a/src/backend/utils/adt/not_in.c b/src/backend/utils/adt/not_in.c
index 5982e434da3..7c6be4533eb 100644
--- a/src/backend/utils/adt/not_in.c
+++ b/src/backend/utils/adt/not_in.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.30 2002/06/20 20:29:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.31 2002/08/02 18:15:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,9 +28,9 @@
#include "access/heapam.h"
#include "catalog/namespace.h"
+#include "parser/parse_relation.h"
#include "utils/builtins.h"
-static int my_varattno(Relation rd, char *a);
/* ----------------------------------------------------------------
*
@@ -65,15 +65,10 @@ int4notin(PG_FUNCTION_ARGS)
relrv = makeRangeVarFromNameList(names);
/* Open the relation and get a relation descriptor */
-
relation_to_scan = heap_openrv(relrv, AccessShareLock);
/* Find the column to search */
-
- attrid = my_varattno(relation_to_scan, attribute);
- if (attrid < 0)
- elog(ERROR, "int4notin: unknown attribute %s for relation %s",
- attribute, RelationGetRelationName(relation_to_scan));
+ attrid = attnameAttNum(relation_to_scan, attribute, true);
scan_descriptor = heap_beginscan(relation_to_scan, SnapshotNow,
0, (ScanKey) NULL);
@@ -118,21 +113,3 @@ oidnotin(PG_FUNCTION_ARGS)
/* XXX assume oid maps to int4 */
return int4notin(fcinfo);
}
-
-/*
- * XXX
- * If varattno (in parser/catalog_utils.h) ever is added to
- * cinterface.a, this routine should go away
- */
-static int
-my_varattno(Relation rd, char *a)
-{
- int i;
-
- for (i = 0; i < rd->rd_rel->relnatts; i++)
- {
- if (namestrcmp(&rd->rd_att->attrs[i]->attname, a) == 0)
- return i + 1;
- }
- return -1;
-}