diff options
| author | Jan Wieck <JanWieck@Yahoo.com> | 2000-07-03 23:10:14 +0000 |
|---|---|---|
| committer | Jan Wieck <JanWieck@Yahoo.com> | 2000-07-03 23:10:14 +0000 |
| commit | 57d8080a40f51e1ff9eedea602e96e2612161d77 (patch) | |
| tree | 6dbed1f7333436cb08af6e7c0d9c55ac5e064750 /src/backend/catalog | |
| parent | ef5bea51e17d36ab06e7e67847a8b1e489d6d189 (diff) | |
| download | postgresql-57d8080a40f51e1ff9eedea602e96e2612161d77.tar.gz | |
TOAST
WARNING: This is actually broken - we have self-deadlocks
due to concurrent changes in buffer management.
Vadim and me are working on it.
Jan
Diffstat (limited to 'src/backend/catalog')
| -rw-r--r-- | src/backend/catalog/heap.c | 25 | ||||
| -rw-r--r-- | src/backend/catalog/pg_type.c | 16 |
2 files changed, 35 insertions, 6 deletions
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 721297680e..2187b8db44 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.136 2000/07/02 22:00:34 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.137 2000/07/03 23:09:27 wieck Exp $ * * * INTERFACE ROUTINES @@ -730,7 +730,8 @@ AddNewRelationType(char *typeName, Oid new_rel_oid) NULL, /* array element type - irrelevent */ "-", /* default type value */ (bool) 1, /* passed by value */ - 'i'); /* default alignment */ + 'i', /* default alignment */ + 'p'); /* Not TOASTable */ } /* -------------------------------- @@ -1423,6 +1424,7 @@ heap_drop_with_catalog(const char *relname) Relation rel; Oid rid; bool istemp = (get_temp_rel_by_username(relname) != NULL); + bool has_toasttable; /* ---------------- * Open and lock the relation. @@ -1521,6 +1523,11 @@ heap_drop_with_catalog(const char *relname) rel->rd_unlinked = true; /* + * Remember if there is a toast relation for below + */ + has_toasttable = rel->rd_rel->reltoastrelid != InvalidOid; + + /* * Close relcache entry, but *keep* AccessExclusiveLock on the * relation until transaction commit. This ensures no one else will * try to do something with the doomed relation. @@ -1535,6 +1542,20 @@ heap_drop_with_catalog(const char *relname) if (istemp) remove_temp_relation(rid); + + if (has_toasttable) + { + char toast_relname[NAMEDATALEN]; + bool old_allow; + + old_allow = allowSystemTableMods; + allowSystemTableMods = true; + + sprintf(toast_relname, "pg_toast_%d", rid); + heap_drop_with_catalog(toast_relname); + + allowSystemTableMods = old_allow; + } } diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c index bf706d5146..bd34ee0a20 100644 --- a/src/backend/catalog/pg_type.c +++ b/src/backend/catalog/pg_type.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.52 2000/06/13 07:34:52 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.53 2000/07/03 23:09:28 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -186,7 +186,8 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName) values[i++] = (Datum) InvalidOid; /* 12 */ values[i++] = (Datum) InvalidOid; /* 13 */ values[i++] = (Datum) InvalidOid; /* 14 */ - values[i++] = (Datum) 'i'; /* 15 */ + values[i++] = (Datum) 'p'; /* 15 */ + values[i++] = (Datum) 'i'; /* 16 */ /* * ... and fill typdefault with a bogus value @@ -287,7 +288,8 @@ TypeCreate(char *typeName, char *elementTypeName, char *defaultTypeValue, /* internal rep */ bool passedByValue, - char alignment) + char alignment, + char storage) { int i, j; @@ -449,10 +451,16 @@ TypeCreate(char *typeName, values[i++] = (Datum) alignment; /* 15 */ /* ---------------- + * set default storage for TOAST + * ---------------- + */ + values[i++] = (Datum) storage; /* 16 */ + + /* ---------------- * initialize the default value for this type. * ---------------- */ - values[i] = (Datum) textin(PointerIsValid(defaultTypeValue) /* 16 */ + values[i] = (Datum) textin(PointerIsValid(defaultTypeValue) /* 17 */ ? defaultTypeValue : "-"); /* XXX default * typdefault */ |
