diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-02-15 21:01:39 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-02-15 21:01:39 +0000 |
commit | f0c9397f808531b4207ebe60ff3ba9b038812443 (patch) | |
tree | 66d756d316f0d045dd6d0a756315efb6ed99b878 /src/backend/commands/tablecmds.c | |
parent | 4b8f1259738458e35a147820232bc7aab4f85e5c (diff) |
First steps towards statistics on expressional (nee functional) indexes.
This commit teaches ANALYZE to store such stats in pg_statistic, but
nothing is done yet about teaching the planner to use 'em.
Also, repair longstanding oversight in separate ANALYZE command: it
updated the pg_class.relpages and reltuples counts for the table proper,
but not for indexes.
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 6fadd0d4e15..3b87e6223b0 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.98 2004/02/10 01:55:25 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.99 2004/02/15 21:01:39 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -2258,13 +2258,19 @@ AlterTableAlterColumnFlags(Oid myrelid, bool recurse, HeapTuple tuple; Form_pg_attribute attrtuple; - rel = heap_open(myrelid, AccessExclusiveLock); + rel = relation_open(myrelid, AccessExclusiveLock); + /* + * Allow index for statistics case only + */ if (rel->rd_rel->relkind != RELKIND_RELATION) - ereport(ERROR, - (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("\"%s\" is not a table", - RelationGetRelationName(rel)))); + { + if (rel->rd_rel->relkind != RELKIND_INDEX || *flagType != 'S') + ereport(ERROR, + (errcode(ERRCODE_WRONG_OBJECT_TYPE), + errmsg("\"%s\" is not a table", + RelationGetRelationName(rel)))); + } /* Permissions checks */ if (!pg_class_ownercheck(myrelid, GetUserId())) @@ -2339,7 +2345,7 @@ AlterTableAlterColumnFlags(Oid myrelid, bool recurse, /* * Propagate to children if desired */ - if (recurse) + if (recurse && rel->rd_rel->relkind == RELKIND_RELATION) { List *child, *children; |