aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-12-16 18:39:22 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-12-16 18:39:22 +0000
commit260faf0b633716d02e30103bd5e94eb40f06bf27 (patch)
tree578a60809421acd51066b5290fc3be05b778cb9e /src/backend/utils
parent88177f77b17ef478da1dbca9acb5e3a61b346613 (diff)
downloadpostgresql-260faf0b633716d02e30103bd5e94eb40f06bf27.tar.gz
postgresql-260faf0b633716d02e30103bd5e94eb40f06bf27.zip
Fix ALTER TABLE ADD COLUMN to disallow the same column types that are
disallowed by CREATE TABLE (eg, pseudo-types); also disallow these types from being introduced by the range-function syntax. While at it, allow CREATE TABLE to create zero-column tables, per recent pghackers discussion. I am back-patching this into 7.3 since failure to disallow pseudo-types is arguably a security hole.
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/cache/relcache.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 87992769e99..15f61ce59a6 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.182 2002/12/15 21:01:34 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.183 2002/12/16 18:39:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -570,7 +570,8 @@ RelationBuildTupleDesc(RelationBuildDescInfo buildinfo,
* cases for attnum=1 that used to exist in fastgetattr() and
* index_getattr().
*/
- relation->rd_att->attrs[0]->attcacheoff = 0;
+ if (relation->rd_rel->relnatts > 0)
+ relation->rd_att->attrs[0]->attcacheoff = 0;
/*
* Set up constraint/default info
@@ -2049,7 +2050,7 @@ RelationBuildLocalRelation(const char *relname,
int i;
bool has_not_null;
- AssertArg(natts > 0);
+ AssertArg(natts >= 0);
/*
* switch to the cache context to create the relcache entry.