diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/catversion.h | 2 | ||||
| -rw-r--r-- | src/include/catalog/dependency.h | 1 | ||||
| -rw-r--r-- | src/include/catalog/indexing.h | 3 | ||||
| -rw-r--r-- | src/include/catalog/pg_class.h | 1 | ||||
| -rw-r--r-- | src/include/catalog/pg_foreign_table.h | 53 | ||||
| -rw-r--r-- | src/include/commands/defrem.h | 5 | ||||
| -rw-r--r-- | src/include/nodes/nodes.h | 1 | ||||
| -rw-r--r-- | src/include/nodes/parsenodes.h | 18 | ||||
| -rw-r--r-- | src/include/utils/acl.h | 2 | ||||
| -rw-r--r-- | src/include/utils/syscache.h | 1 |
10 files changed, 85 insertions, 2 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index ac13a27830..8e41305691 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201012291 +#define CATALOG_VERSION_NO 201101011 #endif diff --git a/src/include/catalog/dependency.h b/src/include/catalog/dependency.h index 5de61f1b26..c6ab313edf 100644 --- a/src/include/catalog/dependency.h +++ b/src/include/catalog/dependency.h @@ -137,6 +137,7 @@ typedef enum ObjectClass OCLASS_FDW, /* pg_foreign_data_wrapper */ OCLASS_FOREIGN_SERVER, /* pg_foreign_server */ OCLASS_USER_MAPPING, /* pg_user_mapping */ + OCLASS_FOREIGN_TABLE, /* pg_foreign_table */ OCLASS_DEFACL, /* pg_default_acl */ MAX_OCLASS /* MUST BE LAST */ } ObjectClass; diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h index de11e440e8..a3fb916903 100644 --- a/src/include/catalog/indexing.h +++ b/src/include/catalog/indexing.h @@ -275,6 +275,9 @@ DECLARE_UNIQUE_INDEX(pg_user_mapping_oid_index, 174, on pg_user_mapping using bt DECLARE_UNIQUE_INDEX(pg_user_mapping_user_server_index, 175, on pg_user_mapping using btree(umuser oid_ops, umserver oid_ops)); #define UserMappingUserServerIndexId 175 +DECLARE_UNIQUE_INDEX(pg_foreign_table_relid_index, 3119, on pg_foreign_table using btree(ftrelid oid_ops)); +#define ForeignTableRelidIndexId 3119 + DECLARE_UNIQUE_INDEX(pg_default_acl_role_nsp_obj_index, 827, on pg_default_acl using btree(defaclrole oid_ops, defaclnamespace oid_ops, defaclobjtype char_ops)); #define DefaultAclRoleNspObjIndexId 827 DECLARE_UNIQUE_INDEX(pg_default_acl_oid_index, 828, on pg_default_acl using btree(oid oid_ops)); diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h index f0cff76e3a..b6a34c1779 100644 --- a/src/include/catalog/pg_class.h +++ b/src/include/catalog/pg_class.h @@ -148,6 +148,7 @@ DESCR(""); #define RELKIND_TOASTVALUE 't' /* moved off huge values */ #define RELKIND_VIEW 'v' /* view */ #define RELKIND_COMPOSITE_TYPE 'c' /* composite type */ +#define RELKIND_FOREIGN_TABLE 'f' /* foreign table */ #define RELPERSISTENCE_PERMANENT 'p' #define RELPERSISTENCE_UNLOGGED 'u' diff --git a/src/include/catalog/pg_foreign_table.h b/src/include/catalog/pg_foreign_table.h new file mode 100644 index 0000000000..ada807ad71 --- /dev/null +++ b/src/include/catalog/pg_foreign_table.h @@ -0,0 +1,53 @@ +/*------------------------------------------------------------------------- + * + * pg_foreign_table.h + * definition of the system "foreign table" relation (pg_foreign_table) + * + * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_foreign_table.h + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_FOREIGN_TABLE_H +#define PG_FOREIGN_TABLE_H + +#include "catalog/genbki.h" + +/* ---------------- + * pg_foreign_table definition. cpp turns this into + * typedef struct FormData_pg_foreign_table + * ---------------- + */ +#define ForeignTableRelationId 3118 + +CATALOG(pg_foreign_table,3118) BKI_WITHOUT_OIDS +{ + Oid ftrelid; /* OID of foreign table */ + Oid ftserver; /* OID of foreign server */ + text ftoptions[1]; /* FDW-specific options */ +} FormData_pg_foreign_table; + +/* ---------------- + * Form_pg_foreign_table corresponds to a pointer to a tuple with + * the format of pg_foreign_table relation. + * ---------------- + */ +typedef FormData_pg_foreign_table *Form_pg_foreign_table; + +/* ---------------- + * compiler constants for pg_foreign_table + * ---------------- + */ + +#define Natts_pg_foreign_table 3 +#define Anum_pg_foreign_table_ftrelid 1 +#define Anum_pg_foreign_table_ftserver 2 +#define Anum_pg_foreign_table_ftoptions 3 + +#endif /* PG_FOREIGN_TABLE_H */ diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h index 82ec446c0e..3d3e9f959a 100644 --- a/src/include/commands/defrem.h +++ b/src/include/commands/defrem.h @@ -154,6 +154,11 @@ extern void CreateUserMapping(CreateUserMappingStmt *stmt); extern void AlterUserMapping(AlterUserMappingStmt *stmt); extern void RemoveUserMapping(DropUserMappingStmt *stmt); extern void RemoveUserMappingById(Oid umId); +extern void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid); +extern Datum transformGenericOptions(Oid catalogId, + Datum oldOptions, + List *options, + Oid fdwvalidator); /* support routines in commands/define.c */ diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index 1ce5d81b2c..456e8e216a 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -353,6 +353,7 @@ typedef enum NodeTag T_DropUserMappingStmt, T_AlterTableSpaceOptionsStmt, T_SecLabelStmt, + T_CreateForeignTableStmt, /* * TAGS FOR PARSE TREE NODES (parsenodes.h) diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 9225c3ad16..3d2ae991b7 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -1066,6 +1066,7 @@ typedef enum ObjectType OBJECT_DOMAIN, OBJECT_FDW, OBJECT_FOREIGN_SERVER, + OBJECT_FOREIGN_TABLE, OBJECT_FUNCTION, OBJECT_INDEX, OBJECT_LANGUAGE, @@ -1165,7 +1166,8 @@ typedef enum AlterTableType AT_EnableReplicaRule, /* ENABLE REPLICA RULE name */ AT_DisableRule, /* DISABLE RULE name */ AT_AddInherit, /* INHERIT parent */ - AT_DropInherit /* NO INHERIT parent */ + AT_DropInherit, /* NO INHERIT parent */ + AT_GenericOptions, /* OPTIONS (...) */ } AlterTableType; typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */ @@ -1226,6 +1228,7 @@ typedef enum GrantObjectType ACL_OBJECT_DATABASE, /* database */ ACL_OBJECT_FDW, /* foreign-data wrapper */ ACL_OBJECT_FOREIGN_SERVER, /* foreign server */ + ACL_OBJECT_FOREIGN_TABLE, /* foreign table */ ACL_OBJECT_FUNCTION, /* function */ ACL_OBJECT_LANGUAGE, /* procedural language */ ACL_OBJECT_LARGEOBJECT, /* largeobject */ @@ -1580,6 +1583,18 @@ typedef struct DropForeignServerStmt } DropForeignServerStmt; /* ---------------------- + * Create FOREIGN TABLE Statements + * ---------------------- + */ + +typedef struct CreateForeignTableStmt +{ + CreateStmt base; + char *servername; + List *options; +} CreateForeignTableStmt; + +/* ---------------------- * Create/Drop USER MAPPING Statements * ---------------------- */ @@ -2068,6 +2083,7 @@ typedef struct RenameStmt { NodeTag type; ObjectType renameType; /* OBJECT_TABLE, OBJECT_COLUMN, etc */ + ObjectType relationType; /* if column name, associated relation type */ RangeVar *relation; /* in case it's a table */ List *object; /* in case it's some other object */ List *objarg; /* argument types, if applicable */ diff --git a/src/include/utils/acl.h b/src/include/utils/acl.h index d729e6f1d2..aac7442710 100644 --- a/src/include/utils/acl.h +++ b/src/include/utils/acl.h @@ -150,6 +150,7 @@ typedef ArrayType Acl; #define ACL_ALL_RIGHTS_DATABASE (ACL_CREATE|ACL_CREATE_TEMP|ACL_CONNECT) #define ACL_ALL_RIGHTS_FDW (ACL_USAGE) #define ACL_ALL_RIGHTS_FOREIGN_SERVER (ACL_USAGE) +#define ACL_ALL_RIGHTS_FOREIGN_TABLE (ACL_SELECT) #define ACL_ALL_RIGHTS_FUNCTION (ACL_EXECUTE) #define ACL_ALL_RIGHTS_LANGUAGE (ACL_USAGE) #define ACL_ALL_RIGHTS_LARGEOBJECT (ACL_SELECT|ACL_UPDATE) @@ -193,6 +194,7 @@ typedef enum AclObjectKind ACL_KIND_TSCONFIGURATION, /* pg_ts_config */ ACL_KIND_FDW, /* pg_foreign_data_wrapper */ ACL_KIND_FOREIGN_SERVER, /* pg_foreign_server */ + ACL_KIND_FOREIGN_TABLE, /* pg_foreign_table */ MAX_ACL_KIND /* MUST BE LAST */ } AclObjectKind; diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h index 48700e8a5b..66515a8f82 100644 --- a/src/include/utils/syscache.h +++ b/src/include/utils/syscache.h @@ -56,6 +56,7 @@ enum SysCacheIdentifier FOREIGNDATAWRAPPEROID, FOREIGNSERVERNAME, FOREIGNSERVEROID, + FOREIGNTABLEREL, INDEXRELID, LANGNAME, LANGOID, |
