ALTER FOREIGN TABLE ft2 ALTER COLUMN c1 OPTIONS (column_name 'C 1');
\det+
List of foreign tables
- Schema | Table | Server | FDW Options | Description
+ Schema | Table | Server | FDW options | Description
--------+------------+-----------+--------------------------------------------------+-------------
public | ft1 | loopback | (schema_name 'S 1', table_name 'T 1') |
public | ft2 | loopback | (schema_name 'S 1', table_name 'T 1') |
IMPORT FOREIGN SCHEMA import_source FROM SERVER loopback INTO import_dest1;
\det+ import_dest1.*
List of foreign tables
- Schema | Table | Server | FDW Options | Description
+ Schema | Table | Server | FDW options | Description
--------------+-------+----------+-------------------------------------------------+-------------
import_dest1 | t1 | loopback | (schema_name 'import_source', table_name 't1') |
import_dest1 | t2 | loopback | (schema_name 'import_source', table_name 't2') |
\d import_dest1.*
Foreign table "import_dest1.t1"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+-------------------+-----------+----------+---------+--------------------
c1 | integer | | | | (column_name 'c1')
c2 | character varying | | not null | | (column_name 'c2')
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 't1')
+FDW options: (schema_name 'import_source', table_name 't1')
Foreign table "import_dest1.t2"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+-------------------+-----------+----------+---------+--------------------
c1 | integer | | | | (column_name 'c1')
c2 | character varying | | | | (column_name 'c2')
c3 | text | POSIX | | | (column_name 'c3')
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 't2')
+FDW options: (schema_name 'import_source', table_name 't2')
Foreign table "import_dest1.t3"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+--------------------------+-----------+----------+---------+--------------------
c1 | timestamp with time zone | | | | (column_name 'c1')
c2 | typ1 | | | | (column_name 'c2')
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 't3')
+FDW options: (schema_name 'import_source', table_name 't3')
Foreign table "import_dest1.t4"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+---------+-----------+----------+---------+--------------------
c1 | integer | | | | (column_name 'c1')
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 't4')
+FDW options: (schema_name 'import_source', table_name 't4')
Foreign table "import_dest1.x 4"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+-----------------------+-----------+----------+---------+---------------------
c1 | double precision | | | | (column_name 'c1')
C 2 | text | | | | (column_name 'C 2')
c3 | character varying(42) | | | | (column_name 'c3')
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 'x 4')
+FDW options: (schema_name 'import_source', table_name 'x 4')
Foreign table "import_dest1.x 5"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+------+-----------+----------+---------+-------------
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 'x 5')
+FDW options: (schema_name 'import_source', table_name 'x 5')
-- Options
CREATE SCHEMA import_dest2;
OPTIONS (import_default 'true');
\det+ import_dest2.*
List of foreign tables
- Schema | Table | Server | FDW Options | Description
+ Schema | Table | Server | FDW options | Description
--------------+-------+----------+-------------------------------------------------+-------------
import_dest2 | t1 | loopback | (schema_name 'import_source', table_name 't1') |
import_dest2 | t2 | loopback | (schema_name 'import_source', table_name 't2') |
\d import_dest2.*
Foreign table "import_dest2.t1"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+-------------------+-----------+----------+---------+--------------------
c1 | integer | | | | (column_name 'c1')
c2 | character varying | | not null | | (column_name 'c2')
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 't1')
+FDW options: (schema_name 'import_source', table_name 't1')
Foreign table "import_dest2.t2"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+-------------------+-----------+----------+---------+--------------------
c1 | integer | | | 42 | (column_name 'c1')
c2 | character varying | | | | (column_name 'c2')
c3 | text | POSIX | | | (column_name 'c3')
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 't2')
+FDW options: (schema_name 'import_source', table_name 't2')
Foreign table "import_dest2.t3"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+--------------------------+-----------+----------+---------+--------------------
c1 | timestamp with time zone | | | now() | (column_name 'c1')
c2 | typ1 | | | | (column_name 'c2')
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 't3')
+FDW options: (schema_name 'import_source', table_name 't3')
Foreign table "import_dest2.t4"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+---------+-----------+----------+---------+--------------------
c1 | integer | | | | (column_name 'c1')
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 't4')
+FDW options: (schema_name 'import_source', table_name 't4')
Foreign table "import_dest2.x 4"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+-----------------------+-----------+----------+---------+---------------------
c1 | double precision | | | | (column_name 'c1')
C 2 | text | | | | (column_name 'C 2')
c3 | character varying(42) | | | | (column_name 'c3')
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 'x 4')
+FDW options: (schema_name 'import_source', table_name 'x 4')
Foreign table "import_dest2.x 5"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+------+-----------+----------+---------+-------------
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 'x 5')
+FDW options: (schema_name 'import_source', table_name 'x 5')
CREATE SCHEMA import_dest3;
IMPORT FOREIGN SCHEMA import_source FROM SERVER loopback INTO import_dest3
OPTIONS (import_collate 'false', import_not_null 'false');
\det+ import_dest3.*
List of foreign tables
- Schema | Table | Server | FDW Options | Description
+ Schema | Table | Server | FDW options | Description
--------------+-------+----------+-------------------------------------------------+-------------
import_dest3 | t1 | loopback | (schema_name 'import_source', table_name 't1') |
import_dest3 | t2 | loopback | (schema_name 'import_source', table_name 't2') |
\d import_dest3.*
Foreign table "import_dest3.t1"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+-------------------+-----------+----------+---------+--------------------
c1 | integer | | | | (column_name 'c1')
c2 | character varying | | | | (column_name 'c2')
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 't1')
+FDW options: (schema_name 'import_source', table_name 't1')
Foreign table "import_dest3.t2"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+-------------------+-----------+----------+---------+--------------------
c1 | integer | | | | (column_name 'c1')
c2 | character varying | | | | (column_name 'c2')
c3 | text | | | | (column_name 'c3')
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 't2')
+FDW options: (schema_name 'import_source', table_name 't2')
Foreign table "import_dest3.t3"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+--------------------------+-----------+----------+---------+--------------------
c1 | timestamp with time zone | | | | (column_name 'c1')
c2 | typ1 | | | | (column_name 'c2')
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 't3')
+FDW options: (schema_name 'import_source', table_name 't3')
Foreign table "import_dest3.t4"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+---------+-----------+----------+---------+--------------------
c1 | integer | | | | (column_name 'c1')
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 't4')
+FDW options: (schema_name 'import_source', table_name 't4')
Foreign table "import_dest3.x 4"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+-----------------------+-----------+----------+---------+---------------------
c1 | double precision | | | | (column_name 'c1')
C 2 | text | | | | (column_name 'C 2')
c3 | character varying(42) | | | | (column_name 'c3')
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 'x 4')
+FDW options: (schema_name 'import_source', table_name 'x 4')
Foreign table "import_dest3.x 5"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
--------+------+-----------+----------+---------+-------------
Server: loopback
-FDW Options: (schema_name 'import_source', table_name 'x 5')
+FDW options: (schema_name 'import_source', table_name 'x 5')
-- Check LIMIT TO and EXCEPT
CREATE SCHEMA import_dest4;
FROM SERVER loopback INTO import_dest4;
\det+ import_dest4.*
List of foreign tables
- Schema | Table | Server | FDW Options | Description
+ Schema | Table | Server | FDW options | Description
--------------+-------+----------+------------------------------------------------+-------------
import_dest4 | t1 | loopback | (schema_name 'import_source', table_name 't1') |
(1 row)
FROM SERVER loopback INTO import_dest4;
\det+ import_dest4.*
List of foreign tables
- Schema | Table | Server | FDW Options | Description
+ Schema | Table | Server | FDW options | Description
--------------+-------+----------+-------------------------------------------------+-------------
import_dest4 | t1 | loopback | (schema_name 'import_source', table_name 't1') |
import_dest4 | t2 | loopback | (schema_name 'import_source', table_name 't2') |
CREATE FOREIGN DATA WRAPPER foo OPTIONS (testing '1');
\dew+
List of foreign-data wrappers
- Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
+ Name | Owner | Handler | Validator | Access privileges | FDW options | Description
------------+---------------------------+---------+--------------------------+-------------------+---------------+-------------
dummy | regress_foreign_data_user | - | - | | | useless
foo | regress_foreign_data_user | - | - | | (testing '1') |
CREATE FOREIGN DATA WRAPPER foo OPTIONS (testing '1', another '2');
\dew+
List of foreign-data wrappers
- Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
+ Name | Owner | Handler | Validator | Access privileges | FDW options | Description
------------+---------------------------+---------+--------------------------+-------------------+----------------------------+-------------
dummy | regress_foreign_data_user | - | - | | | useless
foo | regress_foreign_data_user | - | - | | (testing '1', another '2') |
CREATE FOREIGN DATA WRAPPER foo VALIDATOR postgresql_fdw_validator;
\dew+
List of foreign-data wrappers
- Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
+ Name | Owner | Handler | Validator | Access privileges | FDW options | Description
------------+---------------------------+---------+--------------------------+-------------------+-------------+-------------
dummy | regress_foreign_data_user | - | - | | | useless
foo | regress_foreign_data_user | - | postgresql_fdw_validator | | |
ALTER FOREIGN DATA WRAPPER foo NO VALIDATOR;
\dew+
List of foreign-data wrappers
- Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
+ Name | Owner | Handler | Validator | Access privileges | FDW options | Description
------------+---------------------------+---------+--------------------------+-------------------+-------------+-------------
dummy | regress_foreign_data_user | - | - | | | useless
foo | regress_foreign_data_user | - | - | | |
ALTER FOREIGN DATA WRAPPER foo OPTIONS (ADD x '1', DROP x);
\dew+
List of foreign-data wrappers
- Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
+ Name | Owner | Handler | Validator | Access privileges | FDW options | Description
------------+---------------------------+---------+--------------------------+-------------------+----------------+-------------
dummy | regress_foreign_data_user | - | - | | | useless
foo | regress_foreign_data_user | - | - | | (a '1', b '2') |
ALTER FOREIGN DATA WRAPPER foo OPTIONS (DROP a, SET b '3', ADD c '4');
\dew+
List of foreign-data wrappers
- Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
+ Name | Owner | Handler | Validator | Access privileges | FDW options | Description
------------+---------------------------+---------+--------------------------+-------------------+----------------+-------------
dummy | regress_foreign_data_user | - | - | | | useless
foo | regress_foreign_data_user | - | - | | (b '3', c '4') |
ERROR: option "b" provided more than once
\dew+
List of foreign-data wrappers
- Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
+ Name | Owner | Handler | Validator | Access privileges | FDW options | Description
------------+---------------------------+---------+--------------------------+-------------------+-----------------------+-------------
dummy | regress_foreign_data_user | - | - | | | useless
foo | regress_foreign_data_user | - | - | | (b '3', c '4', a '2') |
ALTER FOREIGN DATA WRAPPER foo OPTIONS (ADD d '5');
\dew+
List of foreign-data wrappers
- Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
+ Name | Owner | Handler | Validator | Access privileges | FDW options | Description
------------+---------------------------+---------+--------------------------+-------------------+------------------------------+-------------
dummy | regress_foreign_data_user | - | - | | | useless
foo | regress_foreign_data_user | - | - | | (b '3', c '4', a '2', d '5') |
RESET ROLE;
\dew+
List of foreign-data wrappers
- Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
+ Name | Owner | Handler | Validator | Access privileges | FDW options | Description
------------+---------------------------+---------+--------------------------+-------------------+------------------------------+-------------
dummy | regress_foreign_data_user | - | - | | | useless
foo | regress_test_role_super | - | - | | (b '3', c '4', a '2', d '5') |
ALTER FOREIGN DATA WRAPPER foo RENAME TO foo1;
\dew+
List of foreign-data wrappers
- Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
+ Name | Owner | Handler | Validator | Access privileges | FDW options | Description
------------+---------------------------+---------+--------------------------+-------------------+------------------------------+-------------
dummy | regress_foreign_data_user | - | - | | | useless
foo1 | regress_test_role_super | - | - | | (b '3', c '4', a '2', d '5') |
NOTICE: foreign-data wrapper "nonexistent" does not exist, skipping
\dew+
List of foreign-data wrappers
- Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
+ Name | Owner | Handler | Validator | Access privileges | FDW options | Description
------------+---------------------------+---------+--------------------------+-------------------+------------------------------+-------------
dummy | regress_foreign_data_user | - | - | | | useless
foo | regress_test_role_super | - | - | | (b '3', c '4', a '2', d '5') |
DROP ROLE regress_test_role_super;
\dew+
List of foreign-data wrappers
- Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
+ Name | Owner | Handler | Validator | Access privileges | FDW options | Description
------------+---------------------------+---------+--------------------------+-------------------+-------------+-------------
dummy | regress_foreign_data_user | - | - | | | useless
postgresql | regress_foreign_data_user | - | postgresql_fdw_validator | | |
NOTICE: user mapping for "regress_foreign_data_user" already exists for server s1, skipping
\dew+
List of foreign-data wrappers
- Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
+ Name | Owner | Handler | Validator | Access privileges | FDW options | Description
------------+---------------------------+---------+--------------------------+-------------------+-------------+-------------
dummy | regress_foreign_data_user | - | - | | | useless
foo | regress_foreign_data_user | - | - | | |
\des+
List of foreign servers
- Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW Options | Description
+ Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW options | Description
------+---------------------------+----------------------+-------------------+------+---------+-------------+----------------
s1 | regress_foreign_data_user | foo | | | | | foreign server
(1 row)
\deu+
List of user mappings
- Server | User name | FDW Options
+ Server | User name | FDW options
--------+---------------------------+-------------
s1 | regress_foreign_data_user |
(1 row)
drop cascades to user mapping for regress_foreign_data_user on server s1
\dew+
List of foreign-data wrappers
- Name | Owner | Handler | Validator | Access privileges | FDW Options | Description
+ Name | Owner | Handler | Validator | Access privileges | FDW options | Description
------------+---------------------------+---------+--------------------------+-------------------+-------------+-------------
dummy | regress_foreign_data_user | - | - | | | useless
postgresql | regress_foreign_data_user | - | postgresql_fdw_validator | | |
\des+
List of foreign servers
- Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW Options | Description
+ Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW options | Description
------+-------+----------------------+-------------------+------+---------+-------------+-------------
(0 rows)
\deu+
List of user mappings
- Server | User name | FDW Options
+ Server | User name | FDW options
--------+-----------+-------------
(0 rows)
CREATE SERVER s8 FOREIGN DATA WRAPPER postgresql OPTIONS (host 'localhost', dbname 's8db');
\des+
List of foreign servers
- Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW Options | Description
+ Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW options | Description
------+---------------------------+----------------------+-------------------+--------+---------+-----------------------------------+-------------
s1 | regress_foreign_data_user | foo | | | | |
s2 | regress_foreign_data_user | foo | | | | (host 'a', dbname 'b') |
RESET ROLE;
\des+
List of foreign servers
- Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW Options | Description
+ Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW options | Description
------+---------------------------+----------------------+-------------------+--------+---------+-----------------------------------+-------------
s1 | regress_foreign_data_user | foo | | | | |
s2 | regress_foreign_data_user | foo | | | | (host 'a', dbname 'b') |
CREATE SERVER t2 FOREIGN DATA WRAPPER foo;
\des+
List of foreign servers
- Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW Options | Description
+ Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW options | Description
------+---------------------------+----------------------+-------------------+--------+---------+-----------------------------------+-------------
s1 | regress_foreign_data_user | foo | | | | |
s2 | regress_foreign_data_user | foo | | | | (host 'a', dbname 'b') |
GRANT USAGE ON FOREIGN SERVER s6 TO regress_test_role2 WITH GRANT OPTION;
\des+
List of foreign servers
- Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW Options | Description
+ Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW options | Description
------+---------------------------+----------------------+-------------------------------------------------------+--------+---------+-----------------------------------+-------------
s1 | regress_foreign_data_user | foo | regress_foreign_data_user=U/regress_foreign_data_user+| | 1.0 | (servername 's1') |
| | | regress_test_role=U/regress_foreign_data_user | | | |
privileges for foreign-data wrapper foo
\des+
List of foreign servers
- Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW Options | Description
+ Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW options | Description
------+---------------------------+----------------------+-------------------------------------------------------+--------+---------+--------------------------------------+-------------
s1 | regress_test_indirect | foo | regress_test_indirect=U/regress_test_indirect | | 1.1 | (servername 's1') |
s2 | regress_foreign_data_user | foo | | | 1.1 | (host 'a', dbname 'b') |
ALTER SERVER s8 RENAME to s8new;
\des+
List of foreign servers
- Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW Options | Description
+ Name | Owner | Foreign-data wrapper | Access privileges | Type | Version | FDW options | Description
-------+---------------------------+----------------------+-------------------------------------------------------+--------+---------+--------------------------------------+-------------
s1 | regress_test_indirect | foo | regress_test_indirect=U/regress_test_indirect | | 1.1 | (servername 's1') |
s2 | regress_foreign_data_user | foo | | | 1.1 | (host 'a', dbname 'b') |
RESET ROLE;
\deu+
List of user mappings
- Server | User name | FDW Options
+ Server | User name | FDW options
--------+---------------------------+----------------------------------
s4 | public | ("this mapping" 'is public')
s4 | regress_foreign_data_user |
COMMENT ON COLUMN ft1.c1 IS 'ft1.c1';
\d+ ft1
Foreign table "public.ft1"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+--------------------------------+----------+--------------+-------------
c1 | integer | | not null | | ("param 1" 'val1') | plain | | ft1.c1
c2 | text | | | | (param2 'val2', param3 'val3') | extended | |
"ft1_c2_check" CHECK (c2 <> ''::text)
"ft1_c3_check" CHECK (c3 >= '01-01-1994'::date AND c3 <= '01-31-1994'::date)
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
\det+
List of foreign tables
- Schema | Table | Server | FDW Options | Description
+ Schema | Table | Server | FDW options | Description
--------+-------+--------+-------------------------------------------------+-------------
public | ft1 | s0 | (delimiter ',', quote '"', "be quoted" 'value') | ft1
(1 row)
ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 SET STORAGE PLAIN;
\d+ ft1
Foreign table "public.ft1"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+--------------------------------+----------+--------------+-------------
c1 | integer | | not null | | ("param 1" 'val1') | plain | 10000 |
c2 | text | | | | (param2 'val2', param3 'val3') | extended | |
"ft1_c2_check" CHECK (c2 <> ''::text)
"ft1_c3_check" CHECK (c3 >= '01-01-1994'::date AND c3 <= '01-31-1994'::date)
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
-- can't change the column type if it's used elsewhere
CREATE TABLE use_ft1_column_type (x ft1);
ALTER FOREIGN TABLE foreign_schema.ft1 RENAME TO foreign_table_1;
\d foreign_schema.foreign_table_1
Foreign table "foreign_schema.foreign_table_1"
- Column | Type | Collation | Nullable | Default | FDW Options
+ Column | Type | Collation | Nullable | Default | FDW options
------------------+---------+-----------+----------+---------+--------------------------------
foreign_column_1 | integer | | not null | | ("param 1" 'val1')
c2 | text | | | | (param2 'val2', param3 'val3')
"ft1_c2_check" CHECK (c2 <> ''::text)
"ft1_c3_check" CHECK (c3 >= '01-01-1994'::date AND c3 <= '01-31-1994'::date)
Server: s0
-FDW Options: (quote '~', "be quoted" 'value', escape '@')
+FDW options: (quote '~', "be quoted" 'value', escape '@')
-- alter noexisting table
ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 ADD COLUMN c4 integer;
-- owner of server can see option fields
\deu+
List of user mappings
- Server | User name | FDW Options
+ Server | User name | FDW options
--------+---------------------------+-------------------
s10 | public | ("user" 'secret')
s4 | regress_foreign_data_user |
-- superuser can see option fields
\deu+
List of user mappings
- Server | User name | FDW Options
+ Server | User name | FDW options
--------+---------------------------+---------------------
s10 | public | ("user" 'secret')
s4 | regress_foreign_data_user |
SET ROLE regress_unprivileged_role;
\deu+
List of user mappings
- Server | User name | FDW Options
+ Server | User name | FDW options
--------+---------------------------+-------------
s10 | public |
s4 | regress_foreign_data_user |
\d+ ft2
Foreign table "public.ft2"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
c3 | date | | | | | plain | |
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
Inherits: pt1
DROP FOREIGN TABLE ft2;
) SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted" 'value');
\d+ ft2
Foreign table "public.ft2"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
c3 | date | | | | | plain | |
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
ALTER FOREIGN TABLE ft2 INHERIT pt1;
\d+ pt1
\d+ ft2
Foreign table "public.ft2"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
c3 | date | | | | | plain | |
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
Inherits: pt1
CREATE TABLE ct3() INHERITS(ft2);
NOTICE: merging column "c3" with inherited definition
\d+ ft2
Foreign table "public.ft2"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
c3 | date | | | | | plain | |
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
Inherits: pt1
Child tables: ct3,
ft3
\d+ ft3
Foreign table "public.ft3"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
\d+ ft2
Foreign table "public.ft2"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
c7 | integer | | not null | | | plain | |
c8 | integer | | | | | plain | |
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
Inherits: pt1
Child tables: ct3,
ft3
\d+ ft3
Foreign table "public.ft3"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
\d+ ft2
Foreign table "public.ft2"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | 10000 |
c2 | text | | | | | extended | |
c7 | integer | | | | | plain | |
c8 | text | | | | | external | |
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
Inherits: pt1
Child tables: ct3,
ft3
\d+ ft2
Foreign table "public.ft2"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | 10000 |
c2 | text | | | | | extended | |
c3 | date | | | | | plain | |
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
Inherits: pt1
Child tables: ct3,
ft3
\d+ ft2
Foreign table "public.ft2"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | 10000 |
c2 | text | | | | | extended | |
Check constraints:
"pt1chk2" CHECK (c2 <> ''::text)
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
Inherits: pt1
Child tables: ct3,
ft3
\d+ ft2
Foreign table "public.ft2"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
Check constraints:
"pt1chk2" CHECK (c2 <> ''::text)
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
Inherits: pt1
-- drop constraints recursively
\d+ ft2
Foreign table "public.ft2"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
"pt1chk2" CHECK (c2 <> ''::text)
"pt1chk3" CHECK (c2 <> ''::text) NOT VALID
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
Inherits: pt1
-- VALIDATE CONSTRAINT need do nothing on foreign tables
\d+ ft2
Foreign table "public.ft2"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
"pt1chk2" CHECK (c2 <> ''::text)
"pt1chk3" CHECK (c2 <> ''::text)
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
Inherits: pt1
-- OID system column
\d+ ft2
Foreign table "public.ft2"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
"pt1chk2" CHECK (c2 <> ''::text)
"pt1chk3" CHECK (c2 <> ''::text)
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
Inherits: pt1
Has OIDs: yes
\d+ ft2
Foreign table "public.ft2"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
"pt1chk2" CHECK (c2 <> ''::text)
"pt1chk3" CHECK (c2 <> ''::text)
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
Inherits: pt1
-- changes name of an attribute recursively
\d+ ft2
Foreign table "public.ft2"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
f1 | integer | | not null | | | plain | |
f2 | text | | | | | extended | |
"f2_check" CHECK (f2 <> ''::text)
"pt1chk2" CHECK (f2 <> ''::text)
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
Inherits: pt1
-- TRUNCATE doesn't work on foreign tables, either directly or recursively
\d+ pt2_1
Foreign table "public.pt2_1"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
Partition of: pt2 FOR VALUES IN (1)
Partition constraint: ((c1 IS NOT NULL) AND (c1 = ANY (ARRAY[1])))
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
-- partition cannot have additional columns
DROP FOREIGN TABLE pt2_1;
) SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted" 'value');
\d+ pt2_1
Foreign table "public.pt2_1"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+--------------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
c3 | date | | | | | plain | |
c4 | character(1) | | | | | extended | |
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
ALTER TABLE pt2 ATTACH PARTITION pt2_1 FOR VALUES IN (1); -- ERROR
ERROR: table "pt2_1" contains column "c4" not found in parent "pt2"
) SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted" 'value');
\d+ pt2_1
Foreign table "public.pt2_1"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
c3 | date | | | | | plain | |
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
-- no attach partition validation occurs for foreign tables
ALTER TABLE pt2 ATTACH PARTITION pt2_1 FOR VALUES IN (1);
\d+ pt2_1
Foreign table "public.pt2_1"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
Partition of: pt2 FOR VALUES IN (1)
Partition constraint: ((c1 IS NOT NULL) AND (c1 = ANY (ARRAY[1])))
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
-- cannot add column to a partition
ALTER TABLE pt2_1 ADD c4 char;
\d+ pt2_1
Foreign table "public.pt2_1"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
Check constraints:
"p21chk" CHECK (c2 <> ''::text)
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
-- cannot drop inherited NOT NULL constraint from a partition
ALTER TABLE pt2_1 ALTER c1 DROP NOT NULL;
\d+ pt2_1
Foreign table "public.pt2_1"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | | | | extended | |
Check constraints:
"p21chk" CHECK (c2 <> ''::text)
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
ALTER TABLE pt2 ATTACH PARTITION pt2_1 FOR VALUES IN (1); -- ERROR
ERROR: column "c2" in child table must be marked NOT NULL
\d+ pt2_1
Foreign table "public.pt2_1"
- Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
+ Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
c1 | integer | | not null | | | plain | |
c2 | text | | not null | | | extended | |
Check constraints:
"p21chk" CHECK (c2 <> ''::text)
Server: s0
-FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
+FDW options: (delimiter ',', quote '"', "be quoted" 'value')
ALTER TABLE pt2 ATTACH PARTITION pt2_1 FOR VALUES IN (1); -- ERROR
ERROR: child table is missing constraint "pt2chk1"