Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

create_foreign_table(7) [centos man page]

CREATE FOREIGN 
TABLE(7) PostgreSQL 9.2.7 Documentation CREATE FOREIGN TABLE(7) NAME
CREATE_FOREIGN_TABLE - define a new foreign table SYNOPSIS
CREATE FOREIGN TABLE [ IF NOT EXISTS ] table_name ( [ { column_name data_type [ OPTIONS ( option 'value' [, ... ] ) ] [ NULL | NOT NULL ] } [, ... ] ] ) SERVER server_name [ OPTIONS ( option 'value' [, ... ] ) ] DESCRIPTION
CREATE FOREIGN TABLE will create a new foreign table in the current database. The table will be owned by the user issuing the command. If a schema name is given (for example, CREATE FOREIGN TABLE myschema.mytable ...) then the table is created in the specified schema. Otherwise it is created in the current schema. The name of the foreign table must be distinct from the name of any other foreign table, table, sequence, index, or view in the same schema. CREATE FOREIGN TABLE also automatically creates a data type that represents the composite type corresponding to one row of the foreign table. Therefore, foreign tables cannot have the same name as any existing data type in the same schema. To be able to create a table, you must have USAGE privilege on all column types. PARAMETERS
IF NOT EXISTS Do not throw an error if a relation with the same name already exists. A notice is issued in this case. Note that there is no guarantee that the existing relation is anything like the one that would have been created. table_name The name (optionally schema-qualified) of the table to be created. column_name The name of a column to be created in the new table. data_type The data type of the column. This can include array specifiers. For more information on the data types supported by PostgreSQL, refer to Chapter 8, Data Types, in the documentation. NOT NULL The column is not allowed to contain null values. NULL The column is allowed to contain null values. This is the default. This clause is only provided for compatibility with non-standard SQL databases. Its use is discouraged in new applications. server_name The name of an existing server for the foreign table. OPTIONS ( option 'value' [, ...] ) Options to be associated with the new foreign table or one of its columns. The allowed option names and values are specific to each foreign data wrapper and are validated using the foreign-data wrapper's validator function. Duplicate option names are not allowed (although it's OK for a table option and a column option to have the same name). EXAMPLES
Create foreign table films with film_server: CREATE FOREIGN TABLE films ( code char(5) NOT NULL, title varchar(40) NOT NULL, did integer NOT NULL, date_prod date, kind varchar(10), len interval hour to minute ) SERVER film_server; COMPATIBILITY
The CREATE FOREIGN TABLE command largely conforms to the SQL standard; however, much as with CREATE TABLE, NULL constraints and zero-column foreign tables are permitted. SEE ALSO
ALTER FOREIGN TABLE (ALTER_FOREIGN_TABLE(7)), DROP FOREIGN TABLE (DROP_FOREIGN_TABLE(7)), CREATE TABLE (CREATE_TABLE(7)), CREATE SERVER (CREATE_SERVER(7)) PostgreSQL 9.2.7 2014-02-17 CREATE FOREIGN TABLE(7)

Check Out this Related Man Page

ALTER FOREIGN DATA 
WRAPPER(7) PostgreSQL 9.2.7 Documentation ALTER FOREIGN DATA WRAPPER(7) NAME
ALTER_FOREIGN_DATA_WRAPPER - change the definition of a foreign-data wrapper SYNOPSIS
ALTER FOREIGN DATA WRAPPER name [ HANDLER handler_function | NO HANDLER ] [ VALIDATOR validator_function | NO VALIDATOR ] [ OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ]) ] ALTER FOREIGN DATA WRAPPER name OWNER TO new_owner ALTER FOREIGN DATA WRAPPER name RENAME TO new_name DESCRIPTION
ALTER FOREIGN DATA WRAPPER changes the definition of a foreign-data wrapper. The first form of the command changes the support functions or the generic options of the foreign-data wrapper (at least one clause is required). The second form changes the owner of the foreign-data wrapper. Only superusers can alter foreign-data wrappers. Additionally, only superusers can own foreign-data wrappers. PARAMETERS
name The name of an existing foreign-data wrapper. HANDLER handler_function Specifies a new handler function for the foreign-data wrapper. NO HANDLER This is used to specify that the foreign-data wrapper should no longer have a handler function. Note that foreign tables that use a foreign-data wrapper with no handler cannot be accessed. VALIDATOR validator_function Specifies a new validator function for the foreign-data wrapper. Note that it is possible that after changing the validator the options to the foreign-data wrapper, servers, and user mappings have become invalid. It is up to the user to make sure that these options are correct before using the foreign-data wrapper. NO VALIDATOR This is used to specify that the foreign-data wrapper should no longer have a validator function. OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] ) Change options for the foreign-data wrapper. ADD, SET, and DROP specify the action to be performed. ADD is assumed if no operation is explicitly specified. Option names must be unique; names and values are also validated using the foreign data wrapper's validator function, if any. new_owner The user name of the new owner of the foreign-data wrapper. new_name The new name for the foreign-data wrapper. EXAMPLES
Change a foreign-data wrapper dbi, add option foo, drop bar: ALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP 'bar'); Change the foreign-data wrapper dbi validator to bob.myvalidator: ALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator; COMPATIBILITY
ALTER FOREIGN DATA WRAPPER conforms to ISO/IEC 9075-9 (SQL/MED), except that the HANDLER, VALIDATOR, OWNER TO, and RENAME clauses are extensions. SEE ALSO
CREATE FOREIGN DATA WRAPPER (CREATE_FOREIGN_DATA_WRAPPER(7)), DROP FOREIGN DATA WRAPPER (DROP_FOREIGN_DATA_WRAPPER(7)) PostgreSQL 9.2.7 2014-02-17 ALTER FOREIGN DATA WRAPPER(7)
Man Page