diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2009-02-02 19:31:40 +0000 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2009-02-02 19:31:40 +0000 |
commit | 3a5b77371522b64feda006a7aed2a0e57bfb2b22 (patch) | |
tree | 2a3660571ea184c8e40a78608839914af4f2bb27 /src/backend/commands/cluster.c | |
parent | 80f95a6500d7f5762e4701c80eb202c3fce9095f (diff) | |
download | postgresql-3a5b77371522b64feda006a7aed2a0e57bfb2b22.tar.gz postgresql-3a5b77371522b64feda006a7aed2a0e57bfb2b22.zip |
Allow reloption names to have qualifiers, initially supporting a TOAST
qualifier, and add support for this in pg_dump.
This allows TOAST tables to have user-defined fillfactor, and will also
enable us to move the autovacuum parameters to reloptions without taking
away the possibility of setting values for TOAST tables.
Diffstat (limited to 'src/backend/commands/cluster.c')
-rw-r--r-- | src/backend/commands/cluster.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index e5bff5cb3ef..6f578440da8 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.181 2009/01/16 13:27:23 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.182 2009/02/02 19:31:38 alvherre Exp $ * *------------------------------------------------------------------------- */ @@ -668,6 +668,7 @@ make_new_heap(Oid OIDOldHeap, const char *NewName, Oid NewTableSpace) TupleDesc OldHeapDesc, tupdesc; Oid OIDNewHeap; + Oid toastid; Relation OldHeap; HeapTuple tuple; Datum reloptions; @@ -726,7 +727,24 @@ make_new_heap(Oid OIDOldHeap, const char *NewName, Oid NewTableSpace) * AlterTableCreateToastTable ends with CommandCounterIncrement(), so that * the TOAST table will be visible for insertion. */ - AlterTableCreateToastTable(OIDNewHeap); + toastid = OldHeap->rd_rel->reltoastrelid; + reloptions = (Datum) 0; + if (OidIsValid(toastid)) + { + tuple = SearchSysCache(RELOID, + ObjectIdGetDatum(toastid), + 0, 0, 0); + if (!HeapTupleIsValid(tuple)) + elog(ERROR, "cache lookup failed for relation %u", toastid); + reloptions = SysCacheGetAttr(RELOID, tuple, Anum_pg_class_reloptions, + &isNull); + if (isNull) + reloptions = (Datum) 0; + } + AlterTableCreateToastTable(OIDNewHeap, reloptions); + + if (OidIsValid(toastid)) + ReleaseSysCache(tuple); heap_close(OldHeap, NoLock); |