diff options
| author | Bruce Momjian <bruce@momjian.us> | 2000-09-12 04:49:17 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2000-09-12 04:49:17 +0000 |
| commit | 264c0682077fe9ec5c9bd366f756451db397d4fb (patch) | |
| tree | 22ae0abba34aab4e25024f081b52781f33022963 /src/backend/catalog | |
| parent | c0af8babe305c732db26c0aac35800811aeb9303 (diff) | |
| download | postgresql-264c0682077fe9ec5c9bd366f756451db397d4fb.tar.gz | |
This patch implements a different "relkind"
for views. Views are now have a "relkind" of
RELKIND_VIEW instead of RELKIND_RELATION.
Also, views no longer have actual heap storage
files.
The following changes were made
1. CREATE VIEW sets the new relkind
2. The executor complains if a DELETE or
INSERT references a view.
3. DROP RULE complains if an attempt is made
to delete a view SELECT rule.
4. CREATE RULE "_RETmytable" AS ON SELECT TO mytable DO INSTEAD ...
1. checks to make sure mytable is empty.
2. sets the relkind to RELKIND_VIEW.
3. deletes the heap storage files.
5. LOCK myview is not allowed. :)
6. the regression test type_sanity was changed to
account for the new relkind value.
7. CREATE INDEX ON myview ... is not allowed.
8. VACUUM myview is not allowed.
VACUUM automatically skips views when do the entire
database.
9. TRUNCATE myview is not allowed.
THINGS LEFT TO THINK ABOUT
o pg_views
o pg_dump
o pgsql (\d \dv)
o Do we really want to be able to inherit from views?
o Is 'DROP TABLE myview' OK?
--
Mark Hollomon
Diffstat (limited to 'src/backend/catalog')
| -rw-r--r-- | src/backend/catalog/heap.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index cf4b86e2e8..68bb827698 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.142 2000/08/03 19:19:08 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.143 2000/09/12 04:49:06 momjian Exp $ * * * INTERFACE ROUTINES @@ -842,7 +842,9 @@ heap_create_with_catalog(char *relname, /* * We create the disk file for this relation here */ - heap_storage_create(new_rel_desc); + if (relkind != RELKIND_VIEW) + heap_storage_create(new_rel_desc); + /* ---------------- * ok, the relation has been cataloged, so close our relations * and return the oid of the newly created relation. @@ -1468,7 +1470,7 @@ heap_drop_with_catalog(const char *relname, * unlink the relation's physical file and finish up. * ---------------- */ - if (! rel->rd_unlinked) + if (rel->rd_rel->relkind != RELKIND_VIEW && ! rel->rd_unlinked) smgrunlink(DEFAULT_SMGR, rel); rel->rd_unlinked = true; |
