ok

Mini Shell

Direktori : /opt/alt/postgresql11/usr/share/man/man7/
Upload File :
Current File : //opt/alt/postgresql11/usr/share/man/man7/CREATE_FOREIGN_TABLE.7

'\" t
.\"     Title: CREATE FOREIGN TABLE
.\"    Author: The PostgreSQL Global Development Group
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\"      Date: 2017-11-06
.\"    Manual: PostgreSQL 9.2.24 Documentation
.\"    Source: PostgreSQL 9.2.24
.\"  Language: English
.\"
.TH "CREATE FOREIGN TABLE" "7" "2017-11-06" "PostgreSQL 9.2.24" "PostgreSQL 9.2.24 Documentation"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
CREATE_FOREIGN_TABLE \- define a new foreign table
.\" CREATE FOREIGN TABLE
.SH "SYNOPSIS"
.sp
.nf
CREATE FOREIGN TABLE [ IF NOT EXISTS ] \fItable_name\fR ( [
  { \fIcolumn_name\fR \fIdata_type\fR [ OPTIONS ( \fIoption\fR \*(Aq\fIvalue\fR\*(Aq [, \&.\&.\&. ] ) ] [ NULL | NOT NULL ] }
    [, \&.\&.\&. ]
] )
  SERVER \fIserver_name\fR
[ OPTIONS ( \fIoption\fR \*(Aq\fIvalue\fR\*(Aq [, \&.\&.\&. ] ) ]
.fi
.SH "DESCRIPTION"
.PP
\fBCREATE FOREIGN TABLE\fR
will create a new foreign table in the current database\&. The table will be owned by the user issuing the command\&.
.PP
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\&.
.PP
\fBCREATE FOREIGN TABLE\fR
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\&.
.PP
To be able to create a table, you must have
USAGE
privilege on all column types\&.
.SH "PARAMETERS"
.PP
IF NOT EXISTS
.RS 4
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\&.
.RE
.PP
\fItable_name\fR
.RS 4
The name (optionally schema\-qualified) of the table to be created\&.
.RE
.PP
\fIcolumn_name\fR
.RS 4
The name of a column to be created in the new table\&.
.RE
.PP
\fIdata_type\fR
.RS 4
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\&.
.RE
.PP
NOT NULL
.RS 4
The column is not allowed to contain null values\&.
.RE
.PP
NULL
.RS 4
The column is allowed to contain null values\&. This is the default\&.
.sp
This clause is only provided for compatibility with non\-standard SQL databases\&. Its use is discouraged in new applications\&.
.RE
.PP
\fIserver_name\fR
.RS 4
The name of an existing server for the foreign table\&.
.RE
.PP
OPTIONS ( \fIoption\fR \*(Aq\fIvalue\fR\*(Aq [, \&.\&.\&.] )
.RS 4
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\*(Aqs validator function\&. Duplicate option names are not allowed (although it\*(Aqs OK for a table option and a column option to have the same name)\&.
.RE
.SH "EXAMPLES"
.PP
Create foreign table
films
with
film_server:
.sp
.if n \{\
.RS 4
.\}
.nf
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;
.fi
.if n \{\
.RE
.\}
.SH "COMPATIBILITY"
.PP
The
\fBCREATE FOREIGN TABLE\fR
command largely conforms to the
SQL
standard; however, much as with
\fBCREATE TABLE\fR,
NULL
constraints and zero\-column foreign tables are permitted\&.
.SH "SEE ALSO"
ALTER FOREIGN TABLE (\fBALTER_FOREIGN_TABLE\fR(7)), DROP FOREIGN TABLE (\fBDROP_FOREIGN_TABLE\fR(7)), CREATE TABLE (\fBCREATE_TABLE\fR(7)), CREATE SERVER (\fBCREATE_SERVER\fR(7))

Zerion Mini Shell 1.0