Hello,

On 2019/12/05 11:31, Michael Paquier wrote:
On Wed, Dec 04, 2019 at 06:15:52PM +0900, Arthur Zakirov wrote:
Ah, I thought that pg_identify_object() gives properly quoted identity, and
it could be used to make SQL script.

It depends on the object type.  For columns I can see in your patch
that you are using a dedicated code path, but I don't think that we
should assume that there is an exact one-one mapping between the
object type and the grammar of GRANT/REVOKE for the object type
supported because both are completely independent things and
facilities.  Take for example foreign data wrappers.  Of course for
this patch this depends if we have system object of the type which
would be impacted.  That's not the case of foreign data wrappers and
likely it will never be, but there is no way to be sure that this
won't get broken silently in the future.

I attached new version of the patch. It still uses pg_identify_object(), I'm not sure about other ways to build identities yet.

It handles relations, their columns, functions, procedure and languages. There are other GRANT'able objects, like databases, foreign data wrappers and servers, schemas and tablespaces.

I didn't include handling of databases, schemas and tablespaces because I don't know yet how to identify if a such object is system object other than just hard code them. They are not pinned and are not created within pg_catalog schema.

Foreign data wrappers and servers are not handled too. There are no such built-in objects, so it is not possible to test them with "test_rename_catalog_objects.patch". And I'm not sure if they will be pinned (to test if it is system) if there will be such objects in the future.

Sure! But I'm not sure that I understood the idea. Do you mean the patch
which adds a TAP test? It can initialize two clusters, in first it renames
some system objects and changes their ACLs. And finally the test runs
pg_upgrade which will fail.

A TAP test won't help here because the idea is to create a patch for
HEAD which willingly introduces changes for system objects, where the
source binaries have ACLs on object types which are broken on the
target binaries with the custom patch.  That's to make sure that all
the logic which would get added to pu_upgrade is working correctly.
Other ideas are welcome.

I added "test_rename_catalog_objects.patch" and "test_add_acl_to_catalog_objects.sql". So testing steps are following: - initialize new source instance (e.g. pg v12) and run "test_add_acl_to_catalog_objects.sql" on it - apply "pg_upgrade_ACL_check_v6.patch" and "test_add_acl_to_catalog_objects.sql" for HEAD
- initialize new target instance for HEAD
- run pg_upgrade, it should create revoke_objects.sql file

"test_rename_catalog_objects.patch" should be applied after "pg_upgrade_ACL_check_v6.patch".

Renamed objects are the following:
- table pg_subscription -> pg_sub
- columns pg_subscription.subenabled -> subactive, pg_subscription.subconninfo -> subconn
- view pg_stat_subscription -> pg_stat_sub
- columns pg_stat_subscription.received_lsn -> received_location, pg_stat_subscription.latest_end_lsn -> latest_end_location
- function pg_stat_get_subscription -> pg_stat_get_sub
- language sql -> pgsql

--
Arthur
diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c
index cdd8788b9e..3a2004c23b 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()
+ *
+ * Checks that the old cluster doesn't have non-default ACL's for system 
objects
+ * which had different signatures in the new cluster.  Otherwise generates
+ * 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 to grant or revoke 
privileges");
+
+       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 att.attrelid = 
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 "
+               "UNION ALL "
+               /*
+                * Get system languages using pg_depend, since they are schema 
agnostic.
+                */
+               "SELECT refclassid, refobjid, refobjsubid "
+               "FROM pg_catalog.pg_depend "
+               "WHERE deptype = 'p' AND refclassid = 'pg_language'::regclass");
+
+       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 "
+               "ORDER BY 2;", 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            found = false;
+
+                       while (objnum < ntups)
+                       {
+                               int                     ret;
+
+                               ret = strcmp(PQgetvalue(res, objnum, 
i_obj_ident),
+                                                        aclinfo->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)
+                                       break;
+                               /*
+                                * The new cluster has an object with same 
identity, just exit
+                                * the loop.
+                                */
+                               else if (ret == 0)
+                               {
+                                       found = true;
+                                       objnum++;
+                                       break;
+                               }
+
+                               objnum++;
+                       }
+
+                       if (!found)
+                       {
+                               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 d67d3a4894..adb77178c7 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,119 @@ get_db_and_rel_infos(ClusterInfo *cluster)
 }
 
 
+/*
+ * get_non_default_acl_infos()
+ *
+ * Gets AclInfo array of system functions, procedures and columns information
+ * which 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 "
+                       "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' "
+                       "UNION ALL "
+                       /*
+                        * Get system languages, they are pinned and we can use 
pg_depend
+                        * here.
+                        */
+                       "SELECT obj.type, obj.identity, shd.refobjid::regrole 
rolename, false "
+                       "FROM pg_catalog.pg_shdepend shd "
+                       "INNER JOIN pg_catalog.pg_depend d ON d.refclassid = 
shd.classid "
+                       "    AND d.refobjid = shd.objid AND d.refobjsubid = 
shd.objsubid "
+                       /* get only pinned system objects */
+                       "    AND d.deptype = 'p', "
+                       "LATERAL pg_catalog.pg_identify_object("
+                       "    shd.classid, shd.objid, shd.objsubid) obj "
+                       "WHERE shd.deptype = 'a' AND shd.dbid = %d "
+                       "    AND shd.classid = 'pg_language'::regclass "
+                       /*
+                        * Sort only by identity.  It should be enough to 
uniquely compare
+                        * objects later in check_for_changed_signatures().
+                        */
+                       "ORDER BY 2;", dbinfo->db_oid, 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))
+               {
+                       PQExpBufferData 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';
+
+                       initPQExpBuffer(&roles_buf);
+                       /* Group all role names by objects type and identity */
+                       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 = roles_buf.data;
+               }
+
+               PQclear(res);
+               PQfinish(conn);
+
+               dbinfo->non_def_acl_arr.aclinfos = aclinfos;
+               dbinfo->non_def_acl_arr.nacls = nacls;
+       }
+}
+
+
 /*
  * get_db_infos()
  *
@@ -595,6 +710,7 @@ 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);
+               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 +736,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 729f86aa32..44058720c2 100644
--- a/src/bin/pg_upgrade/pg_upgrade.h
+++ b/src/bin/pg_upgrade/pg_upgrade.h
@@ -149,6 +149,24 @@ typedef struct
        int                     nrels;
 } RelInfoArr;
 
+/*
+ * Structure to store objects information to check if it changed its signature.
+ */
+typedef struct
+{
+       char       *obj_type;           /* type name */
+       char       *obj_ident;          /* complete object identity */
+       bool            is_relation;    /* is the object 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.
  */
@@ -185,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
@@ -392,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);
 
