From: Shigeru Hanada Date: Mon, 18 Oct 2010 06:09:30 +0000 (+0900) Subject: Remove support for creating typed foreign tables. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=d8ab32aa60f88e5fa9ceb5c789c0dd40c61dc114;p=users%2Fhanada%2Fpostgres.git Remove support for creating typed foreign tables. SQL/MED standard requires CREATE FOREIGN TABLE statement to accept only such as: [ ] Typed tables are supported on only normal tables. --- diff --git a/doc/src/sgml/ref/create_foreign_table.sgml b/doc/src/sgml/ref/create_foreign_table.sgml index ac6e2e868e..37418000cf 100644 --- a/doc/src/sgml/ref/create_foreign_table.sgml +++ b/doc/src/sgml/ref/create_foreign_table.sgml @@ -32,17 +32,6 @@ CREATE FOREIGN TABLE table_name ( [ [ WITH OIDS | WITHOUT OIDS ] [ OPTIONS ( option 'value' [, ... ] ) ] -CREATE FOREIGN TABLE table_name - OF type_name [ ( - { column_name WITH OPTIONS [ column_constraint [ ... ] ] - | table_constraint } - [, ... ] -) ] -[ INHERITS ( parent_table [, ... ] ) ] - SERVER server_name -[ WITH OIDS | WITHOUT OIDS ] -[ OPTIONS ( option 'value' [, ... ] ) ] - where column_constraint is: [ CONSTRAINT constraint_name ] @@ -125,27 +114,6 @@ CHECK ( expression ) - - OF type_name - - - Creates a typed table, which takes its - structure from the specified composite type (name optionally - schema-qualified). A typed table is tied to its type; for - example the table will be dropped if the type is dropped - (with DROP TYPE ... CASCADE). - - - - When a typed table is created, then the data types of the - columns are determined by the underlying composite type and are - not specified by the CREATE FOREIGN TABLE command. - But the CREATE FOREIGN TABLE command can add defaults - and constraints to the table. - - - - column_name @@ -167,6 +135,18 @@ CHECK ( expression ) + + OPTIONS ( option = 'value' [, ...] ) + + + This clause specified options for the new foreign table. + The allowed option names and values are specific to each foreign + data wrapper and are validated using the foreign-data wrapper + library. Option names must be unique. + + + + INHERITS ( parent_table [, ... ] ) @@ -403,17 +383,6 @@ SERVER distributor_server; - - Create a composite type and a typed foreign table: - -CREATE TYPE employee_type AS (name text, salary numeric); - -CREATE FOREIGN TABLE employees OF employee_type ( - salary WITH OPTIONS CHECK (salary > 0) -) -SERVER employee_server; - - @@ -494,18 +463,6 @@ SERVER employee_server; - - Typed Tables - - - Typed tables implement a subset of the SQL standard. According to - the standard, a typed table has columns corresponding to the - underlying composite type as well as one other column that is - the self-referencing column. PostgreSQL does not - support these self-referencing columns explicitly, but the same - effect can be had using the OID feature. - - diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 87f961ea69..11977c5f39 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -282,7 +282,6 @@ static RangeVar *makeRangeVarFromAnyName(List *names, int position, core_yyscan_ OptTableElementList TableElementList OptInherit definition OptTypedTableElementList TypedTableElementList OptForeignTableElementList ForeignTableElementList - OptTypedForeignTableElementList TypedForeignTableElementList reloptions opt_reloptions OptWith opt_distinct opt_definition func_args func_args_list func_args_with_defaults func_args_with_defaults_list @@ -357,8 +356,7 @@ static RangeVar *makeRangeVarFromAnyName(List *names, int position, core_yyscan_ %type set_rest SetResetClause %type TableElement TypedTableElement ConstraintElem TableFuncElement - ForeignTableElement TypedForeignTableElement - ForeignConstraintElem + ForeignTableElement ForeignConstraintElem %type CheckConstraintElem UniqueConstraintElem PrimaryKeyConstraintElem ExcludeConstraintElem ForeignKeyConstraintElem %type columnDef columnOptions @@ -3486,22 +3484,6 @@ CreateForeignTableStmt: n->options = $10; $$ = (Node *) n; } - | CREATE FOREIGN TABLE qualified_name OF any_name - OptTypedForeignTableElementList - SERVER name OptWith create_generic_options - { - CreateForeignTableStmt *n = makeNode(CreateForeignTableStmt); - $4->istemp = false; - n->base.relation = $4; - n->base.tableElts = $7; - n->base.ofTypename = makeTypeNameFromNameList($6); - n->base.ofTypename->location = @6; - n->base.options = $10; - /* FDW-specific data */ - n->servername = $9; - n->options = $11; - $$ = (Node *) n; - } ; OptForeignTableElementList: @@ -3514,11 +3496,6 @@ OptForeignTableElementList: } ; -OptTypedForeignTableElementList: - '(' TypedForeignTableElementList ')' { $$ = $2; } - | /*EMPTY*/ { $$ = NIL; } - ; - ForeignTableElementList: ForeignTableElement { @@ -3530,28 +3507,12 @@ ForeignTableElementList: } ; -TypedForeignTableElementList: - TypedForeignTableElement - { - $$ = list_make1($1); - } - | TypedForeignTableElementList ',' TypedForeignTableElement - { - $$ = lappend($1, $3); - } - ; - ForeignTableElement: foreignColumnDef { $$ = $1; } | ForeignTableLikeClause { $$ = $1; } | ForeignTableConstraint { $$ = $1; } ; -TypedForeignTableElement: - columnOptions { $$ = $1; } - | ForeignTableConstraint { $$ = $1; } - ; - /* TODO: support GENERIC OPTIONS of foreign column */ foreignColumnDef: ColId Typename ForeignColQualList {