Alvaro Herrera wrote: > I'm not sure that we have any use for the top level you propose; the > attached patch just uses the two lower levels, and I think it fits > autovacuum usage just fine. Thanks for the idea.
Of course, there's no need to pass the relkind; it goes inside the pg_class tuple. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.
diff -u src/backend/access/common/reloptions.c src/backend/access/common/reloptions.c --- src/backend/access/common/reloptions.c 22 Jan 2009 23:24:04 -0000 +++ src/backend/access/common/reloptions.c 22 Jan 2009 23:51:22 -0000 @@ -569,11 +569,12 @@ * in the case of the tuple corresponding to an index, or InvalidOid otherwise. */ bytea * -extractRelOptions(HeapTuple tuple, TupleDesc tupdesc, char relkind, Oid amoptions) +extractRelOptions(HeapTuple tuple, TupleDesc tupdesc, Oid amoptions) { bytea *options; bool isnull; Datum datum; + Form_pg_class classForm; datum = fastgetattr(tuple, Anum_pg_class_reloptions, @@ -582,13 +583,15 @@ if (isnull) return NULL; + classForm = (Form_pg_class) GETSTRUCT(tuple); + /* Parse into appropriate format; don't error out here */ - switch (relkind) + switch (classForm->relkind) { case RELKIND_RELATION: case RELKIND_TOASTVALUE: case RELKIND_UNCATALOGED: - options = heap_reloptions(relkind, datum, false); + options = heap_reloptions(classForm->relkind, datum, false); break; case RELKIND_INDEX: options = index_reloptions(amoptions, datum, false); diff -u src/backend/utils/cache/relcache.c src/backend/utils/cache/relcache.c --- src/backend/utils/cache/relcache.c 22 Jan 2009 23:30:45 -0000 +++ src/backend/utils/cache/relcache.c 22 Jan 2009 23:51:05 -0000 @@ -374,7 +374,6 @@ */ options = extractRelOptions(tuple, GetPgClassDescriptor(), - relation->rd_rel->relkind, relation->rd_rel->relkind == RELKIND_INDEX ? relation->rd_am->amoptions : InvalidOid); diff -u src/include/access/reloptions.h src/include/access/reloptions.h --- src/include/access/reloptions.h 22 Jan 2009 23:22:58 -0000 +++ src/include/access/reloptions.h 22 Jan 2009 23:50:25 -0000 @@ -243,7 +243,7 @@ bool ignoreOids, bool isReset); extern List *untransformRelOptions(Datum options); extern bytea *extractRelOptions(HeapTuple tuple, TupleDesc tupdesc, - char relkind, Oid amoptions); + Oid amoptions); extern relopt_value *parseRelOptions(Datum options, bool validate, relopt_kind kind, int *numrelopts); extern void *allocateReloptStruct(Size base, relopt_value *options,
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers