?
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
CREATE SERVER server_name [ TYPE 'server_type' ] [ VERSION 'server_version' ] FOREIGN DATA WRAPPER fdw_name [ OPTIONS ( option 'value' [, ... ] ) ]
CREATE SERVER定義一個(gè)新的外服務(wù)器。定義該服務(wù)器的用戶將成為其所有者。
一個(gè)外服務(wù)器通常封裝一個(gè)外數(shù)據(jù)封裝器用于訪問(wèn)一個(gè)外部數(shù)據(jù)資源的連接信息。 額外的特定用戶連接信息可以通過(guò)用戶映射來(lái)聲明。
服務(wù)器名稱必須是數(shù)據(jù)庫(kù)內(nèi)獨(dú)一無(wú)二的。
創(chuàng)建一個(gè)服務(wù)器需要使用的外部數(shù)據(jù)封裝包上的USAGE權(quán)限。
要?jiǎng)?chuàng)建的外部服務(wù)器的名稱。
可選的服務(wù)器類型。
可選的服務(wù)器類型。
管理服務(wù)器的外部數(shù)據(jù)封裝包的名稱。
該子句為服務(wù)器聲明選項(xiàng)。選項(xiàng)通常定義服務(wù)器連接的詳細(xì)情況,但是 實(shí)際的名稱和值依賴于服務(wù)器的外部數(shù)據(jù)的封裝器。
When using the dblink module (see Section F.8), the foreign server name can be used as an argument of the dblink_connect function to indicate the connection parameters. See also there for more examples. It is necessary to have the USAGE privilege on the foreign server to be able to use it in this way. 當(dāng)使用dblink模塊(參閱Section F.8), 外部服務(wù)器名稱可以用作一個(gè)dblink_connect函數(shù)的參數(shù) 來(lái)表示連接參數(shù)。參見(jiàn)更多示例。為了能夠以這種方式使用它,有必要在外服務(wù)器上擁有 USAGE權(quán)限。
創(chuàng)建一個(gè)使用內(nèi)置的外部數(shù)據(jù)封裝器default的服務(wù)器foo:
CREATE SERVER foo FOREIGN DATA WRAPPER "default";
創(chuàng)建一個(gè)使用外部數(shù)據(jù)封裝器pgsql的服務(wù)器myserver:
CREATE SERVER myserver FOREIGN DATA WRAPPER pgsql OPTIONS (host 'foo', dbname 'foodb', port '5432');
CREATE SERVER符合于ISO/IEC 9075-9 (SQL/MED).