diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2011-03-04 23:39:44 +0200 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2011-03-04 23:42:07 +0200 |
commit | b9cff97fdf486eca7e563a9696a7391048814d0f (patch) | |
tree | 842d92d0efcf3e0fa8118b9a47160e0ad9075da1 /src/backend/commands | |
parent | 8d3b421f5f7b955e7ac7d156aa74ee6a6fe4e9f6 (diff) | |
download | postgresql-b9cff97fdf486eca7e563a9696a7391048814d0f.tar.gz postgresql-b9cff97fdf486eca7e563a9696a7391048814d0f.zip |
Don't allow CREATE TABLE AS to create a column with invalid collation
It is possible that an expression ends up with a collatable type but
without a collation. CREATE TABLE AS could then create a table based
on that. But such a column cannot be dumped with valid SQL syntax, so
we disallow creating such a column.
per test report from Noah Misch
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/tablecmds.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index e76ce2ceb13..3be9a6f3481 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -4206,7 +4206,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, typeOid = HeapTupleGetOid(typeTuple); /* make sure datatype is legal for a column */ - CheckAttributeType(colDef->colname, typeOid, false); + CheckAttributeType(colDef->colname, typeOid, collOid, false); /* construct new attribute's pg_attribute entry */ attribute.attrelid = myrelid; @@ -6515,7 +6515,7 @@ ATPrepAlterColumnType(List **wqueue, typenameTypeIdModColl(NULL, typeName, &targettype, &targettypmod, &targetcollid); /* make sure datatype is legal for a column */ - CheckAttributeType(colName, targettype, false); + CheckAttributeType(colName, targettype, targetcollid, false); if (tab->relkind == RELKIND_RELATION) { |