create user backup;
grant all on table pg_subscription to backup;
grant all (subenabled) on pg_subscription to backup;
grant all (subconninfo) on pg_subscription to backup;
grant all on pg_stat_subscription to backup;
grant all (received_lsn) on pg_stat_subscription to backup;
grant all (latest_end_lsn) on pg_stat_subscription to backup;
grant all on function pg_stat_get_subscription to backup;
grant all on language sql to backup;

diff --git a/src/backend/catalog/Makefile b/src/backend/catalog/Makefile
index a51153236a..460c6afa66 100644
--- a/src/backend/catalog/Makefile
+++ b/src/backend/catalog/Makefile
@@ -68,7 +68,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 ea5666ebb8..75d5773672 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 6b104695c0..3022b2b029 100644
--- a/src/backend/catalog/catalog.c
+++ b/src/backend/catalog/catalog.c
@@ -38,7 +38,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 d07bb4496e..2eab802176 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 5d64791c5d..46f2466aed 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 ae3002bb42..39c803fa00 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"
@@ -505,10 +505,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 59f97bf3d0..900acb90a3 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 68d88ff499..c93e7037fc 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 f7800f01a6..20597dd1ff 100644
--- a/src/backend/catalog/system_views.sql
+++ b/src/backend/catalog/system_views.sql
@@ -477,7 +477,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,
@@ -803,19 +803,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
@@ -1062,9 +1062,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;
 
 
 --
@@ -1114,7 +1114,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';
@@ -1130,7 +1130,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 d425ef935e..9429356e81 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 a70e75a219..2b3bf4c888 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 5408edcfc2..911265ff6f 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"
@@ -309,8 +309,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;
@@ -361,7 +361,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))
        {
@@ -392,23 +392,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, &copy_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 4643af95fe..23b8df943b 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"
@@ -97,7 +97,7 @@ static volatile sig_atomic_t got_SIGHUP = false;
 
 static bool on_commit_launcher_wakeup = false;
 
-Datum          pg_stat_get_subscription(PG_FUNCTION_ARGS);
+Datum          pg_stat_get_sub(PG_FUNCTION_ARGS);
 
 
 /*
@@ -149,7 +149,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. */
 
@@ -1084,7 +1084,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 ced0d191c2..67cab841dd 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -29,7 +29,7 @@
 #include "access/xlog_internal.h"
 #include "catalog/catalog.h"
 #include "catalog/namespace.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 50f8912c13..9330d78c8a 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"
@@ -117,7 +117,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
@@ -3648,8 +3648,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 d69c0ff813..d021d37fba 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 08658c8e86..cca150a39c 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -4117,7 +4117,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);
@@ -4136,9 +4136,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);
@@ -4150,7 +4150,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 ef4445b017..8d4c8d8eb5 100644
--- a/src/include/catalog/indexing.h
+++ b/src/include/catalog/indexing.h
@@ -357,10 +357,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 02dde38a1c..5c82c1b545 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 ac8f64b219..27a80a6a5f 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -2281,7 +2281,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',
@@ -2334,16 +2334,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)' },
 
@@ -2519,13 +2519,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',
@@ -2567,17 +2567,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)' },
@@ -2586,15 +2586,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)' },
 
@@ -2675,7 +2675,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' },
 
@@ -2759,7 +2759,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',
@@ -2767,7 +2767,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)' },
 
@@ -2882,7 +2882,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',
@@ -3142,7 +3142,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',
@@ -3438,11 +3438,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',
@@ -4033,7 +4033,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',
@@ -4165,13 +4165,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',
@@ -4258,10 +4258,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',
@@ -4394,7 +4394,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',
@@ -4403,7 +4403,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)' },
 
@@ -4442,13 +4442,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
@@ -4767,7 +4767,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',
@@ -5178,12 +5178,12 @@
   proargnames => 
'{pid,status,receive_start_lsn,receive_start_tli,received_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' },
@@ -5579,11 +5579,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' },
 
@@ -5683,15 +5683,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',
@@ -5757,7 +5757,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)' },
 
@@ -5778,7 +5778,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))' },
 
@@ -6117,11 +6117,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?',
@@ -6922,7 +6922,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',
@@ -7760,21 +7760,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',
@@ -8163,7 +8163,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[])' },
 
@@ -8176,7 +8176,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 90%
rename from src/include/catalog/pg_subscription.h
rename to src/include/catalog/pg_sub.h
index 3cb13d897e..6628814833 100644
--- a/src/include/catalog/pg_subscription.h
+++ b/src/include/catalog/pg_sub.h
@@ -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 cc5dfed0bf..40a0c901cd 100644
--- a/src/include/catalog/toasting.h
+++ b/src/include/catalog/toasting.h
@@ -98,7 +98,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 05f4936419..d1cf8906a7 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"
 

Reply via email to