pgsql: Allow ALTER TABLE name {OF type | NOT OF}.
Allow ALTER TABLE name {OF type | NOT OF}.
This syntax allows a standalone table to be made into a typed table,
or a typed table to be made standalone. This is possibly a mildly
useful feature in its own right, but the real motivation for this
change is that we need it to make pg_upgrade work with typed tables.
This doesn't actually fix that problem, but it's necessary
infrastructure.
Noah Misch
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/68739ba856c52e6721d6cffec21f1bf0327a9a7b
Modified Files
--------------
doc/src/sgml/ref/alter_table.sgml | 26 +++
src/backend/commands/tablecmds.c | 277 +++++++++++++++++++++++++++--
src/backend/parser/gram.y | 17 ++
src/backend/parser/parse_utilcmd.c | 22 +---
src/include/commands/tablecmds.h | 2 +
src/include/nodes/parsenodes.h | 2 +
src/test/regress/expected/alter_table.out | 38 ++++
src/test/regress/sql/alter_table.sql | 30 +++
8 files changed, 376 insertions(+), 38 deletions(-)
2011/4/21 Robert Haas <rhaas@postgresql.org>:
Allow ALTER TABLE name {OF type | NOT OF}.
This syntax allows a standalone table to be made into a typed table,
or a typed table to be made standalone. This is possibly a mildly
useful feature in its own right, but the real motivation for this
change is that we need it to make pg_upgrade work with typed tables.
This doesn't actually fix that problem, but it's necessary
infrastructure.Noah Misch
Branch
------
masterDetails
-------
http://git.postgresql.org/pg/commitdiff/68739ba856c52e6721d6cffec21f1bf0327a9a7bModified Files
--------------
doc/src/sgml/ref/alter_table.sgml | 26 +++
src/backend/commands/tablecmds.c | 277 +++++++++++++++++++++++++++--
I noticed 2 warnings on unused variables from gcc in tablecmds.c
The attached patch fix that by removing those 2 variables.
src/backend/parser/gram.y | 17 ++
src/backend/parser/parse_utilcmd.c | 22 +---
src/include/commands/tablecmds.h | 2 +
src/include/nodes/parsenodes.h | 2 +
src/test/regress/expected/alter_table.out | 38 ++++
src/test/regress/sql/alter_table.sql | 30 +++
8 files changed, 376 insertions(+), 38 deletions(-)--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
--
Cédric Villemain 2ndQuadrant
http://2ndQuadrant.fr/ PostgreSQL : Expertise, Formation et Support
Attachments:
fix_warning_gcc.patchtext/x-patch; charset=US-ASCII; name=fix_warning_gcc.patchDownload
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 437a691..bdbcdff 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -8641,7 +8641,6 @@ ATExecAddOf(Relation rel, const TypeName *ofTypename, LOCKMODE lockmode)
{
Oid relid = RelationGetRelid(rel);
Type typetuple;
- Form_pg_type typ;
Oid typeid;
Relation inheritsRelation,
relationRelation;
@@ -8658,7 +8657,6 @@ ATExecAddOf(Relation rel, const TypeName *ofTypename, LOCKMODE lockmode)
/* Validate the type. */
typetuple = typenameType(NULL, ofTypename, NULL);
check_of_type(typetuple);
- typ = (Form_pg_type) GETSTRUCT(typetuple);
typeid = HeapTupleGetOid(typetuple);
/* Fail if the table has any inheritance parents. */
Excerpts from Cédric Villemain's message of vie may 27 18:37:05 -0400 2011:
2011/4/21 Robert Haas <rhaas@postgresql.org>:
Modified Files
--------------
doc/src/sgml/ref/alter_table.sgml | 26 +++
src/backend/commands/tablecmds.c | 277 +++++++++++++++++++++++++++--I noticed 2 warnings on unused variables from gcc in tablecmds.c
The attached patch fix that by removing those 2 variables.
My compiler wasn't complaining, but since the variable is clearly unused
I went ahead and pushed this. Thanks
--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
2011/5/28 Alvaro Herrera <alvherre@commandprompt.com>:
Excerpts from Cédric Villemain's message of vie may 27 18:37:05 -0400 2011:
2011/4/21 Robert Haas <rhaas@postgresql.org>:
Modified Files
--------------
doc/src/sgml/ref/alter_table.sgml | 26 +++
src/backend/commands/tablecmds.c | 277 +++++++++++++++++++++++++++--I noticed 2 warnings on unused variables from gcc in tablecmds.c
The attached patch fix that by removing those 2 variables.My compiler wasn't complaining, but since the variable is clearly unused
I went ahead and pushed this. Thanks
I have a recent gcc wich probably help here:
gcc-4.6.real (Debian 4.6.0-7) 4.6.1 20110507 (prerelease)
--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
--
Cédric Villemain 2ndQuadrant
http://2ndQuadrant.fr/ PostgreSQL : Expertise, Formation et Support