aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/lsyscache.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/cache/lsyscache.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/cache/lsyscache.c')
-rw-r--r--src/backend/utils/cache/lsyscache.c37
1 files changed, 5 insertions, 32 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index e383ab892d1..9b5b4cd6f13 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.76 2002/07/12 18:43:18 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.77 2002/08/02 18:15:08 tgl Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -115,16 +115,15 @@ get_attname(Oid relid, AttrNumber attnum)
*
* Given the relation id and the attribute name,
* return the "attnum" field from the attribute relation.
+ *
+ * Returns InvalidAttrNumber if the attr doesn't exist (or is dropped).
*/
AttrNumber
-get_attnum(Oid relid, char *attname)
+get_attnum(Oid relid, const char *attname)
{
HeapTuple tp;
- tp = SearchSysCache(ATTNAME,
- ObjectIdGetDatum(relid),
- PointerGetDatum(attname),
- 0, 0);
+ tp = SearchSysCacheAttName(relid, attname);
if (HeapTupleIsValid(tp))
{
Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
@@ -166,32 +165,6 @@ get_atttype(Oid relid, AttrNumber attnum)
return InvalidOid;
}
-/* This routine uses the attname instead of the attnum because it
- * replaces the routine find_atttype, which is called sometimes when
- * only the attname, not the attno, is available.
- */
-bool
-get_attisset(Oid relid, char *attname)
-{
- HeapTuple tp;
-
- tp = SearchSysCache(ATTNAME,
- ObjectIdGetDatum(relid),
- PointerGetDatum(attname),
- 0, 0);
- if (HeapTupleIsValid(tp))
- {
- Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
- bool result;
-
- result = att_tup->attisset;
- ReleaseSysCache(tp);
- return result;
- }
- else
- return false;
-}
-
/*
* get_atttypmod
*