diff options
author | Teodor Sigaev <teodor@sigaev.ru> | 2006-05-02 11:28:56 +0000 |
---|---|---|
committer | Teodor Sigaev <teodor@sigaev.ru> | 2006-05-02 11:28:56 +0000 |
commit | 8a3631f8d86cdd9b07c577d6e213b1fc824db255 (patch) | |
tree | 40bcee8383d3552cba8f79e50025613fb683a72e /src/backend/commands | |
parent | 427c6b5b984928972e955f4477c6ba64edbb66cc (diff) | |
download | postgresql-8a3631f8d86cdd9b07c577d6e213b1fc824db255.tar.gz |
GIN: Generalized Inverted iNdex.
text[], int4[], Tsearch2 support for GIN.
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/cluster.c | 9 | ||||
-rw-r--r-- | src/backend/commands/opclasscmds.c | 6 | ||||
-rw-r--r-- | src/backend/commands/vacuum.c | 20 |
3 files changed, 30 insertions, 5 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index ce85d077a3..18845eecea 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.144 2006/03/05 15:58:23 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.145 2006/05/02 11:28:54 teodor Exp $ * *------------------------------------------------------------------------- */ @@ -376,6 +376,13 @@ check_index_is_clusterable(Relation OldHeap, Oid indexOid, bool recheck) RelationGetRelationName(OldIndex)))); } + if (!OldIndex->rd_am->amclusterable) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("cannot cluster on index \"%s\" because access method does not clusterable", + RelationGetRelationName(OldIndex)))); + + /* * Disallow clustering system relations. This will definitely NOT work * for shared relations (we have no way to update pg_class rows in other diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c index d66c403e51..c493cc8e0b 100644 --- a/src/backend/commands/opclasscmds.c +++ b/src/backend/commands/opclasscmds.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.43 2006/03/14 22:48:18 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.44 2006/05/02 11:28:54 teodor Exp $ * *------------------------------------------------------------------------- */ @@ -273,11 +273,11 @@ DefineOpClass(CreateOpClassStmt *stmt) else { /* - * Currently, only GiST allows storagetype different from + * Currently, only GiST and GIN allows storagetype different from * datatype. This hardcoded test should be eliminated in favor of * adding another boolean column to pg_am ... */ - if (amoid != GIST_AM_OID) + if (!(amoid == GIST_AM_OID || amoid == GIN_AM_OID)) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), errmsg("storage type may not be different from data type for access method \"%s\"", diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index c6ebdd5770..ececa0c073 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.326 2006/03/31 23:32:06 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.327 2006/05/02 11:28:54 teodor Exp $ * *------------------------------------------------------------------------- */ @@ -2982,7 +2982,16 @@ scan_index(Relation indrel, double num_tuples) /* * Check for tuple count mismatch. If the index is partial, then it's OK * for it to have fewer tuples than the heap; else we got trouble. + * + * XXX Hack. Since GIN stores every pointer to heap several times and + * counting num_index_tuples during vacuum is very comlpex and slow + * we just copy num_tuples to num_index_tuples as upper limit to avoid + * WARNING and optimizer mistakes. */ + if ( indrel->rd_rel->relam == GIN_AM_OID ) + { + stats->num_index_tuples = num_tuples; + } else if (stats->num_index_tuples != num_tuples) { if (stats->num_index_tuples > num_tuples || @@ -3052,7 +3061,16 @@ vacuum_index(VacPageList vacpagelist, Relation indrel, /* * Check for tuple count mismatch. If the index is partial, then it's OK * for it to have fewer tuples than the heap; else we got trouble. + * + * XXX Hack. Since GIN stores every pointer to heap several times and + * counting num_index_tuples during vacuum is very comlpex and slow + * we just copy num_tuples to num_index_tuples as upper limit to avoid + * WARNING and optimizer mistakes. */ + if ( indrel->rd_rel->relam == GIN_AM_OID ) + { + stats->num_index_tuples = num_tuples; + } else if (stats->num_index_tuples != num_tuples + keep_tuples) { if (stats->num_index_tuples > num_tuples + keep_tuples || |