aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/indexcmds.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-09-19 23:40:56 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-09-19 23:40:56 +0000
commitda395b56cd0844f73232961fe0823f4c224bc721 (patch)
treebb7ef806205c2f5bd123d8ef0975655bebaaa5ff /src/backend/commands/indexcmds.c
parent4a0c3a6142698c7f2f99230679dc80cd9d7e5e4e (diff)
downloadpostgresql-da395b56cd0844f73232961fe0823f4c224bc721.tar.gz
postgresql-da395b56cd0844f73232961fe0823f4c224bc721.zip
Tweak heap.c to refuse attempts to create table columns of standalone
composite types. Add a couple more lsyscache.c routines to support this, and make use of them in some other places that were doing lookups the hard way.
Diffstat (limited to 'src/backend/commands/indexcmds.c')
-rw-r--r--src/backend/commands/indexcmds.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index 9660cb61b83..88c0b5cdb64 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.88 2002/09/18 21:35:20 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.89 2002/09/19 23:40:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -535,21 +535,14 @@ void
RemoveIndex(RangeVar *relation, DropBehavior behavior)
{
Oid indOid;
- HeapTuple tuple;
+ char relkind;
ObjectAddress object;
indOid = RangeVarGetRelid(relation, false);
- tuple = SearchSysCache(RELOID,
- ObjectIdGetDatum(indOid),
- 0, 0, 0);
- if (!HeapTupleIsValid(tuple))
- elog(ERROR, "index \"%s\" does not exist", relation->relname);
-
- if (((Form_pg_class) GETSTRUCT(tuple))->relkind != RELKIND_INDEX)
+ relkind = get_rel_relkind(indOid);
+ if (relkind != RELKIND_INDEX)
elog(ERROR, "relation \"%s\" is of type \"%c\"",
- relation->relname, ((Form_pg_class) GETSTRUCT(tuple))->relkind);
-
- ReleaseSysCache(tuple);
+ relation->relname, relkind);
object.classId = RelOid_pg_class;
object.objectId = indOid;
@@ -616,7 +609,6 @@ void
ReindexTable(RangeVar *relation, bool force)
{
Oid heapOid;
- HeapTuple tuple;
char relkind;
/*
@@ -628,19 +620,12 @@ ReindexTable(RangeVar *relation, bool force)
elog(ERROR, "REINDEX cannot run inside a BEGIN/END block");
heapOid = RangeVarGetRelid(relation, false);
- tuple = SearchSysCache(RELOID,
- ObjectIdGetDatum(heapOid),
- 0, 0, 0);
- if (!HeapTupleIsValid(tuple))
- elog(ERROR, "table \"%s\" does not exist", relation->relname);
- relkind = ((Form_pg_class) GETSTRUCT(tuple))->relkind;
+ relkind = get_rel_relkind(heapOid);
if (relkind != RELKIND_RELATION && relkind != RELKIND_TOASTVALUE)
elog(ERROR, "relation \"%s\" is of type \"%c\"",
relation->relname, relkind);
- ReleaseSysCache(tuple);
-
if (!reindex_relation(heapOid, force))
elog(WARNING, "table \"%s\" wasn't reindexed", relation->relname);
}