1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

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.
This commit is contained in:
Tom Lane
2002-12-16 18:39:22 +00:00
parent 88177f77b1
commit 260faf0b63
5 changed files with 76 additions and 45 deletions

View File

@ -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.