On 06.04.2020 19:40, Anastasia Lubennikova wrote:
On 06.04.2020 16:49, Anastasia Lubennikova wrote:New version of the patch is attached. I fixed several issues in the check_for_changed_signatures().Now it passes check without "test_rename_catalog_objects" and fails (generates script) with it. Test script pg_upgrade_ACL_test.sh demonstrates this.The only known issue left is the usage of pg_identify_object(), though I don't see a problem here with object types that this patch involves.As I updated the code, I will leave this patch in Need Review.One more fix for free_acl_infos(). Thanks to cfbot.
One more update.In this version I rebased test patches, added some more comments, fixed memory allocation issue and also removed code that handles ACLs on languages. They require a lot of specific handling, while I doubt that their signatures, which consist of language name only, are subject to change in any future versions.
-- Anastasia Lubennikova Postgres Professional: http://www.postgrespro.com The Russian Postgres Company
commit c7ce324b4a213184c9b5fec18055921fc846ccad Author: anastasia <[email protected]> Date: Mon Jun 8 18:34:14 2020 +0300 pg_upgrade_ACL_check_v9.patch diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c index 00aef855dc..94e8528a3a 100644 --- a/src/bin/pg_upgrade/check.c +++ b/src/bin/pg_upgrade/check.c @@ -16,6 +16,7 @@ static void check_new_cluster_is_empty(void); static void check_databases_are_compatible(void); +static void check_for_changed_signatures(void); static void check_locale_and_encoding(DbInfo *olddb, DbInfo *newdb); static bool equivalent_locale(int category, const char *loca, const char *locb); static void check_is_install_user(ClusterInfo *cluster); @@ -142,6 +143,8 @@ check_and_dump_old_cluster(bool live_check) if (GET_MAJOR_VERSION(old_cluster.major_version) <= 804) new_9_0_populate_pg_largeobject_metadata(&old_cluster, true); + get_non_default_acl_infos(&old_cluster); + /* * While not a check option, we do this now because this is the only time * the old server is running. @@ -161,6 +164,7 @@ check_new_cluster(void) check_new_cluster_is_empty(); check_databases_are_compatible(); + check_for_changed_signatures(); check_loadable_libraries(); @@ -443,6 +447,223 @@ check_databases_are_compatible(void) } } +/* + * Find the location of the last dot, return NULL if not found. + */ +static char * +last_dot_location(const char *identity) +{ + const char *p, + *ret = NULL; + + for (p = identity; *p; p++) + if (*p == '.') + ret = p; + return unconstify(char *, ret); +} + +/* + * check_for_changed_signatures() + * + * Check that the old cluster doesn't have non-default ACL's for system objects + * (relations, attributes, functions and procedures) which have different + * signatures in the new cluster. Otherwise generate revoke_objects.sql. + */ +static void +check_for_changed_signatures(void) +{ + PGconn *conn; + char subquery[QUERY_ALLOC]; + PGresult *res; + int ntups; + int i_obj_ident; + int dbnum; + bool need_check = false; + FILE *script = NULL; + bool found_changed = false; + char output_path[MAXPGPATH]; + + prep_status("Checking for system objects with non-default ACL"); + + for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++) + if (old_cluster.dbarr.dbs[dbnum].non_def_acl_arr.nacls > 0) + { + need_check = true; + break; + } + /* + * The old cluster doesn't have system objects with non-default ACL so + * quickly exit. + */ + if (!need_check) + { + check_ok(); + return; + } + + snprintf(output_path, sizeof(output_path), "revoke_objects.sql"); + + snprintf(subquery, sizeof(subquery), + /* Get system relations which created in pg_catalog */ + "SELECT 'pg_class'::regclass classid, oid objid, 0 objsubid " + "FROM pg_catalog.pg_class " + "WHERE relnamespace = 'pg_catalog'::regnamespace " + "UNION ALL " + /* Get system relations attributes which created in pg_catalog */ + "SELECT 'pg_class'::regclass, att.attrelid, att.attnum " + "FROM pg_catalog.pg_class rel " + "INNER JOIN pg_catalog.pg_attribute att ON rel.oid = att.attrelid " + "WHERE rel.relnamespace = 'pg_catalog'::regnamespace " + "UNION ALL " + /* Get system functions and procedure which created in pg_catalog */ + "SELECT 'pg_proc'::regclass, oid, 0 " + "FROM pg_catalog.pg_proc " + "WHERE pronamespace = 'pg_catalog'::regnamespace "); + + conn = connectToServer(&new_cluster, "template1"); + res = executeQueryOrDie(conn, + "SELECT ident.type, ident.identity " + "FROM (%s) obj, " + "LATERAL pg_catalog.pg_identify_object(" + " obj.classid, obj.objid, obj.objsubid) ident " + /* + * Don't rely on database collation, since we use strcmp + * comparison to find non-default ACLs. + */ + "ORDER BY ident.identity COLLATE \"C\";", subquery); + ntups = PQntuples(res); + + i_obj_ident = PQfnumber(res, "identity"); + + for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++) + { + DbInfo *dbinfo = &old_cluster.dbarr.dbs[dbnum]; + bool db_used = false; + int aclnum = 0, + objnum = 0; + + /* + * For every database check system objects with non-default ACL. + * + * AclInfo array is sorted by obj_ident. This allows us to compare + * AclInfo entries with the query result above efficiently. + */ + for (aclnum = 0; aclnum < dbinfo->non_def_acl_arr.nacls; aclnum++) + { + AclInfo *aclinfo = &dbinfo->non_def_acl_arr.aclinfos[aclnum]; + bool report = false; + + while (objnum < ntups) + { + int ret; + + ret = strcmp(aclinfo->obj_ident, + PQgetvalue(res, objnum, i_obj_ident)); + + /* + * The new cluster doesn't have an object with same identity, + * exit the loop, report below and check next object. + */ + if (ret < 0) + { + report = true; + break; + } + /* + * The new cluster has an object with same identity, just exit + * the loop. + */ + else if (ret == 0) + { + objnum++; + break; + } + else + objnum++; + } + + if (report) + { + found_changed = true; + if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL) + pg_fatal("could not open file \"%s\": %s\n", + output_path, strerror(errno)); + if (!db_used) + { + PQExpBufferData conn_buf; + + initPQExpBuffer(&conn_buf); + appendPsqlMetaConnect(&conn_buf, dbinfo->db_name); + fputs(conn_buf.data, script); + termPQExpBuffer(&conn_buf); + + db_used = true; + } + + /* Handle columns separately */ + if (strstr(aclinfo->obj_type, "column") != NULL) + { + char *pdot = last_dot_location(aclinfo->obj_ident); + PQExpBufferData ident_buf; + + if (pdot == NULL || *(pdot + 1) == '\0') + pg_fatal("invalid column identity \"%s\"", + aclinfo->obj_ident); + + initPQExpBuffer(&ident_buf); + appendBinaryPQExpBuffer(&ident_buf, aclinfo->obj_ident, + pdot - aclinfo->obj_ident); + + fprintf(script, "REVOKE ALL (%s) ON %s FROM %s;\n", + /* pg_identify_object() quotes identity if necessary */ + pdot + 1, ident_buf.data, + /* role_names is already quoted */ + aclinfo->role_names); + termPQExpBuffer(&ident_buf); + } + /* + * For relations except sequences we don't need to specify + * the object type. + */ + else if (aclinfo->is_relation && + strcmp(aclinfo->obj_type, "sequence") != 0) + fprintf(script, "REVOKE ALL ON %s FROM %s;\n", + /* pg_identify_object() quotes identity if necessary */ + aclinfo->obj_ident, + /* role_names is already quoted */ + aclinfo->role_names); + /* Other object types */ + else + fprintf(script, "REVOKE ALL ON %s %s FROM %s;\n", + aclinfo->obj_type, + /* pg_identify_object() quotes identity if necessary */ + aclinfo->obj_ident, + /* role_names is already quoted */ + aclinfo->role_names); + } + } + } + + PQclear(res); + PQfinish(conn); + + if (script) + fclose(script); + + if (found_changed) + { + pg_log(PG_REPORT, "fatal\n"); + pg_fatal("Your installation contains non-default privileges for system objects\n" + "for which the API has changed. To perform the upgrade, reset these\n" + "privileges to default. The file\n" + " %s\n" + "when executed by psql will revoke non-default privileges for those objects.\n\n", + output_path); + } + else + check_ok(); +} + /* * create_script_for_cluster_analyze() diff --git a/src/bin/pg_upgrade/info.c b/src/bin/pg_upgrade/info.c index 7e524ea192..2fad020567 100644 --- a/src/bin/pg_upgrade/info.c +++ b/src/bin/pg_upgrade/info.c @@ -11,6 +11,7 @@ #include "access/transam.h" #include "catalog/pg_class_d.h" +#include "fe_utils/string_utils.h" #include "pg_upgrade.h" static void create_rel_filename_map(const char *old_data, const char *new_data, @@ -23,6 +24,7 @@ static void free_db_and_rel_infos(DbInfoArr *db_arr); static void get_db_infos(ClusterInfo *cluster); static void get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo); static void free_rel_infos(RelInfoArr *rel_arr); +static void free_acl_infos(AclInfoArr *acl_arr); static void print_db_infos(DbInfoArr *dbinfo); static void print_rel_infos(RelInfoArr *rel_arr); @@ -328,6 +330,114 @@ get_db_and_rel_infos(ClusterInfo *cluster) } +/* + * get_non_default_acl_infos() + * + * Fill AclInfo array with information about system objects that + * have non-default ACL. + * + * Note: the resulting AclInfo array is assumed to be sorted by identity. + */ +void +get_non_default_acl_infos(ClusterInfo *cluster) +{ + int dbnum; + + for (dbnum = 0; dbnum < cluster->dbarr.ndbs; dbnum++) + { + DbInfo *dbinfo = &cluster->dbarr.dbs[dbnum]; + PGconn *conn = connectToServer(cluster, dbinfo->db_name); + PGresult *res; + AclInfo *aclinfos; + AclInfo *curr; + int nacls = 0, + size_acls = 8; + int aclnum = 0; + int i_obj_type, + i_obj_ident, + i_rolname, + i_is_relation; + + res = executeQueryOrDie(conn, + /* + * Get relations, attributes, functions and procedures. Some system + * objects like views are not pinned, but these type of objects are + * created in pg_catalog schema. + */ + "SELECT obj.type, obj.identity, shd.refobjid::regrole rolename, " + " CASE WHEN shd.classid = 'pg_class'::regclass THEN true " + " ELSE false " + " END is_relation " + "FROM pg_catalog.pg_shdepend shd, " + "LATERAL pg_catalog.pg_identify_object(" + " shd.classid, shd.objid, shd.objsubid) obj " + /* 'a' is for SHARED_DEPENDENCY_ACL */ + "WHERE shd.deptype = 'a' AND shd.dbid = %d " + " AND shd.classid IN ('pg_proc'::regclass, 'pg_class'::regclass) " + /* get only system objects */ + " AND obj.schema = 'pg_catalog' " + /* + * Sort only by identity. It should be enough to uniquely compare + * objects later in check_for_changed_signatures(). + * Don't rely on database collation, since we use strcmp + * comparison below. + */ + "ORDER BY obj.identity COLLATE \"C\";", dbinfo->db_oid); + + i_obj_type = PQfnumber(res, "type"); + i_obj_ident = PQfnumber(res, "identity"); + i_rolname = PQfnumber(res, "rolename"); + i_is_relation = PQfnumber(res, "is_relation"); + + aclinfos = (AclInfo *) pg_malloc(sizeof(AclInfo) * size_acls); + + while (aclnum < PQntuples(res)) + { + PQExpBuffer roles_buf; + + if (nacls == size_acls) + { + size_acls *= 2; + aclinfos = (AclInfo *) pg_realloc(aclinfos, + sizeof(AclInfo) * size_acls); + } + curr = &aclinfos[nacls++]; + + curr->obj_type = pg_strdup(PQgetvalue(res, aclnum, i_obj_type)); + curr->obj_ident = pg_strdup(PQgetvalue(res, aclnum, i_obj_ident)); + curr->is_relation = PQgetvalue(res, aclnum, i_is_relation)[0] == 't'; + + roles_buf = createPQExpBuffer(); + initPQExpBuffer(roles_buf); + + /* + * For each object gather string of role names mentioned in ACL + * in a format convenient for further use in REVOKE statement. + */ + while (aclnum < PQntuples(res) && + strcmp(curr->obj_ident, PQgetvalue(res, aclnum, i_obj_ident)) == 0) + { + if (roles_buf->len != 0) + appendPQExpBufferChar(roles_buf, ','); + + appendPQExpBufferStr(roles_buf, + quote_identifier(PQgetvalue(res, aclnum, i_rolname))); + aclnum++; + } + + curr->role_names = pg_strdup(roles_buf->data); + destroyPQExpBuffer(roles_buf); + } + + PQclear(res); + PQfinish(conn); + + dbinfo->non_def_acl_arr.aclinfos = aclinfos; + dbinfo->non_def_acl_arr.nacls = nacls; + } +} + + /* * get_db_infos() * @@ -384,6 +494,9 @@ get_db_infos(ClusterInfo *cluster) dbinfos[tupnum].db_ctype = pg_strdup(PQgetvalue(res, tupnum, i_datctype)); snprintf(dbinfos[tupnum].db_tablespace, sizeof(dbinfos[tupnum].db_tablespace), "%s", PQgetvalue(res, tupnum, i_spclocation)); + + /* initialize clean array */ + dbinfos[tupnum].non_def_acl_arr.nacls = 0; } PQclear(res); @@ -595,6 +708,8 @@ free_db_and_rel_infos(DbInfoArr *db_arr) for (dbnum = 0; dbnum < db_arr->ndbs; dbnum++) { free_rel_infos(&db_arr->dbs[dbnum].rel_arr); + if (&db_arr->dbs[dbnum].non_def_acl_arr.nacls > 0) + free_acl_infos(&db_arr->dbs[dbnum].non_def_acl_arr); pg_free(db_arr->dbs[dbnum].db_name); } pg_free(db_arr->dbs); @@ -620,6 +735,21 @@ free_rel_infos(RelInfoArr *rel_arr) rel_arr->nrels = 0; } +static void +free_acl_infos(AclInfoArr *acl_arr) +{ + int aclnum; + + for (aclnum = 0; aclnum < acl_arr->nacls; aclnum++) + { + pg_free(acl_arr->aclinfos[aclnum].obj_type); + pg_free(acl_arr->aclinfos[aclnum].obj_ident); + pg_free(acl_arr->aclinfos[aclnum].role_names); + } + pg_free(acl_arr->aclinfos); + acl_arr->nacls = 0; +} + static void print_db_infos(DbInfoArr *db_arr) diff --git a/src/bin/pg_upgrade/pg_upgrade.h b/src/bin/pg_upgrade/pg_upgrade.h index 8b90cefbe0..33bbe2d233 100644 --- a/src/bin/pg_upgrade/pg_upgrade.h +++ b/src/bin/pg_upgrade/pg_upgrade.h @@ -147,6 +147,26 @@ typedef struct int nrels; } RelInfoArr; +/* + * Information about database object needed to check + * if its signature has changed between versions + * and generate REVOKE statement if necessary. + */ +typedef struct +{ + char *obj_type; /* object type */ + char *obj_ident; /* complete object identity */ + bool is_relation; /* if the object is relation */ + char *role_names; /* list of role names which have permissions + * on the object */ +} AclInfo; + +typedef struct +{ + AclInfo *aclinfos; + int nacls; +} AclInfoArr; + /* * The following structure represents a relation mapping. */ @@ -183,6 +203,8 @@ typedef struct char *db_ctype; int db_encoding; RelInfoArr rel_arr; /* array of all user relinfos */ + AclInfoArr non_def_acl_arr; /* array of objects info with non default + * ACL */ } DbInfo; typedef struct @@ -390,6 +412,7 @@ FileNameMap *gen_db_file_maps(DbInfo *old_db, DbInfo *new_db, int *nmaps, const char *old_pgdata, const char *new_pgdata); void get_db_and_rel_infos(ClusterInfo *cluster); +void get_non_default_acl_infos(ClusterInfo *cluster); void print_maps(FileNameMap *maps, int n, const char *db_name);
pg_upgrade_ACL_test.sh
Description: application/shellscript
diff --git a/src/backend/catalog/Makefile b/src/backend/catalog/Makefile
index 9499bb33e5..4fdd367a6f 100644
--- a/src/backend/catalog/Makefile
+++ b/src/backend/catalog/Makefile
@@ -67,7 +67,7 @@ CATALOG_HEADERS := \
pg_foreign_table.h pg_policy.h pg_replication_origin.h \
pg_default_acl.h pg_init_privs.h pg_seclabel.h pg_shseclabel.h \
pg_collation.h pg_partitioned_table.h pg_range.h pg_transform.h \
- pg_sequence.h pg_publication.h pg_publication_rel.h pg_subscription.h \
+ pg_sequence.h pg_publication.h pg_publication_rel.h pg_sub.h \
pg_subscription_rel.h
GENERATED_HEADERS := $(CATALOG_HEADERS:%.h=%_d.h) schemapg.h
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index cb2c4972ad..7c4247e2c9 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -50,7 +50,7 @@
#include "catalog/pg_opfamily.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_statistic_ext.h"
-#include "catalog/pg_subscription.h"
+#include "catalog/pg_sub.h"
#include "catalog/pg_tablespace.h"
#include "catalog/pg_transform.h"
#include "catalog/pg_ts_config.h"
diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c
index 7d6acaed92..e251b410e6 100644
--- a/src/backend/catalog/catalog.c
+++ b/src/backend/catalog/catalog.c
@@ -37,7 +37,7 @@
#include "catalog/pg_shdepend.h"
#include "catalog/pg_shdescription.h"
#include "catalog/pg_shseclabel.h"
-#include "catalog/pg_subscription.h"
+#include "catalog/pg_sub.h"
#include "catalog/pg_tablespace.h"
#include "catalog/pg_type.h"
#include "catalog/toasting.h"
diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c
index 5565e6fc19..38ac1f8c53 100644
--- a/src/backend/catalog/dependency.c
+++ b/src/backend/catalog/dependency.c
@@ -51,7 +51,7 @@
#include "catalog/pg_publication_rel.h"
#include "catalog/pg_rewrite.h"
#include "catalog/pg_statistic_ext.h"
-#include "catalog/pg_subscription.h"
+#include "catalog/pg_sub.h"
#include "catalog/pg_tablespace.h"
#include "catalog/pg_transform.h"
#include "catalog/pg_trigger.h"
diff --git a/src/backend/catalog/information_schema.sql
b/src/backend/catalog/information_schema.sql
index 3e07fb107e..cba7e55ce0 100644
--- a/src/backend/catalog/information_schema.sql
+++ b/src/backend/catalog/information_schema.sql
@@ -42,7 +42,7 @@ SET search_path TO information_schema;
/* Expand any 1-D array into a set with integers 1..N */
CREATE FUNCTION _pg_expandarray(IN anyarray, OUT x anyelement, OUT n int)
RETURNS SETOF RECORD
- LANGUAGE sql STRICT IMMUTABLE PARALLEL SAFE
+ LANGUAGE pgsql STRICT IMMUTABLE PARALLEL SAFE
AS 'select $1[s], s - pg_catalog.array_lower($1,1) + 1
from pg_catalog.generate_series(pg_catalog.array_lower($1,1),
pg_catalog.array_upper($1,1),
@@ -51,7 +51,7 @@ CREATE FUNCTION _pg_expandarray(IN anyarray, OUT x
anyelement, OUT n int)
/* Given an index's OID and an underlying-table column number, return the
* column's position in the index (NULL if not there) */
CREATE FUNCTION _pg_index_position(oid, smallint) RETURNS int
- LANGUAGE sql STRICT STABLE
+ LANGUAGE pgsql STRICT STABLE
AS $$
SELECT (ss.a).n FROM
(SELECT information_schema._pg_expandarray(indkey) AS a
@@ -60,7 +60,7 @@ SELECT (ss.a).n FROM
$$;
CREATE FUNCTION _pg_truetypid(pg_attribute, pg_type) RETURNS oid
- LANGUAGE sql
+ LANGUAGE pgsql
IMMUTABLE
PARALLEL SAFE
RETURNS NULL ON NULL INPUT
@@ -68,7 +68,7 @@ CREATE FUNCTION _pg_truetypid(pg_attribute, pg_type) RETURNS
oid
$$SELECT CASE WHEN $2.typtype = 'd' THEN $2.typbasetype ELSE $1.atttypid END$$;
CREATE FUNCTION _pg_truetypmod(pg_attribute, pg_type) RETURNS int4
- LANGUAGE sql
+ LANGUAGE pgsql
IMMUTABLE
PARALLEL SAFE
RETURNS NULL ON NULL INPUT
@@ -78,7 +78,7 @@ $$SELECT CASE WHEN $2.typtype = 'd' THEN $2.typtypmod ELSE
$1.atttypmod END$$;
-- these functions encapsulate knowledge about the encoding of typmod:
CREATE FUNCTION _pg_char_max_length(typid oid, typmod int4) RETURNS integer
- LANGUAGE sql
+ LANGUAGE pgsql
IMMUTABLE
PARALLEL SAFE
RETURNS NULL ON NULL INPUT
@@ -94,7 +94,7 @@ $$SELECT
END$$;
CREATE FUNCTION _pg_char_octet_length(typid oid, typmod int4) RETURNS integer
- LANGUAGE sql
+ LANGUAGE pgsql
IMMUTABLE
PARALLEL SAFE
RETURNS NULL ON NULL INPUT
@@ -110,7 +110,7 @@ $$SELECT
END$$;
CREATE FUNCTION _pg_numeric_precision(typid oid, typmod int4) RETURNS integer
- LANGUAGE sql
+ LANGUAGE pgsql
IMMUTABLE
PARALLEL SAFE
RETURNS NULL ON NULL INPUT
@@ -131,7 +131,7 @@ $$SELECT
END$$;
CREATE FUNCTION _pg_numeric_precision_radix(typid oid, typmod int4) RETURNS
integer
- LANGUAGE sql
+ LANGUAGE pgsql
IMMUTABLE
PARALLEL SAFE
RETURNS NULL ON NULL INPUT
@@ -143,7 +143,7 @@ $$SELECT
END$$;
CREATE FUNCTION _pg_numeric_scale(typid oid, typmod int4) RETURNS integer
- LANGUAGE sql
+ LANGUAGE pgsql
IMMUTABLE
PARALLEL SAFE
RETURNS NULL ON NULL INPUT
@@ -159,7 +159,7 @@ $$SELECT
END$$;
CREATE FUNCTION _pg_datetime_precision(typid oid, typmod int4) RETURNS integer
- LANGUAGE sql
+ LANGUAGE pgsql
IMMUTABLE
PARALLEL SAFE
RETURNS NULL ON NULL INPUT
@@ -175,7 +175,7 @@ $$SELECT
END$$;
CREATE FUNCTION _pg_interval_type(typid oid, mod int4) RETURNS text
- LANGUAGE sql
+ LANGUAGE pgsql
IMMUTABLE
PARALLEL SAFE
RETURNS NULL ON NULL INPUT
@@ -1477,7 +1477,7 @@ CREATE VIEW routines AS
CAST(null AS cardinal_number) AS maximum_cardinality,
CAST(CASE WHEN p.prokind <> 'p' THEN 0 END AS sql_identifier) AS
dtd_identifier,
- CAST(CASE WHEN l.lanname = 'sql' THEN 'SQL' ELSE 'EXTERNAL' END AS
character_data)
+ CAST(CASE WHEN l.lanname = 'pgsql' THEN 'PGSQL' ELSE 'EXTERNAL' END
AS character_data)
AS routine_body,
CAST(
CASE WHEN pg_has_role(p.proowner, 'USAGE') THEN p.prosrc ELSE
null END
diff --git a/src/backend/catalog/objectaddress.c
b/src/backend/catalog/objectaddress.c
index 84463f76fc..cf2fb78187 100644
--- a/src/backend/catalog/objectaddress.c
+++ b/src/backend/catalog/objectaddress.c
@@ -52,7 +52,7 @@
#include "catalog/pg_publication_rel.h"
#include "catalog/pg_rewrite.h"
#include "catalog/pg_statistic_ext.h"
-#include "catalog/pg_subscription.h"
+#include "catalog/pg_sub.h"
#include "catalog/pg_tablespace.h"
#include "catalog/pg_transform.h"
#include "catalog/pg_trigger.h"
@@ -506,10 +506,10 @@ static const ObjectPropertyType ObjectProperty[] =
SubscriptionObjectIndexId,
SUBSCRIPTIONOID,
SUBSCRIPTIONNAME,
- Anum_pg_subscription_oid,
- Anum_pg_subscription_subname,
+ Anum_pg_sub_oid,
+ Anum_pg_sub_subname,
InvalidAttrNumber,
- Anum_pg_subscription_subowner,
+ Anum_pg_sub_subowner,
InvalidAttrNumber,
OBJECT_SUBSCRIPTION,
true
diff --git a/src/backend/catalog/pg_shdepend.c
b/src/backend/catalog/pg_shdepend.c
index f776e821b3..a2e4b61bc0 100644
--- a/src/backend/catalog/pg_shdepend.c
+++ b/src/backend/catalog/pg_shdepend.c
@@ -40,7 +40,7 @@
#include "catalog/pg_proc.h"
#include "catalog/pg_shdepend.h"
#include "catalog/pg_statistic_ext.h"
-#include "catalog/pg_subscription.h"
+#include "catalog/pg_sub.h"
#include "catalog/pg_tablespace.h"
#include "catalog/pg_ts_config.h"
#include "catalog/pg_ts_dict.h"
diff --git a/src/backend/catalog/pg_subscription.c
b/src/backend/catalog/pg_subscription.c
index cb15731115..092e059c73 100644
--- a/src/backend/catalog/pg_subscription.c
+++ b/src/backend/catalog/pg_subscription.c
@@ -20,7 +20,7 @@
#include "access/tableam.h"
#include "access/xact.h"
#include "catalog/indexing.h"
-#include "catalog/pg_subscription.h"
+#include "catalog/pg_sub.h"
#include "catalog/pg_subscription_rel.h"
#include "catalog/pg_type.h"
#include "miscadmin.h"
@@ -64,12 +64,12 @@ GetSubscription(Oid subid, bool missing_ok)
sub->dbid = subform->subdbid;
sub->name = pstrdup(NameStr(subform->subname));
sub->owner = subform->subowner;
- sub->enabled = subform->subenabled;
+ sub->enabled = subform->subactive;
/* Get conninfo */
datum = SysCacheGetAttr(SUBSCRIPTIONOID,
tup,
-
Anum_pg_subscription_subconninfo,
+ Anum_pg_sub_subconn,
&isnull);
Assert(!isnull);
sub->conninfo = TextDatumGetCString(datum);
@@ -77,7 +77,7 @@ GetSubscription(Oid subid, bool missing_ok)
/* Get slotname */
datum = SysCacheGetAttr(SUBSCRIPTIONOID,
tup,
-
Anum_pg_subscription_subslotname,
+ Anum_pg_sub_subslotname,
&isnull);
if (!isnull)
sub->slotname = pstrdup(NameStr(*DatumGetName(datum)));
@@ -87,7 +87,7 @@ GetSubscription(Oid subid, bool missing_ok)
/* Get synccommit */
datum = SysCacheGetAttr(SUBSCRIPTIONOID,
tup,
-
Anum_pg_subscription_subsynccommit,
+
Anum_pg_sub_subsynccommit,
&isnull);
Assert(!isnull);
sub->synccommit = TextDatumGetCString(datum);
@@ -95,7 +95,7 @@ GetSubscription(Oid subid, bool missing_ok)
/* Get publications */
datum = SysCacheGetAttr(SUBSCRIPTIONOID,
tup,
-
Anum_pg_subscription_subpublications,
+
Anum_pg_sub_subpublications,
&isnull);
Assert(!isnull);
sub->publications = textarray_to_stringlist(DatumGetArrayTypeP(datum));
@@ -121,7 +121,7 @@ CountDBSubscriptions(Oid dbid)
rel = table_open(SubscriptionRelationId, RowExclusiveLock);
ScanKeyInit(&scankey,
- Anum_pg_subscription_subdbid,
+ Anum_pg_sub_subdbid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(dbid));
@@ -163,7 +163,7 @@ get_subscription_oid(const char *subname, bool missing_ok)
{
Oid oid;
- oid = GetSysCacheOid2(SUBSCRIPTIONNAME, Anum_pg_subscription_oid,
+ oid = GetSysCacheOid2(SUBSCRIPTIONNAME, Anum_pg_sub_oid,
MyDatabaseId,
CStringGetDatum(subname));
if (!OidIsValid(oid) && !missing_ok)
ereport(ERROR,
diff --git a/src/backend/catalog/system_views.sql
b/src/backend/catalog/system_views.sql
index 56420bbc9d..2c37eabff4 100644
--- a/src/backend/catalog/system_views.sql
+++ b/src/backend/catalog/system_views.sql
@@ -478,7 +478,7 @@ SELECT
l.provider, l.label
FROM
pg_shseclabel l
- JOIN pg_subscription s ON l.classoid = s.tableoid AND l.objoid = s.oid
+ JOIN pg_sub s ON l.classoid = s.tableoid AND l.objoid = s.oid
UNION ALL
SELECT
l.objoid, l.classoid, 0::int4 AS objsubid,
@@ -826,19 +826,19 @@ CREATE VIEW pg_stat_wal_receiver AS
FROM pg_stat_get_wal_receiver() s
WHERE s.pid IS NOT NULL;
-CREATE VIEW pg_stat_subscription AS
+CREATE VIEW pg_stat_sub AS
SELECT
su.oid AS subid,
su.subname,
st.pid,
st.relid,
- st.received_lsn,
+ st.received_lsn received_location,
st.last_msg_send_time,
st.last_msg_receipt_time,
- st.latest_end_lsn,
+ st.latest_end_lsn latest_end_location,
st.latest_end_time
- FROM pg_subscription su
- LEFT JOIN pg_stat_get_subscription(NULL) st
+ FROM pg_sub su
+ LEFT JOIN pg_stat_get_sub(NULL) st
ON (st.subid = su.oid);
CREATE VIEW pg_stat_ssl AS
@@ -1124,9 +1124,9 @@ CREATE VIEW pg_replication_origin_status AS
REVOKE ALL ON pg_replication_origin_status FROM public;
-- All columns of pg_subscription except subconninfo are readable.
-REVOKE ALL ON pg_subscription FROM public;
-GRANT SELECT (subdbid, subname, subowner, subenabled, subslotname,
subpublications)
- ON pg_subscription TO public;
+REVOKE ALL ON pg_sub FROM public;
+GRANT SELECT (subdbid, subname, subowner, subactive, subslotname,
subpublications)
+ ON pg_sub TO public;
--
@@ -1176,7 +1176,7 @@ FROM pg_catalog.ts_parse(
) AS tt
WHERE tt.tokid = parse.tokid
$$
-LANGUAGE SQL STRICT STABLE PARALLEL SAFE;
+LANGUAGE PGSQL STRICT STABLE PARALLEL SAFE;
COMMENT ON FUNCTION ts_debug(regconfig,text) IS
'debug function for text search configuration';
@@ -1192,7 +1192,7 @@ RETURNS SETOF record AS
$$
SELECT * FROM pg_catalog.ts_debug( pg_catalog.get_current_ts_config(), $1);
$$
-LANGUAGE SQL STRICT STABLE PARALLEL SAFE;
+LANGUAGE PGSQL STRICT STABLE PARALLEL SAFE;
COMMENT ON FUNCTION ts_debug(text) IS
'debug function for current text search configuration';
diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c
index b11ebf0f61..27d4f6dfcc 100644
--- a/src/backend/commands/alter.c
+++ b/src/backend/commands/alter.c
@@ -35,7 +35,7 @@
#include "catalog/pg_opfamily.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_statistic_ext.h"
-#include "catalog/pg_subscription.h"
+#include "catalog/pg_sub.h"
#include "catalog/pg_ts_config.h"
#include "catalog/pg_ts_dict.h"
#include "catalog/pg_ts_parser.h"
diff --git a/src/backend/commands/dbcommands.c
b/src/backend/commands/dbcommands.c
index f27c3fe8c1..b87df4d80d 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -38,7 +38,7 @@
#include "catalog/pg_authid.h"
#include "catalog/pg_database.h"
#include "catalog/pg_db_role_setting.h"
-#include "catalog/pg_subscription.h"
+#include "catalog/pg_sub.h"
#include "catalog/pg_tablespace.h"
#include "commands/comment.h"
#include "commands/dbcommands.h"
diff --git a/src/backend/commands/subscriptioncmds.c
b/src/backend/commands/subscriptioncmds.c
index 9ebb026187..088c1f357e 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -23,7 +23,7 @@
#include "catalog/namespace.h"
#include "catalog/objectaccess.h"
#include "catalog/objectaddress.h"
-#include "catalog/pg_subscription.h"
+#include "catalog/pg_sub.h"
#include "catalog/pg_subscription_rel.h"
#include "catalog/pg_type.h"
#include "commands/defrem.h"
@@ -310,8 +310,8 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool
isTopLevel)
Relation rel;
ObjectAddress myself;
Oid subid;
- bool nulls[Natts_pg_subscription];
- Datum values[Natts_pg_subscription];
+ bool nulls[Natts_pg_sub];
+ Datum values[Natts_pg_sub];
Oid owner = GetUserId();
HeapTuple tup;
bool connect;
@@ -362,7 +362,7 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool
isTopLevel)
rel = table_open(SubscriptionRelationId, RowExclusiveLock);
/* Check if name is used */
- subid = GetSysCacheOid2(SUBSCRIPTIONNAME, Anum_pg_subscription_oid,
+ subid = GetSysCacheOid2(SUBSCRIPTIONNAME, Anum_pg_sub_oid,
MyDatabaseId,
CStringGetDatum(stmt->subname));
if (OidIsValid(subid))
{
@@ -393,23 +393,23 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool
isTopLevel)
memset(nulls, false, sizeof(nulls));
subid = GetNewOidWithIndex(rel, SubscriptionObjectIndexId,
-
Anum_pg_subscription_oid);
- values[Anum_pg_subscription_oid - 1] = ObjectIdGetDatum(subid);
- values[Anum_pg_subscription_subdbid - 1] =
ObjectIdGetDatum(MyDatabaseId);
- values[Anum_pg_subscription_subname - 1] =
+ Anum_pg_sub_oid);
+ values[Anum_pg_sub_oid - 1] = ObjectIdGetDatum(subid);
+ values[Anum_pg_sub_subdbid - 1] = ObjectIdGetDatum(MyDatabaseId);
+ values[Anum_pg_sub_subname - 1] =
DirectFunctionCall1(namein, CStringGetDatum(stmt->subname));
- values[Anum_pg_subscription_subowner - 1] = ObjectIdGetDatum(owner);
- values[Anum_pg_subscription_subenabled - 1] = BoolGetDatum(enabled);
- values[Anum_pg_subscription_subconninfo - 1] =
+ values[Anum_pg_sub_subowner - 1] = ObjectIdGetDatum(owner);
+ values[Anum_pg_sub_subactive - 1] = BoolGetDatum(enabled);
+ values[Anum_pg_sub_subconn - 1] =
CStringGetTextDatum(conninfo);
if (slotname)
- values[Anum_pg_subscription_subslotname - 1] =
+ values[Anum_pg_sub_subslotname - 1] =
DirectFunctionCall1(namein, CStringGetDatum(slotname));
else
- nulls[Anum_pg_subscription_subslotname - 1] = true;
- values[Anum_pg_subscription_subsynccommit - 1] =
+ nulls[Anum_pg_sub_subslotname - 1] = true;
+ values[Anum_pg_sub_subsynccommit - 1] =
CStringGetTextDatum(synchronous_commit);
- values[Anum_pg_subscription_subpublications - 1] =
+ values[Anum_pg_sub_subpublications - 1] =
publicationListToArray(publications);
tup = heap_form_tuple(RelationGetDescr(rel), values, nulls);
@@ -623,9 +623,9 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
{
Relation rel;
ObjectAddress myself;
- bool nulls[Natts_pg_subscription];
- bool replaces[Natts_pg_subscription];
- Datum values[Natts_pg_subscription];
+ bool nulls[Natts_pg_sub];
+ bool replaces[Natts_pg_sub];
+ Datum values[Natts_pg_sub];
HeapTuple tup;
Oid subid;
bool update_tuple = false;
@@ -683,18 +683,18 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
"slot_name = NONE")));
if (slotname)
-
values[Anum_pg_subscription_subslotname - 1] =
+ values[Anum_pg_sub_subslotname
- 1] =
DirectFunctionCall1(namein, CStringGetDatum(slotname));
else
-
nulls[Anum_pg_subscription_subslotname - 1] = true;
-
replaces[Anum_pg_subscription_subslotname - 1] = true;
+ nulls[Anum_pg_sub_subslotname -
1] = true;
+ replaces[Anum_pg_sub_subslotname - 1] =
true;
}
if (synchronous_commit)
{
-
values[Anum_pg_subscription_subsynccommit - 1] =
+ values[Anum_pg_sub_subsynccommit - 1] =
CStringGetTextDatum(synchronous_commit);
-
replaces[Anum_pg_subscription_subsynccommit - 1] = true;
+ replaces[Anum_pg_sub_subsynccommit - 1]
= true;
}
update_tuple = true;
@@ -716,9 +716,9 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot enable
subscription that does not have a slot name")));
- values[Anum_pg_subscription_subenabled - 1] =
+ values[Anum_pg_sub_subactive - 1] =
BoolGetDatum(enabled);
- replaces[Anum_pg_subscription_subenabled - 1] =
true;
+ replaces[Anum_pg_sub_subactive - 1] = true;
if (enabled)
ApplyLauncherWakeupAtCommit();
@@ -733,9 +733,9 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
/* Check the connection info string. */
walrcv_check_conninfo(stmt->conninfo);
- values[Anum_pg_subscription_subconninfo - 1] =
+ values[Anum_pg_sub_subconn - 1] =
CStringGetTextDatum(stmt->conninfo);
- replaces[Anum_pg_subscription_subconninfo - 1] = true;
+ replaces[Anum_pg_sub_subconn - 1] = true;
update_tuple = true;
break;
@@ -748,9 +748,9 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
NULL, NULL, NULL, ©_data,
NULL, &refresh);
- values[Anum_pg_subscription_subpublications -
1] =
+ values[Anum_pg_sub_subpublications - 1] =
publicationListToArray(stmt->publication);
- replaces[Anum_pg_subscription_subpublications -
1] = true;
+ replaces[Anum_pg_sub_subpublications - 1] =
true;
update_tuple = true;
@@ -884,19 +884,19 @@ DropSubscription(DropSubscriptionStmt *stmt, bool
isTopLevel)
/* Get subname */
datum = SysCacheGetAttr(SUBSCRIPTIONOID, tup,
-
Anum_pg_subscription_subname, &isnull);
+ Anum_pg_sub_subname,
&isnull);
Assert(!isnull);
subname = pstrdup(NameStr(*DatumGetName(datum)));
/* Get conninfo */
datum = SysCacheGetAttr(SUBSCRIPTIONOID, tup,
-
Anum_pg_subscription_subconninfo, &isnull);
+ Anum_pg_sub_subconn,
&isnull);
Assert(!isnull);
conninfo = TextDatumGetCString(datum);
/* Get slotname */
datum = SysCacheGetAttr(SUBSCRIPTIONOID, tup,
-
Anum_pg_subscription_subslotname, &isnull);
+
Anum_pg_sub_subslotname, &isnull);
if (!isnull)
slotname = pstrdup(NameStr(*DatumGetName(datum)));
else
diff --git a/src/backend/replication/logical/launcher.c
b/src/backend/replication/logical/launcher.c
index aec885e987..375f7a598d 100644
--- a/src/backend/replication/logical/launcher.c
+++ b/src/backend/replication/logical/launcher.c
@@ -22,7 +22,7 @@
#include "access/htup_details.h"
#include "access/tableam.h"
#include "access/xact.h"
-#include "catalog/pg_subscription.h"
+#include "catalog/pg_sub.h"
#include "catalog/pg_subscription_rel.h"
#include "funcapi.h"
#include "libpq/pqsignal.h"
@@ -95,7 +95,7 @@ static void logicalrep_worker_cleanup(LogicalRepWorker
*worker);
static bool on_commit_launcher_wakeup = false;
-Datum pg_stat_get_subscription(PG_FUNCTION_ARGS);
+Datum pg_stat_get_sub(PG_FUNCTION_ARGS);
/*
@@ -147,7 +147,7 @@ get_subscription_list(void)
sub->oid = subform->oid;
sub->dbid = subform->subdbid;
sub->owner = subform->subowner;
- sub->enabled = subform->subenabled;
+ sub->enabled = subform->subactive;
sub->name = pstrdup(NameStr(subform->subname));
/* We don't fill fields we are not interested in. */
@@ -1068,7 +1068,7 @@ IsLogicalLauncher(void)
* Returns state of the subscriptions.
*/
Datum
-pg_stat_get_subscription(PG_FUNCTION_ARGS)
+pg_stat_get_sub(PG_FUNCTION_ARGS)
{
#define PG_STAT_GET_SUBSCRIPTION_COLS 8
Oid subid = PG_ARGISNULL(0) ? InvalidOid :
PG_GETARG_OID(0);
diff --git a/src/backend/replication/logical/worker.c
b/src/backend/replication/logical/worker.c
index a752a1224d..4e35ad2aec 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -31,7 +31,7 @@
#include "catalog/namespace.h"
#include "catalog/partition.h"
#include "catalog/pg_inherits.h"
-#include "catalog/pg_subscription.h"
+#include "catalog/pg_sub.h"
#include "catalog/pg_subscription_rel.h"
#include "commands/tablecmds.h"
#include "commands/trigger.h"
diff --git a/src/backend/utils/cache/relcache.c
b/src/backend/utils/cache/relcache.c
index 0b9eb00d2d..f54ac3eeab 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -59,7 +59,7 @@
#include "catalog/pg_rewrite.h"
#include "catalog/pg_shseclabel.h"
#include "catalog/pg_statistic_ext.h"
-#include "catalog/pg_subscription.h"
+#include "catalog/pg_sub.h"
#include "catalog/pg_tablespace.h"
#include "catalog/pg_trigger.h"
#include "catalog/pg_type.h"
@@ -114,7 +114,7 @@ static const FormData_pg_attribute
Desc_pg_authid[Natts_pg_authid] = {Schema_pg_
static const FormData_pg_attribute Desc_pg_auth_members[Natts_pg_auth_members]
= {Schema_pg_auth_members};
static const FormData_pg_attribute Desc_pg_index[Natts_pg_index] =
{Schema_pg_index};
static const FormData_pg_attribute Desc_pg_shseclabel[Natts_pg_shseclabel] =
{Schema_pg_shseclabel};
-static const FormData_pg_attribute Desc_pg_subscription[Natts_pg_subscription]
= {Schema_pg_subscription};
+static const FormData_pg_attribute Desc_pg_subscription[Natts_pg_sub] =
{Schema_pg_sub};
/*
* Hash tables that index the relation cache
@@ -3825,8 +3825,8 @@ RelationCacheInitializePhase2(void)
Natts_pg_auth_members, Desc_pg_auth_members);
formrdesc("pg_shseclabel", SharedSecLabelRelation_Rowtype_Id,
true,
Natts_pg_shseclabel, Desc_pg_shseclabel);
- formrdesc("pg_subscription", SubscriptionRelation_Rowtype_Id,
true,
- Natts_pg_subscription, Desc_pg_subscription);
+ formrdesc("pg_sub", SubscriptionRelation_Rowtype_Id, true,
+ Natts_pg_sub, Desc_pg_subscription);
#define NUM_CRITICAL_SHARED_RELS 5 /* fix if you change list above
*/
}
diff --git a/src/backend/utils/cache/syscache.c
b/src/backend/utils/cache/syscache.c
index 53d9ddf159..7d617c0cab 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -63,7 +63,7 @@
#include "catalog/pg_statistic.h"
#include "catalog/pg_statistic_ext.h"
#include "catalog/pg_statistic_ext_data.h"
-#include "catalog/pg_subscription.h"
+#include "catalog/pg_sub.h"
#include "catalog/pg_subscription_rel.h"
#include "catalog/pg_tablespace.h"
#include "catalog/pg_transform.h"
@@ -776,8 +776,8 @@ static const struct cachedesc cacheinfo[] = {
SubscriptionNameIndexId,
2,
{
- Anum_pg_subscription_subdbid,
- Anum_pg_subscription_subname,
+ Anum_pg_sub_subdbid,
+ Anum_pg_sub_subname,
0,
0
},
@@ -787,7 +787,7 @@ static const struct cachedesc cacheinfo[] = {
SubscriptionObjectIndexId,
1,
{
- Anum_pg_subscription_oid,
+ Anum_pg_sub_oid,
0,
0,
0
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index dfe43968b8..cd53d73cee 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -4216,7 +4216,7 @@ getSubscriptions(Archive *fout)
int n;
res = ExecuteSqlQuery(fout,
- "SELECT count(*) FROM
pg_subscription "
+ "SELECT count(*) FROM
pg_sub "
"WHERE subdbid =
(SELECT oid FROM pg_database"
"
WHERE datname = current_database())",
PGRES_TUPLES_OK);
@@ -4235,9 +4235,9 @@ getSubscriptions(Archive *fout)
appendPQExpBuffer(query,
"SELECT s.tableoid, s.oid, s.subname,"
"(%s s.subowner) AS rolname, "
- " s.subconninfo, s.subslotname,
s.subsynccommit, "
+ " s.subconn, s.subslotname,
s.subsynccommit, "
" s.subpublications "
- "FROM pg_subscription s "
+ "FROM pg_sub s "
"WHERE s.subdbid = (SELECT oid FROM
pg_database"
" WHERE datname =
current_database())",
username_subquery);
@@ -4249,7 +4249,7 @@ getSubscriptions(Archive *fout)
i_oid = PQfnumber(res, "oid");
i_subname = PQfnumber(res, "subname");
i_rolname = PQfnumber(res, "rolname");
- i_subconninfo = PQfnumber(res, "subconninfo");
+ i_subconninfo = PQfnumber(res, "subconn");
i_subslotname = PQfnumber(res, "subslotname");
i_subsynccommit = PQfnumber(res, "subsynccommit");
i_subpublications = PQfnumber(res, "subpublications");
diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h
index 8be303870f..66b2894978 100644
--- a/src/include/catalog/indexing.h
+++ b/src/include/catalog/indexing.h
@@ -354,10 +354,10 @@ DECLARE_UNIQUE_INDEX(pg_publication_rel_oid_index, 6112,
on pg_publication_rel u
DECLARE_UNIQUE_INDEX(pg_publication_rel_prrelid_prpubid_index, 6113, on
pg_publication_rel using btree(prrelid oid_ops, prpubid oid_ops));
#define PublicationRelPrrelidPrpubidIndexId 6113
-DECLARE_UNIQUE_INDEX(pg_subscription_oid_index, 6114, on pg_subscription using
btree(oid oid_ops));
+DECLARE_UNIQUE_INDEX(pg_subscription_oid_index, 6114, on pg_sub using
btree(oid oid_ops));
#define SubscriptionObjectIndexId 6114
-DECLARE_UNIQUE_INDEX(pg_subscription_subname_index, 6115, on pg_subscription
using btree(subdbid oid_ops, subname name_ops));
+DECLARE_UNIQUE_INDEX(pg_subscription_subname_index, 6115, on pg_sub using
btree(subdbid oid_ops, subname name_ops));
#define SubscriptionNameIndexId 6115
DECLARE_UNIQUE_INDEX(pg_subscription_rel_srrelid_srsubid_index, 6117, on
pg_subscription_rel using btree(srrelid oid_ops, srsubid oid_ops));
diff --git a/src/include/catalog/pg_language.dat
b/src/include/catalog/pg_language.dat
index 2e44a2730d..be6d96fd63 100644
--- a/src/include/catalog/pg_language.dat
+++ b/src/include/catalog/pg_language.dat
@@ -20,6 +20,6 @@
lanname => 'c', lanvalidator => 'fmgr_c_validator' },
{ oid => '14', oid_symbol => 'SQLlanguageId',
descr => 'SQL-language functions',
- lanname => 'sql', lanpltrusted => 't', lanvalidator => 'fmgr_sql_validator'
},
+ lanname => 'pgsql', lanpltrusted => 't', lanvalidator =>
'fmgr_sql_validator' },
]
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index 61f2c2f5b4..b7a7ae8815 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -2334,7 +2334,7 @@
proname => 'justify_days', prorettype => 'interval',
proargtypes => 'interval', prosrc => 'interval_justify_days' },
{ oid => '1176', descr => 'convert date and time to timestamp with time zone',
- proname => 'timestamptz', prolang => 'sql', provolatile => 's',
+ proname => 'timestamptz', prolang => 'pgsql', provolatile => 's',
prorettype => 'timestamptz', proargtypes => 'date time',
prosrc => 'select cast(($1 + $2) as timestamp with time zone)' },
{ oid => '1178', descr => 'convert timestamp with time zone to date',
@@ -2387,16 +2387,16 @@
prosrc => 'interval_scale' },
{ oid => '1215', descr => 'get description for object id and catalog name',
- proname => 'obj_description', prolang => 'sql', procost => '100',
+ proname => 'obj_description', prolang => 'pgsql', procost => '100',
provolatile => 's', prorettype => 'text', proargtypes => 'oid name',
prosrc => 'select description from pg_catalog.pg_description where objoid =
$1 and classoid = (select oid from pg_catalog.pg_class where relname = $2 and
relnamespace = PGNSP) and objsubid = 0' },
{ oid => '1216', descr => 'get description for table column',
- proname => 'col_description', prolang => 'sql', procost => '100',
+ proname => 'col_description', prolang => 'pgsql', procost => '100',
provolatile => 's', prorettype => 'text', proargtypes => 'oid int4',
prosrc => 'select description from pg_catalog.pg_description where objoid =
$1 and classoid = \'pg_catalog.pg_class\'::pg_catalog.regclass and objsubid =
$2' },
{ oid => '1993',
descr => 'get description for object id and shared catalog name',
- proname => 'shobj_description', prolang => 'sql', procost => '100',
+ proname => 'shobj_description', prolang => 'pgsql', procost => '100',
provolatile => 's', prorettype => 'text', proargtypes => 'oid name',
prosrc => 'select description from pg_catalog.pg_shdescription where objoid
= $1 and classoid = (select oid from pg_catalog.pg_class where relname = $2 and
relnamespace = PGNSP)' },
@@ -2572,13 +2572,13 @@
prosrc => 'hashtidextended' },
{ oid => '1296',
- proname => 'timedate_pl', prolang => 'sql', prorettype => 'timestamp',
+ proname => 'timedate_pl', prolang => 'pgsql', prorettype => 'timestamp',
proargtypes => 'time date', prosrc => 'select ($2 + $1)' },
{ oid => '1297',
proname => 'datetimetz_pl', prorettype => 'timestamptz',
proargtypes => 'date timetz', prosrc => 'datetimetz_timestamptz' },
{ oid => '1298',
- proname => 'timetzdate_pl', prolang => 'sql', prorettype => 'timestamptz',
+ proname => 'timetzdate_pl', prolang => 'pgsql', prorettype => 'timestamptz',
proargtypes => 'timetz date', prosrc => 'select ($2 + $1)' },
{ oid => '1299', descr => 'current transaction time',
proname => 'now', provolatile => 's', prorettype => 'timestamptz',
@@ -2620,17 +2620,17 @@
proargtypes => 'timestamptz timestamptz timestamptz timestamptz',
prosrc => 'overlaps_timestamp' },
{ oid => '1305', descr => 'intervals overlap?',
- proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
+ proname => 'overlaps', prolang => 'pgsql', proisstrict => 'f',
provolatile => 's', prorettype => 'bool',
proargtypes => 'timestamptz interval timestamptz interval',
prosrc => 'select ($1, ($1 + $2)) overlaps ($3, ($3 + $4))' },
{ oid => '1306', descr => 'intervals overlap?',
- proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
+ proname => 'overlaps', prolang => 'pgsql', proisstrict => 'f',
provolatile => 's', prorettype => 'bool',
proargtypes => 'timestamptz timestamptz timestamptz interval',
prosrc => 'select ($1, $2) overlaps ($3, ($3 + $4))' },
{ oid => '1307', descr => 'intervals overlap?',
- proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
+ proname => 'overlaps', prolang => 'pgsql', proisstrict => 'f',
provolatile => 's', prorettype => 'bool',
proargtypes => 'timestamptz interval timestamptz timestamptz',
prosrc => 'select ($1, ($1 + $2)) overlaps ($3, $4)' },
@@ -2639,15 +2639,15 @@
proname => 'overlaps', proisstrict => 'f', prorettype => 'bool',
proargtypes => 'time time time time', prosrc => 'overlaps_time' },
{ oid => '1309', descr => 'intervals overlap?',
- proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
+ proname => 'overlaps', prolang => 'pgsql', proisstrict => 'f',
prorettype => 'bool', proargtypes => 'time interval time interval',
prosrc => 'select ($1, ($1 + $2)) overlaps ($3, ($3 + $4))' },
{ oid => '1310', descr => 'intervals overlap?',
- proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
+ proname => 'overlaps', prolang => 'pgsql', proisstrict => 'f',
prorettype => 'bool', proargtypes => 'time time time interval',
prosrc => 'select ($1, $2) overlaps ($3, ($3 + $4))' },
{ oid => '1311', descr => 'intervals overlap?',
- proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
+ proname => 'overlaps', prolang => 'pgsql', proisstrict => 'f',
prorettype => 'bool', proargtypes => 'time interval time time',
prosrc => 'select ($1, ($1 + $2)) overlaps ($3, $4)' },
@@ -2728,7 +2728,7 @@
# This form of obj_description is now deprecated, since it will fail if
# OIDs are not unique across system catalogs. Use the other form instead.
{ oid => '1348', descr => 'deprecated, use two-argument form instead',
- proname => 'obj_description', prolang => 'sql', procost => '100',
+ proname => 'obj_description', prolang => 'pgsql', procost => '100',
provolatile => 's', prorettype => 'text', proargtypes => 'oid',
prosrc => 'select description from pg_catalog.pg_description where objoid =
$1 and objsubid = 0' },
@@ -2812,7 +2812,7 @@
prosrc => 'textlen' },
{ oid => '1384', descr => 'extract field from date',
- proname => 'date_part', prolang => 'sql', prorettype => 'float8',
+ proname => 'date_part', prolang => 'pgsql', prorettype => 'float8',
proargtypes => 'text date',
prosrc => 'select pg_catalog.date_part($1, cast($2 as timestamp without time
zone))' },
{ oid => '1385', descr => 'extract field from time',
@@ -2820,7 +2820,7 @@
prosrc => 'time_part' },
{ oid => '1386',
descr => 'date difference from today preserving months and years',
- proname => 'age', prolang => 'sql', provolatile => 's',
+ proname => 'age', prolang => 'pgsql', provolatile => 's',
prorettype => 'interval', proargtypes => 'timestamptz',
prosrc => 'select pg_catalog.age(cast(current_date as timestamp with time
zone), $1)' },
@@ -2935,7 +2935,7 @@
proname => 'box_div', prorettype => 'box', proargtypes => 'box point',
prosrc => 'box_div' },
{ oid => '1426',
- proname => 'path_contain_pt', prolang => 'sql', prorettype => 'bool',
+ proname => 'path_contain_pt', prolang => 'pgsql', prorettype => 'bool',
proargtypes => 'path point', prosrc => 'select pg_catalog.on_ppath($2, $1)'
},
{ oid => '1428',
proname => 'poly_contain_pt', prorettype => 'bool',
@@ -3195,7 +3195,7 @@
proname => 'center', prorettype => 'point', proargtypes => 'circle',
prosrc => 'circle_center' },
{ oid => '1544', descr => 'convert circle to 12-vertex polygon',
- proname => 'polygon', prolang => 'sql', prorettype => 'polygon',
+ proname => 'polygon', prolang => 'pgsql', prorettype => 'polygon',
proargtypes => 'circle', prosrc => 'select pg_catalog.polygon(12, $1)' },
{ oid => '1545', descr => 'number of points',
proname => 'npoints', prorettype => 'int4', proargtypes => 'path',
@@ -3491,11 +3491,11 @@
proname => 'translate', prorettype => 'text', proargtypes => 'text text
text',
prosrc => 'translate' },
{ oid => '879', descr => 'left-pad string to length',
- proname => 'lpad', prolang => 'sql', prorettype => 'text',
+ proname => 'lpad', prolang => 'pgsql', prorettype => 'text',
proargtypes => 'text int4',
prosrc => 'select pg_catalog.lpad($1, $2, \' \')' },
{ oid => '880', descr => 'right-pad string to length',
- proname => 'rpad', prolang => 'sql', prorettype => 'text',
+ proname => 'rpad', prolang => 'pgsql', prorettype => 'text',
proargtypes => 'text int4',
prosrc => 'select pg_catalog.rpad($1, $2, \' \')' },
{ oid => '881', descr => 'trim spaces from left end of string',
@@ -4086,7 +4086,7 @@
proname => 'inetpl', prorettype => 'inet', proargtypes => 'inet int8',
prosrc => 'inetpl' },
{ oid => '2631',
- proname => 'int8pl_inet', prolang => 'sql', prorettype => 'inet',
+ proname => 'int8pl_inet', prolang => 'pgsql', prorettype => 'inet',
proargtypes => 'int8 inet', prosrc => 'select $2 + $1' },
{ oid => '2632',
proname => 'inetmi_int8', prorettype => 'inet', proargtypes => 'inet int8',
@@ -4218,13 +4218,13 @@
proname => 'round', prorettype => 'numeric', proargtypes => 'numeric int4',
prosrc => 'numeric_round' },
{ oid => '1708', descr => 'value rounded to \'scale\' of zero',
- proname => 'round', prolang => 'sql', prorettype => 'numeric',
+ proname => 'round', prolang => 'pgsql', prorettype => 'numeric',
proargtypes => 'numeric', prosrc => 'select pg_catalog.round($1,0)' },
{ oid => '1709', descr => 'value truncated to \'scale\'',
proname => 'trunc', prorettype => 'numeric', proargtypes => 'numeric int4',
prosrc => 'numeric_trunc' },
{ oid => '1710', descr => 'value truncated to \'scale\' of zero',
- proname => 'trunc', prolang => 'sql', prorettype => 'numeric',
+ proname => 'trunc', prolang => 'pgsql', prorettype => 'numeric',
proargtypes => 'numeric', prosrc => 'select pg_catalog.trunc($1,0)' },
{ oid => '1711', descr => 'nearest integer >= value',
proname => 'ceil', prorettype => 'numeric', proargtypes => 'numeric',
@@ -4324,10 +4324,10 @@
proname => 'numeric', prorettype => 'numeric', proargtypes => 'int4',
prosrc => 'int4_numeric' },
{ oid => '1741', descr => 'base 10 logarithm',
- proname => 'log', prolang => 'sql', prorettype => 'numeric',
+ proname => 'log', prolang => 'pgsql', prorettype => 'numeric',
proargtypes => 'numeric', prosrc => 'select pg_catalog.log(10, $1)' },
{ oid => '1481', descr => 'base 10 logarithm',
- proname => 'log10', prolang => 'sql', prorettype => 'numeric',
+ proname => 'log10', prolang => 'pgsql', prorettype => 'numeric',
proargtypes => 'numeric', prosrc => 'select pg_catalog.log(10, $1)' },
{ oid => '1742', descr => 'convert float4 to numeric',
proname => 'numeric', prorettype => 'numeric', proargtypes => 'float4',
@@ -4460,7 +4460,7 @@
proname => 'quote_literal', prorettype => 'text', proargtypes => 'text',
prosrc => 'quote_literal' },
{ oid => '1285', descr => 'quote a data value for usage in a querystring',
- proname => 'quote_literal', prolang => 'sql', provolatile => 's',
+ proname => 'quote_literal', prolang => 'pgsql', provolatile => 's',
prorettype => 'text', proargtypes => 'anyelement',
prosrc => 'select pg_catalog.quote_literal($1::pg_catalog.text)' },
{ oid => '1289',
@@ -4469,7 +4469,7 @@
proargtypes => 'text', prosrc => 'quote_nullable' },
{ oid => '1290',
descr => 'quote a possibly-null data value for usage in a querystring',
- proname => 'quote_nullable', prolang => 'sql', proisstrict => 'f',
+ proname => 'quote_nullable', prolang => 'pgsql', proisstrict => 'f',
provolatile => 's', prorettype => 'text', proargtypes => 'anyelement',
prosrc => 'select pg_catalog.quote_nullable($1::pg_catalog.text)' },
@@ -4508,13 +4508,13 @@
prorettype => 'text', proargtypes => 'text', prosrc => 'text_format_nv' },
{ oid => '1810', descr => 'length in bits',
- proname => 'bit_length', prolang => 'sql', prorettype => 'int4',
+ proname => 'bit_length', prolang => 'pgsql', prorettype => 'int4',
proargtypes => 'bytea', prosrc => 'select pg_catalog.octet_length($1) * 8' },
{ oid => '1811', descr => 'length in bits',
- proname => 'bit_length', prolang => 'sql', prorettype => 'int4',
+ proname => 'bit_length', prolang => 'pgsql', prorettype => 'int4',
proargtypes => 'text', prosrc => 'select pg_catalog.octet_length($1) * 8' },
{ oid => '1812', descr => 'length in bits',
- proname => 'bit_length', prolang => 'sql', prorettype => 'int4',
+ proname => 'bit_length', prolang => 'pgsql', prorettype => 'int4',
proargtypes => 'bit', prosrc => 'select pg_catalog.length($1)' },
# Selectivity estimators for LIKE and related operators
@@ -4833,7 +4833,7 @@
prosrc => 'to_ascii_encname' },
{ oid => '1848',
- proname => 'interval_pl_time', prolang => 'sql', prorettype => 'time',
+ proname => 'interval_pl_time', prolang => 'pgsql', prorettype => 'time',
proargtypes => 'interval time', prosrc => 'select $2 + $1' },
{ oid => '1850',
@@ -5249,12 +5249,12 @@
proargnames =>
'{pid,status,receive_start_lsn,receive_start_tli,written_lsn,flushed_lsn,received_tli,last_msg_send_time,last_msg_receipt_time,latest_end_lsn,latest_end_time,slot_name,sender_host,sender_port,conninfo}',
prosrc => 'pg_stat_get_wal_receiver' },
{ oid => '6118', descr => 'statistics: information about subscription',
- proname => 'pg_stat_get_subscription', proisstrict => 'f', provolatile =>
's',
+ proname => 'pg_stat_get_sub', proisstrict => 'f', provolatile => 's',
proparallel => 'r', prorettype => 'record', proargtypes => 'oid',
proallargtypes =>
'{oid,oid,oid,int4,pg_lsn,timestamptz,timestamptz,pg_lsn,timestamptz}',
proargmodes => '{i,o,o,o,o,o,o,o,o}',
proargnames =>
'{subid,subid,relid,pid,received_lsn,last_msg_send_time,last_msg_receipt_time,latest_end_lsn,latest_end_time}',
- prosrc => 'pg_stat_get_subscription' },
+ prosrc => 'pg_stat_get_sub' },
{ oid => '2026', descr => 'statistics: current backend PID',
proname => 'pg_backend_pid', provolatile => 's', proparallel => 'r',
prorettype => 'int4', proargtypes => '', prosrc => 'pg_backend_pid' },
@@ -5663,11 +5663,11 @@
proargtypes => 'timetz int4', prosrc => 'timetz_scale' },
{ oid => '2003',
- proname => 'textanycat', prolang => 'sql', provolatile => 's',
+ proname => 'textanycat', prolang => 'pgsql', provolatile => 's',
prorettype => 'text', proargtypes => 'text anynonarray',
prosrc => 'select $1 || $2::pg_catalog.text' },
{ oid => '2004',
- proname => 'anytextcat', prolang => 'sql', provolatile => 's',
+ proname => 'anytextcat', prolang => 'pgsql', provolatile => 's',
prorettype => 'text', proargtypes => 'anynonarray text',
prosrc => 'select $1::pg_catalog.text || $2' },
@@ -5767,15 +5767,15 @@
proargtypes => 'timestamp timestamp timestamp timestamp',
prosrc => 'overlaps_timestamp' },
{ oid => '2042', descr => 'intervals overlap?',
- proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
+ proname => 'overlaps', prolang => 'pgsql', proisstrict => 'f',
prorettype => 'bool', proargtypes => 'timestamp interval timestamp interval',
prosrc => 'select ($1, ($1 + $2)) overlaps ($3, ($3 + $4))' },
{ oid => '2043', descr => 'intervals overlap?',
- proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
+ proname => 'overlaps', prolang => 'pgsql', proisstrict => 'f',
prorettype => 'bool', proargtypes => 'timestamp timestamp timestamp
interval',
prosrc => 'select ($1, $2) overlaps ($3, ($3 + $4))' },
{ oid => '2044', descr => 'intervals overlap?',
- proname => 'overlaps', prolang => 'sql', proisstrict => 'f',
+ proname => 'overlaps', prolang => 'pgsql', proisstrict => 'f',
prorettype => 'bool', proargtypes => 'timestamp interval timestamp
timestamp',
prosrc => 'select ($1, ($1 + $2)) overlaps ($3, $4)' },
{ oid => '2045', descr => 'less-equal-greater',
@@ -5841,7 +5841,7 @@
proargtypes => 'timestamp timestamp', prosrc => 'timestamp_age' },
{ oid => '2059',
descr => 'date difference from today preserving months and years',
- proname => 'age', prolang => 'sql', provolatile => 's',
+ proname => 'age', prolang => 'pgsql', provolatile => 's',
prorettype => 'interval', proargtypes => 'timestamp',
prosrc => 'select pg_catalog.age(cast(current_date as timestamp without time
zone), $1)' },
@@ -5862,7 +5862,7 @@
proname => 'substring', prorettype => 'text', proargtypes => 'text text',
prosrc => 'textregexsubstr' },
{ oid => '2074', descr => 'extract text matching SQL regular expression',
- proname => 'substring', prolang => 'sql', prorettype => 'text',
+ proname => 'substring', prolang => 'pgsql', prorettype => 'text',
proargtypes => 'text text text',
prosrc => 'select pg_catalog.substring($1, pg_catalog.similar_to_escape($2,
$3))' },
@@ -6201,11 +6201,11 @@
proname => 'pg_sleep', provolatile => 'v', prorettype => 'void',
proargtypes => 'float8', prosrc => 'pg_sleep' },
{ oid => '3935', descr => 'sleep for the specified interval',
- proname => 'pg_sleep_for', prolang => 'sql', provolatile => 'v',
+ proname => 'pg_sleep_for', prolang => 'pgsql', provolatile => 'v',
prorettype => 'void', proargtypes => 'interval',
prosrc => 'select pg_catalog.pg_sleep(extract(epoch from
pg_catalog.clock_timestamp() operator(pg_catalog.+) $1) operator(pg_catalog.-)
extract(epoch from pg_catalog.clock_timestamp()))' },
{ oid => '3936', descr => 'sleep until the specified time',
- proname => 'pg_sleep_until', prolang => 'sql', provolatile => 'v',
+ proname => 'pg_sleep_until', prolang => 'pgsql', provolatile => 'v',
prorettype => 'void', proargtypes => 'timestamptz',
prosrc => 'select pg_catalog.pg_sleep(extract(epoch from $1)
operator(pg_catalog.-) extract(epoch from pg_catalog.clock_timestamp()))' },
{ oid => '315', descr => 'Is JIT compilation available in this session?',
@@ -7016,7 +7016,7 @@
proargtypes => 'name', prosrc => 'pg_database_size_name' },
{ oid => '2325',
descr => 'disk space usage for the main fork of the specified table or
index',
- proname => 'pg_relation_size', prolang => 'sql', provolatile => 'v',
+ proname => 'pg_relation_size', prolang => 'pgsql', provolatile => 'v',
prorettype => 'int8', proargtypes => 'regclass',
prosrc => 'select pg_catalog.pg_relation_size($1, \'main\')' },
{ oid => '2332',
@@ -7898,21 +7898,21 @@
# formerly-missing interval + datetime operators
{ oid => '2546',
- proname => 'interval_pl_date', prolang => 'sql', prorettype => 'timestamp',
+ proname => 'interval_pl_date', prolang => 'pgsql', prorettype => 'timestamp',
proargtypes => 'interval date', prosrc => 'select $2 + $1' },
{ oid => '2547',
- proname => 'interval_pl_timetz', prolang => 'sql', prorettype => 'timetz',
+ proname => 'interval_pl_timetz', prolang => 'pgsql', prorettype => 'timetz',
proargtypes => 'interval timetz', prosrc => 'select $2 + $1' },
{ oid => '2548',
- proname => 'interval_pl_timestamp', prolang => 'sql',
+ proname => 'interval_pl_timestamp', prolang => 'pgsql',
prorettype => 'timestamp', proargtypes => 'interval timestamp',
prosrc => 'select $2 + $1' },
{ oid => '2549',
- proname => 'interval_pl_timestamptz', prolang => 'sql', provolatile => 's',
+ proname => 'interval_pl_timestamptz', prolang => 'pgsql', provolatile => 's',
prorettype => 'timestamptz', proargtypes => 'interval timestamptz',
prosrc => 'select $2 + $1' },
{ oid => '2550',
- proname => 'integer_pl_date', prolang => 'sql', prorettype => 'date',
+ proname => 'integer_pl_date', prolang => 'pgsql', prorettype => 'date',
proargtypes => 'int4 date', prosrc => 'select $2 + $1' },
{ oid => '2556', descr => 'get OIDs of databases in a tablespace',
@@ -8301,7 +8301,7 @@
proname => 'xpath', prorettype => '_xml', proargtypes => 'text xml _text',
prosrc => 'xpath' },
{ oid => '2932', descr => 'evaluate XPath expression',
- proname => 'xpath', prolang => 'sql', prorettype => '_xml',
+ proname => 'xpath', prolang => 'pgsql', prorettype => '_xml',
proargtypes => 'text xml',
prosrc => 'select pg_catalog.xpath($1, $2, \'{}\'::pg_catalog.text[])' },
@@ -8314,7 +8314,7 @@
proname => 'xpath_exists', prorettype => 'bool',
proargtypes => 'text xml _text', prosrc => 'xpath_exists' },
{ oid => '3050', descr => 'test XML value against XPath expression',
- proname => 'xpath_exists', prolang => 'sql', prorettype => 'bool',
+ proname => 'xpath_exists', prolang => 'pgsql', prorettype => 'bool',
proargtypes => 'text xml',
prosrc => 'select pg_catalog.xpath_exists($1, $2,
\'{}\'::pg_catalog.text[])' },
{ oid => '3051', descr => 'determine if a string is well formed XML',
diff --git a/src/include/catalog/pg_subscription.h
b/src/include/catalog/pg_sub.h
similarity index 88%
rename from src/include/catalog/pg_subscription.h
rename to src/include/catalog/pg_sub.h
index 0a756d42d8..4faf0aa370 100644
--- a/src/include/catalog/pg_subscription.h
+++ b/src/include/catalog/pg_sub.h
@@ -1,12 +1,12 @@
/* -------------------------------------------------------------------------
*
- * pg_subscription.h
+ * pg_sub.h
* definition of the "subscription" system catalog (pg_subscription)
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * src/include/catalog/pg_subscription.h
+ * src/include/catalog/pg_sub.h
*
* NOTES
* The Catalog.pm module reads this file and derives schema
@@ -18,7 +18,7 @@
#define PG_SUBSCRIPTION_H
#include "catalog/genbki.h"
-#include "catalog/pg_subscription_d.h"
+#include "catalog/pg_sub_d.h"
#include "nodes/pg_list.h"
@@ -36,7 +36,7 @@
*
* NOTE: When adding a column, also update system_views.sql.
*/
-CATALOG(pg_subscription,6100,SubscriptionRelationId) BKI_SHARED_RELATION
BKI_ROWTYPE_OID(6101,SubscriptionRelation_Rowtype_Id) BKI_SCHEMA_MACRO
+CATALOG(pg_sub,6100,SubscriptionRelationId) BKI_SHARED_RELATION
BKI_ROWTYPE_OID(6101,SubscriptionRelation_Rowtype_Id) BKI_SCHEMA_MACRO
{
Oid oid; /* oid */
@@ -45,12 +45,12 @@ CATALOG(pg_subscription,6100,SubscriptionRelationId)
BKI_SHARED_RELATION BKI_ROW
Oid subowner; /* Owner of the
subscription */
- bool subenabled; /* True if the subscription is
enabled (the
+ bool subactive; /* True if the subscription is
enabled (the
* worker
should be running) */
#ifdef CATALOG_VARLEN /* variable-length fields start here */
/* Connection string to the publisher */
- text subconninfo BKI_FORCE_NOT_NULL;
+ text subconn BKI_FORCE_NOT_NULL;
/* Slot name on publisher */
NameData subslotname;
diff --git a/src/include/catalog/toasting.h b/src/include/catalog/toasting.h
index 51491c4513..5372bf88a1 100644
--- a/src/include/catalog/toasting.h
+++ b/src/include/catalog/toasting.h
@@ -95,7 +95,7 @@ DECLARE_TOAST(pg_shdescription, 2846, 2847);
DECLARE_TOAST(pg_shseclabel, 4060, 4061);
#define PgShseclabelToastTable 4060
#define PgShseclabelToastIndex 4061
-DECLARE_TOAST(pg_subscription, 4183, 4184);
+DECLARE_TOAST(pg_sub, 4183, 4184);
#define PgSubscriptionToastTable 4183
#define PgSubscriptionToastIndex 4184
DECLARE_TOAST(pg_tablespace, 4185, 4186);
diff --git a/src/include/replication/worker_internal.h
b/src/include/replication/worker_internal.h
index 8ed7e45056..8d913cffe3 100644
--- a/src/include/replication/worker_internal.h
+++ b/src/include/replication/worker_internal.h
@@ -15,7 +15,7 @@
#include <signal.h>
#include "access/xlogdefs.h"
-#include "catalog/pg_subscription.h"
+#include "catalog/pg_sub.h"
#include "datatype/timestamp.h"
#include "storage/lock.h"
test_add_acl_to_catalog_objects.sql
Description: application/sql
