From 70e09826ba077775276df45e3f8569c0a1d3cb73 Mon Sep 17 00:00:00 2001 From: KaiGai Kohei Date: Tue, 5 Oct 2010 21:43:17 +0900 Subject: [PATCH 1/5] fixup sepostgresql-9.0-fullset.patch (rebased to the v9.0.0) --- sepostgresql-9.0-fullset.patch | 1207 +++++++++++++------------------- 1 file changed, 500 insertions(+), 707 deletions(-) diff --git a/sepostgresql-9.0-fullset.patch b/sepostgresql-9.0-fullset.patch index ae16554..01b861d 100644 --- a/sepostgresql-9.0-fullset.patch +++ b/sepostgresql-9.0-fullset.patch @@ -1,8 +1,8 @@ diff --git a/configure b/configure -index b91de59..b44a6be 100755 +index 7c54dc6..bb7e49c 100755 --- a/configure +++ b/configure -@@ -707,6 +707,7 @@ LDFLAGS_SL +@@ -708,6 +708,7 @@ LDFLAGS_EX ELF_SYS EGREP GREP @@ -10,7 +10,7 @@ index b91de59..b44a6be 100755 with_zlib with_system_tzdata with_libxslt -@@ -842,6 +843,7 @@ with_libxml +@@ -843,6 +844,7 @@ with_libxml with_libxslt with_system_tzdata with_zlib @@ -18,7 +18,7 @@ index b91de59..b44a6be 100755 with_gnu_ld enable_largefile enable_float4_byval -@@ -1498,6 +1500,7 @@ Optional Features: +@@ -1500,6 +1502,7 @@ Optional Features: --enable-depend turn on automatic dependency tracking --enable-cassert enable assertion checks (for debugging) --disable-thread-safety disable thread-safety in client libraries @@ -26,7 +26,7 @@ index b91de59..b44a6be 100755 --disable-largefile omit support for large files --disable-float4-byval disable float4 passed by value --disable-float8-byval disable float8 passed by value -@@ -5608,6 +5611,201 @@ fi +@@ -5611,6 +5614,201 @@ fi # @@ -229,7 +229,7 @@ index b91de59..b44a6be 100755 # diff --git a/configure.in b/configure.in -index b2fa682..5797ff5 100644 +index d7fec2c..cc3b119 100644 --- a/configure.in +++ b/configure.in @@ -755,6 +755,19 @@ PGAC_ARG_BOOL(with, zlib, yes, @@ -253,7 +253,7 @@ index b2fa682..5797ff5 100644 # diff --git a/contrib/adminpack/adminpack.c b/contrib/adminpack/adminpack.c -index 13e04b2..c613826 100644 +index 5271ef6..397786d 100644 --- a/contrib/adminpack/adminpack.c +++ b/contrib/adminpack/adminpack.c @@ -22,6 +22,7 @@ @@ -342,208 +342,11 @@ index 13e04b2..c613826 100644 TupleDescInitEntry(tupdesc, (AttrNumber) 1, "starttime", TIMESTAMPOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "filename", -diff --git a/contrib/sepgtest/sepgtest b/contrib/sepgtest/sepgtest -new file mode 100755 -index 0000000..30e7cb9 ---- /dev/null -+++ b/contrib/sepgtest/sepgtest -@@ -0,0 +1,45 @@ -+#!/bin/sh -+ -+SEPGTEST=`basename $0` -+PSQL=`which psql` -+DIFF=`which diff` -+RUNCON=`which runcon` -+ -+DBUSER="" -+DBHOST="" -+DBPORT="" -+DBNAME="testdb" -+ -+usage() -+{ -+ echo "${SEPGTEST}: [-u ] [-h ] [-p ] [-d ]" -+ exit 1 -+} -+ -+# parse options -+CMD_OPTS=`getopt -n "${SEPGTEST}" "u:h:p:d:" $*` || usage -+eval set -- $CMD_OPTS -+while [ -n "$1" ]; -+do -+ case $1 in -+ -u) -+ DBUSER="-U $2"; shift 2;; -+ -h) -+ DBHOST="-h $2"; shift 2;; -+ -p) -+ DBPORT="-p $2"; shift 2;; -+ -d) -+ DBNAME="$2"; shift 2;; -+ --) -+ shift; break;; -+ *) -+ usage; shift 2;; -+ esac -+done -+ -+PSQL_OPTS="${PSQL} ${DBUSER} ${DBHOST} ${DBPORT} ${DBNAME}" -+ -+# check environment -+ -+ -+ -diff --git a/contrib/sepgtest/sepgtest.in b/contrib/sepgtest/sepgtest.in -new file mode 100755 -index 0000000..30e7cb9 ---- /dev/null -+++ b/contrib/sepgtest/sepgtest.in -@@ -0,0 +1,45 @@ -+#!/bin/sh -+ -+SEPGTEST=`basename $0` -+PSQL=`which psql` -+DIFF=`which diff` -+RUNCON=`which runcon` -+ -+DBUSER="" -+DBHOST="" -+DBPORT="" -+DBNAME="testdb" -+ -+usage() -+{ -+ echo "${SEPGTEST}: [-u ] [-h ] [-p ] [-d ]" -+ exit 1 -+} -+ -+# parse options -+CMD_OPTS=`getopt -n "${SEPGTEST}" "u:h:p:d:" $*` || usage -+eval set -- $CMD_OPTS -+while [ -n "$1" ]; -+do -+ case $1 in -+ -u) -+ DBUSER="-U $2"; shift 2;; -+ -h) -+ DBHOST="-h $2"; shift 2;; -+ -p) -+ DBPORT="-p $2"; shift 2;; -+ -d) -+ DBNAME="$2"; shift 2;; -+ --) -+ shift; break;; -+ *) -+ usage; shift 2;; -+ esac -+done -+ -+PSQL_OPTS="${PSQL} ${DBUSER} ${DBHOST} ${DBPORT} ${DBNAME}" -+ -+# check environment -+ -+ -+ -diff --git a/git-update-branches.sh b/git-update-branches.sh -new file mode 100755 -index 0000000..2f25fde ---- /dev/null -+++ b/git-update-branches.sh -@@ -0,0 +1,89 @@ -+#!/bin/sh -+ -+GIT_BIN=`which git` -+GIT_DIR=`(cd \`dirname $0\`; pwd)` -+UPSTREAM_URL="git://git.postgresql.org/git/postgresql.git" -+UPSTREAM_BRANCH="master" -+LOCAL_BRANCHES="master v9.0/sepgsql" -+RPMSOURCE=`rpm -E '%{_sourcedir}'` -+#================================================================ -+ -+cd ${GIT_DIR} -+ -+CURRENT_BRANCH=`${GIT_BIN} branch -l | grep '^*' | awk '{print $2}'` -+ -+for tree in ${LOCAL_BRANCHES} -+do -+ ${GIT_BIN} branch -lr | grep -q "origin/${tree}" || exit 1 -+ ${GIT_BIN} branch -l | grep -q "${tree}" || \ -+ ${GIT_BIN} checkout --track "origin/${tree}" || exit 1 -+done -+ -+# ======== create patches ======== -+if [ "$1" = "--patch" ]; then -+ LEFT_TREE="" -+ RIGHT_TREE="" -+ NUM=0 -+ -+ BASE_VERSION=`grep AC_INIT ${GIT_DIR}/configure.in \ -+ | head -1 \ -+ | sed -e 's/,/ /g' -e 's/\[//g' -e 's/\]//g' \ -+ | awk '{print $2}'` -+ BASE_MAJOR=`echo $BASE_VERSION | sed 's/\.[0-9]\+$//g'` -+ -+ for tree in ${LOCAL_BRANCHES} -+ do -+ LEFT_TREE=$RIGHT_TREE -+ RIGHT_TREE=$tree -+ -+ if [ -n "$LEFT_TREE" -a -n "$RIGHT_TREE" ]; then -+ tag=`basename ${RIGHT_TREE}` -+ ${GIT_BIN} diff $LEFT_TREE $RIGHT_TREE \ -+ > $RPMSOURCE/pgsql-${NUM}-${BASE_MAJOR}-${tag}.patch -+ echo "${NUM}) $RPMSOURCE/pgsql-${NUM}-${BASE_MAJOR}-${tag}.patch" -+ fi -+ NUM=`printf "%02d" \`expr $NUM + 1\`` -+ done -+ -+ exit 0 -+fi -+ -+# ======== sync remote git ======== -+ -+if echo "$1" | grep -q '^--sync-upstream=\?'; then -+ UPSTREAM_TAG=`echo "$1" | sed 's/^--sync-upstream=\?//g'` -+ if [ -n "${UPSTREAM_TAG}" ]; then -+ UPSTREAM_TAG=HEAD -+ fi -+ -+ LOCAL_MASTER=`echo "${LOCAL_BRANCHES}" | awk '{print $1}'` -+ -+ ${GIT_BIN} checkout ${LOCAL_MASTER} || exit 1 -+ ${GIT_BIN} pull ${UPSTREAM_URL} ${UPSTREAM_BRANCH} ${UPSTREAM_TAG} -+ if [ $? -ne 0 ]; then -+ ${GIT_BIN} reset HEAD -+ ${GIT_BIN} checkout . -+ ${GIT_BIN} clean -fd -+ ${GIT_BIN} pull --no-commit ${UPSTREAM_URL} ${UPSTREAM_BRANCH} ${UPSTREAM_TAG} -+ exit 2 -+ fi -+fi -+ -+LEFT_TREE="" -+for RIGHT_TREE in ${LOCAL_BRANCHES} -+do -+ if [ -n "${LEFT_TREE}" -a -n "${RIGHT_TREE}" ]; then -+ ${GIT_BIN} checkout ${RIGHT_TREE} || exit 1 -+ ${GIT_BIN} pull ${GIT_DIR} ${LEFT_TREE} || exit 1 -+ if [ $? -ne 0 ]; then -+ ${GIT_BIN} reset HEAD -+ ${GIT_BIN} checkout . -+ ${GIT_BIN} clean -fd -+ ${GIT_BIN} pull --no-commit ${GIT_DIR} ${LEFT_TREE} -+ exit 2 -+ fi -+ fi -+ LEFT_TREE=${RIGHT_TREE} -+done -+ -+${GIT_BIN} checkout ${CURRENT_BRANCH} diff --git a/src/Makefile.global.in b/src/Makefile.global.in -index 1c38ac2..0e3bed5 100644 +index 280578a..6495097 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in -@@ -164,6 +164,7 @@ enable_nls = @enable_nls@ +@@ -166,6 +166,7 @@ enable_nls = @enable_nls@ enable_debug = @enable_debug@ enable_dtrace = @enable_dtrace@ enable_coverage = @enable_coverage@ @@ -552,10 +355,10 @@ index 1c38ac2..0e3bed5 100644 python_includespec = @python_includespec@ diff --git a/src/backend/Makefile b/src/backend/Makefile -index 218544e..0b1dd31 100644 +index a11b2b5..25198fd 100644 --- a/src/backend/Makefile +++ b/src/backend/Makefile -@@ -16,7 +16,7 @@ include $(top_builddir)/src/Makefile.global +@@ -19,7 +19,7 @@ include $(top_builddir)/src/Makefile.global SUBDIRS = access bootstrap catalog parser commands executor foreign lib libpq \ main nodes optimizer port postmaster regex replication rewrite \ @@ -564,7 +367,7 @@ index 218544e..0b1dd31 100644 include $(srcdir)/common.mk -@@ -40,6 +40,11 @@ LIBS := $(filter-out -lpgport, $(LIBS)) $(LDAP_LIBS_BE) +@@ -43,6 +43,11 @@ LIBS := $(filter-out -lpgport, $(LIBS)) $(LDAP_LIBS_BE) # The backend doesn't need everything that's in LIBS, however LIBS := $(filter-out -lz -lreadline -ledit -ltermcap -lncurses -lcurses, $(LIBS)) @@ -577,7 +380,7 @@ index 218544e..0b1dd31 100644 all: submake-libpgport submake-schemapg postgres $(POSTGRES_IMP) diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c -index 6ec73f0..db0023f 100644 +index 8d770a3..a3b1474 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -60,6 +60,7 @@ @@ -630,7 +433,7 @@ index 6ec73f0..db0023f 100644 if (tupleDescriptor->tdhasoid) len += sizeof(Oid); + if (tupleDescriptor->tdhassecid) -+ len += sizeof(Oid); ++ len += sizeof(Oid)+1; hoff = len = MAXALIGN(len); /* align user data safely */ @@ -644,7 +447,7 @@ index 6ec73f0..db0023f 100644 heap_fill_tuple(tupleDescriptor, values, diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c -index 9a8611f..325dbde 100644 +index 2125fdf..5880ec7 100644 --- a/src/backend/access/common/tupdesc.c +++ b/src/backend/access/common/tupdesc.c @@ -34,7 +34,7 @@ @@ -738,7 +541,7 @@ index 9a8611f..325dbde 100644 attnum = 0; diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c -index f01ed1e..4e8dfcb 100644 +index 2a75820..065ba1a 100644 --- a/src/backend/access/gin/ginutil.c +++ b/src/backend/access/gin/ginutil.c @@ -33,7 +33,7 @@ initGinState(GinState *state, Relation index) @@ -751,7 +554,7 @@ index f01ed1e..4e8dfcb 100644 TupleDescInitEntry(state->tupdesc[i], (AttrNumber) 1, NULL, INT2OID, -1, 0); diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c -index 759fc35..2fc282d 100644 +index 48a387e..f00a9cc 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -52,6 +52,7 @@ @@ -818,7 +621,7 @@ index 759fc35..2fc282d 100644 MarkBufferDirty(buffer); diff --git a/src/backend/access/heap/tuptoaster.c b/src/backend/access/heap/tuptoaster.c -index 2af81df..18341f4 100644 +index 7518db1..fb78993 100644 --- a/src/backend/access/heap/tuptoaster.c +++ b/src/backend/access/heap/tuptoaster.c @@ -591,6 +591,8 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup, @@ -844,12 +647,12 @@ index 2af81df..18341f4 100644 if (olddata->t_infomask & HEAP_HASOID) new_len += sizeof(Oid); + if (HeapTupleHeaderHasSecid(olddata)) -+ new_len += sizeof(Oid); ++ new_len += sizeof(Oid)+1; new_len = MAXALIGN(new_len); Assert(new_len == olddata->t_hoff); new_data_len = heap_compute_data_size(tupleDesc, diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c -index d432c9d..28e7bde 100644 +index d6dca97..710b891 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -605,7 +605,7 @@ pg_prepared_xact(PG_FUNCTION_ARGS) @@ -862,7 +665,7 @@ index d432c9d..28e7bde 100644 XIDOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "gid", diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c -index b88cff2..d6636f7 100644 +index 8436dea..d9de0e4 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -36,6 +36,7 @@ @@ -891,7 +694,7 @@ index b88cff2..d6636f7 100644 false, /* entry-time xact r/o state */ false, /* startedInRecovery */ NULL /* link to parent state block */ -@@ -1658,6 +1663,10 @@ StartTransaction(void) +@@ -1698,6 +1703,10 @@ StartTransaction(void) /* SecurityRestrictionContext should never be set outside a transaction */ Assert(s->prevSecContext == 0); @@ -902,7 +705,7 @@ index b88cff2..d6636f7 100644 /* * initialize other subsystems for new transaction */ -@@ -2162,6 +2171,10 @@ AbortTransaction(void) +@@ -2202,6 +2211,10 @@ AbortTransaction(void) */ SetUserIdAndSecContext(s->prevUser, s->prevSecContext); @@ -913,7 +716,7 @@ index b88cff2..d6636f7 100644 /* * do abort processing */ -@@ -4006,6 +4019,10 @@ AbortSubTransaction(void) +@@ -4046,6 +4059,10 @@ AbortSubTransaction(void) */ SetUserIdAndSecContext(s->prevUser, s->prevSecContext); @@ -924,7 +727,7 @@ index b88cff2..d6636f7 100644 /* * We can skip all this stuff if the subxact failed before creating a * ResourceOwner... -@@ -4145,6 +4162,8 @@ PushTransaction(void) +@@ -4185,6 +4202,8 @@ PushTransaction(void) s->state = TRANS_DEFAULT; s->blockState = TBLOCK_SUBBEGIN; GetUserIdAndSecContext(&s->prevUser, &s->prevSecContext); @@ -934,10 +737,10 @@ index b88cff2..d6636f7 100644 CurrentTransactionState = s; diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c -index 0b05e25..4f783e5 100644 +index 15b3476..54a9105 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c -@@ -8765,7 +8765,7 @@ pg_xlogfile_name_offset(PG_FUNCTION_ARGS) +@@ -8895,7 +8895,7 @@ pg_xlogfile_name_offset(PG_FUNCTION_ARGS) * Construct a tuple descriptor for the result row. This must match this * function's pg_proc entry! */ @@ -947,7 +750,7 @@ index 0b05e25..4f783e5 100644 TEXTOID, -1, 0); TupleDescInitEntry(resultTupleDesc, (AttrNumber) 2, "file_offset", diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y -index 387d43e..aecb449 100644 +index 9cc6850..7537984 100644 --- a/src/backend/bootstrap/bootparse.y +++ b/src/backend/bootstrap/bootparse.y @@ -32,6 +32,7 @@ @@ -982,7 +785,7 @@ index 387d43e..aecb449 100644 } do_end(); diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c -index 455eac1..0590156 100644 +index 080d80e..a870b31 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -33,6 +33,7 @@ @@ -1035,7 +838,7 @@ index 455eac1..0590156 100644 tuple = heap_form_tuple(tupDesc, values, Nulls); if (objectid != (Oid) 0) diff --git a/src/backend/catalog/Makefile b/src/backend/catalog/Makefile -index dafae3f..c2aea7a 100644 +index a970039..0381d6b 100644 --- a/src/backend/catalog/Makefile +++ b/src/backend/catalog/Makefile @@ -13,7 +13,7 @@ include $(top_builddir)/src/Makefile.global @@ -1057,7 +860,7 @@ index dafae3f..c2aea7a 100644 pg_foreign_data_wrapper.h pg_foreign_server.h pg_user_mapping.h \ pg_default_acl.h \ diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c -index 2561d83..002a66c 100644 +index 0470a70..62fedb1 100644 --- a/src/backend/catalog/aclchk.c +++ b/src/backend/catalog/aclchk.c @@ -38,6 +38,7 @@ @@ -1074,9 +877,9 @@ index 2561d83..002a66c 100644 #include "parser/parse_func.h" +#include "sepgsql/hooks.h" #include "utils/acl.h" + #include "utils/builtins.h" #include "utils/fmgroids.h" - #include "utils/lsyscache.h" -@@ -1499,6 +1501,10 @@ expand_all_col_privileges(Oid table_oid, Form_pg_class classForm, +@@ -1500,6 +1502,10 @@ expand_all_col_privileges(Oid table_oid, Form_pg_class classForm, if (curr_att == ObjectIdAttributeNumber && !classForm->relhasoids) continue; @@ -1087,7 +890,7 @@ index 2561d83..002a66c 100644 /* Views don't have any system columns at all */ if (classForm->relkind == RELKIND_VIEW && curr_att < 0) continue; -@@ -1608,6 +1614,8 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname, +@@ -1609,6 +1615,8 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname, relOid, grantorId, ACL_KIND_COLUMN, relname, attnum, NameStr(pg_attribute_tuple->attname)); @@ -1096,7 +899,7 @@ index 2561d83..002a66c 100644 /* * Generate new ACL. -@@ -1869,6 +1877,8 @@ ExecGrant_Relation(InternalGrant *istmt) +@@ -1870,6 +1878,8 @@ ExecGrant_Relation(InternalGrant *istmt) ? ACL_KIND_SEQUENCE : ACL_KIND_CLASS, NameStr(pg_class_tuple->relname), 0, NULL); @@ -1105,7 +908,7 @@ index 2561d83..002a66c 100644 /* * Generate new ACL. -@@ -2063,6 +2073,8 @@ ExecGrant_Database(InternalGrant *istmt) +@@ -2064,6 +2074,8 @@ ExecGrant_Database(InternalGrant *istmt) datId, grantorId, ACL_KIND_DATABASE, NameStr(pg_database_tuple->datname), 0, NULL); @@ -1114,7 +917,7 @@ index 2561d83..002a66c 100644 /* * Generate new ACL. -@@ -2188,6 +2200,8 @@ ExecGrant_Fdw(InternalGrant *istmt) +@@ -2189,6 +2201,8 @@ ExecGrant_Fdw(InternalGrant *istmt) fdwid, grantorId, ACL_KIND_FDW, NameStr(pg_fdw_tuple->fdwname), 0, NULL); @@ -1123,7 +926,7 @@ index 2561d83..002a66c 100644 /* * Generate new ACL. -@@ -2313,6 +2327,8 @@ ExecGrant_ForeignServer(InternalGrant *istmt) +@@ -2314,6 +2328,8 @@ ExecGrant_ForeignServer(InternalGrant *istmt) srvid, grantorId, ACL_KIND_FOREIGN_SERVER, NameStr(pg_server_tuple->srvname), 0, NULL); @@ -1132,7 +935,7 @@ index 2561d83..002a66c 100644 /* * Generate new ACL. -@@ -2831,6 +2847,8 @@ ExecGrant_Namespace(InternalGrant *istmt) +@@ -2832,6 +2848,8 @@ ExecGrant_Namespace(InternalGrant *istmt) nspid, grantorId, ACL_KIND_NAMESPACE, NameStr(pg_namespace_tuple->nspname), 0, NULL); @@ -1141,7 +944,7 @@ index 2561d83..002a66c 100644 /* * Generate new ACL. -@@ -2955,6 +2973,8 @@ ExecGrant_Tablespace(InternalGrant *istmt) +@@ -2956,6 +2974,8 @@ ExecGrant_Tablespace(InternalGrant *istmt) tblId, grantorId, ACL_KIND_TABLESPACE, NameStr(pg_tablespace_tuple->spcname), 0, NULL); @@ -1151,7 +954,7 @@ index 2561d83..002a66c 100644 /* * Generate new ACL. diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c -index 3edfc23..b451e59 100644 +index 1739085..36d4852 100644 --- a/src/backend/catalog/catalog.c +++ b/src/backend/catalog/catalog.c @@ -32,6 +32,7 @@ @@ -1189,7 +992,7 @@ index 3edfc23..b451e59 100644 relationId == PgShdescriptionToastIndex || relationId == PgDbRoleSettingToastTable || diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl -index 31aabda..c9fc09e 100644 +index 85d1d71..853074e 100644 --- a/src/backend/catalog/genbki.pl +++ b/src/backend/catalog/genbki.pl @@ -218,7 +218,8 @@ foreach my $catname ( @{ $catalogs->{names} } ) @@ -1203,7 +1006,7 @@ index 31aabda..c9fc09e 100644 foreach my $attr (@SYS_ATTRS) { diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c -index d848ef0..deaf2fb 100644 +index 47e0c9b..73cbfcf 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -43,6 +43,7 @@ @@ -1547,7 +1350,7 @@ index d848ef0..deaf2fb 100644 diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c -index 69946fe..23fb19b 100644 +index dea6889..18d96da 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -39,6 +39,7 @@ @@ -1656,7 +1459,7 @@ index 69946fe..23fb19b 100644 /* ---------------- * update pg_index diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c -index 5581346..cf1910a 100644 +index 2e5bb27..e730904 100644 --- a/src/backend/catalog/namespace.c +++ b/src/backend/catalog/namespace.c @@ -40,6 +40,7 @@ @@ -1677,7 +1480,7 @@ index 5581346..cf1910a 100644 return namespaceId; } -@@ -2903,7 +2907,8 @@ recomputeNamespacePath(void) +@@ -2911,7 +2915,8 @@ recomputeNamespacePath(void) if (OidIsValid(namespaceId) && !list_member_oid(oidlist, namespaceId) && pg_namespace_aclcheck(namespaceId, roleid, @@ -1687,7 +1490,7 @@ index 5581346..cf1910a 100644 oidlist = lappend_oid(oidlist, namespaceId); } } -@@ -2930,7 +2935,8 @@ recomputeNamespacePath(void) +@@ -2938,7 +2943,8 @@ recomputeNamespacePath(void) if (OidIsValid(namespaceId) && !list_member_oid(oidlist, namespaceId) && pg_namespace_aclcheck(namespaceId, roleid, @@ -1697,7 +1500,7 @@ index 5581346..cf1910a 100644 oidlist = lappend_oid(oidlist, namespaceId); } } -@@ -2996,9 +3002,12 @@ InitTempTableNamespace(void) +@@ -3004,9 +3010,12 @@ InitTempTableNamespace(void) char namespaceName[NAMEDATALEN]; Oid namespaceId; Oid toastspaceId; @@ -1710,7 +1513,7 @@ index 5581346..cf1910a 100644 /* * First, do permission check to see if we are authorized to make temp * tables. We use a nonstandard error message here since "databasename: -@@ -3016,6 +3025,9 @@ InitTempTableNamespace(void) +@@ -3024,6 +3033,9 @@ InitTempTableNamespace(void) errmsg("permission denied to create temporary tables in database \"%s\"", get_database_name(MyDatabaseId)))); @@ -1720,7 +1523,7 @@ index 5581346..cf1910a 100644 /* * Do not allow a Hot Standby slave session to make temp tables. Aside * from problems with modifying the system catalogs, there is a naming -@@ -3031,8 +3043,6 @@ InitTempTableNamespace(void) +@@ -3039,8 +3051,6 @@ InitTempTableNamespace(void) (errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION), errmsg("cannot create temporary tables during recovery"))); @@ -1729,7 +1532,7 @@ index 5581346..cf1910a 100644 namespaceId = GetSysCacheOid1(NAMESPACENAME, CStringGetDatum(namespaceName)); if (!OidIsValid(namespaceId)) -@@ -3045,7 +3055,9 @@ InitTempTableNamespace(void) +@@ -3053,7 +3063,9 @@ InitTempTableNamespace(void) * temp tables. This works because the places that access the temp * namespace for my own backend skip permissions checks on it. */ @@ -1740,7 +1543,7 @@ index 5581346..cf1910a 100644 /* Advance command counter to make namespace visible */ CommandCounterIncrement(); } -@@ -3070,7 +3082,9 @@ InitTempTableNamespace(void) +@@ -3078,7 +3090,9 @@ InitTempTableNamespace(void) CStringGetDatum(namespaceName)); if (!OidIsValid(toastspaceId)) { @@ -1752,7 +1555,7 @@ index 5581346..cf1910a 100644 CommandCounterIncrement(); } diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c -index 582d894..d7b6bd1 100644 +index 9672ecf..b28a314 100644 --- a/src/backend/catalog/pg_aggregate.c +++ b/src/backend/catalog/pg_aggregate.c @@ -27,6 +27,7 @@ @@ -1793,7 +1596,7 @@ index 582d894..d7b6bd1 100644 /* * Okay to create the pg_aggregate entry. diff --git a/src/backend/catalog/pg_conversion.c b/src/backend/catalog/pg_conversion.c -index 99085c9..b4c0b3a 100644 +index 574eef5..2a46cdb 100644 --- a/src/backend/catalog/pg_conversion.c +++ b/src/backend/catalog/pg_conversion.c @@ -40,7 +40,7 @@ Oid @@ -1815,7 +1618,7 @@ index 99085c9..b4c0b3a 100644 oid = simple_heap_insert(rel, tup); Assert(OidIsValid(oid)); diff --git a/src/backend/catalog/pg_largeobject.c b/src/backend/catalog/pg_largeobject.c -index e3f18bf..572ce01 100644 +index 7c5f56f..fb8bf22 100644 --- a/src/backend/catalog/pg_largeobject.c +++ b/src/backend/catalog/pg_largeobject.c @@ -21,10 +21,13 @@ @@ -1914,9 +1717,9 @@ index e3f18bf..572ce01 100644 +/* * LargeObjectExists * - * We don't use the system cache to for large object metadata, for fear of + * We don't use the system cache for large object metadata, for fear of diff --git a/src/backend/catalog/pg_namespace.c b/src/backend/catalog/pg_namespace.c -index 22111a3..cba7274 100644 +index 79d03b3..4357a9e 100644 --- a/src/backend/catalog/pg_namespace.c +++ b/src/backend/catalog/pg_namespace.c @@ -28,7 +28,7 @@ @@ -1938,7 +1741,7 @@ index 22111a3..cba7274 100644 nspoid = simple_heap_insert(nspdesc, tup); Assert(OidIsValid(nspoid)); diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c -index 2362268..f6df55e 100644 +index 8eebb1d..71be3c5 100644 --- a/src/backend/catalog/pg_operator.c +++ b/src/backend/catalog/pg_operator.c @@ -28,6 +28,7 @@ @@ -2019,7 +1822,7 @@ index 2362268..f6df55e 100644 } diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c -index d76e415..f4c74a3 100644 +index f60cc61..a2ccc76 100644 --- a/src/backend/catalog/pg_proc.c +++ b/src/backend/catalog/pg_proc.c @@ -84,7 +84,8 @@ ProcedureCreate(const char *procedureName, @@ -2704,7 +2507,7 @@ index 0000000..4816635 + PG_RETURN_OID(HeapTupleHeaderGetSecid(htup)); +} diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c -index 76f9e06..0b4dcc3 100644 +index d4fdea9..a1220ea 100644 --- a/src/backend/catalog/pg_type.c +++ b/src/backend/catalog/pg_type.c @@ -25,6 +25,7 @@ @@ -2771,7 +2574,7 @@ index 76f9e06..0b4dcc3 100644 } diff --git a/src/backend/catalog/toasting.c b/src/backend/catalog/toasting.c -index 435dfdd..5d86354 100644 +index 86e7daa..82cf587 100644 --- a/src/backend/catalog/toasting.c +++ b/src/backend/catalog/toasting.c @@ -24,6 +24,7 @@ @@ -2822,7 +2625,7 @@ index 435dfdd..5d86354 100644 /* make the toast relation visible, else index creation will fail */ CommandCounterIncrement(); diff --git a/src/backend/commands/aggregatecmds.c b/src/backend/commands/aggregatecmds.c -index 4964fb3..390a1c1 100644 +index 2c6ce59..312d59f 100644 --- a/src/backend/commands/aggregatecmds.c +++ b/src/backend/commands/aggregatecmds.c @@ -32,6 +32,7 @@ @@ -2844,10 +2647,10 @@ index 4964fb3..390a1c1 100644 namestrcpy(&(((Form_pg_proc) GETSTRUCT(tup))->proname), newname); simple_heap_update(rel, &tup->t_self, tup); diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c -index 17e1e77..c1c8bfd 100644 +index cecdfa5..5b51f68 100644 --- a/src/backend/commands/alter.c +++ b/src/backend/commands/alter.c -@@ -289,3 +289,64 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt) +@@ -290,3 +290,64 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt) (int) stmt->objectType); } } @@ -2913,7 +2716,7 @@ index 17e1e77..c1c8bfd 100644 + } +} diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c -index ccb4599..394740a 100644 +index 7a1b8e8..69988d0 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -30,12 +30,14 @@ @@ -3002,7 +2805,7 @@ index ccb4599..394740a 100644 /* diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c -index 64792f2..6d71642 100644 +index 7fa09c8..2deb171 100644 --- a/src/backend/commands/comment.c +++ b/src/backend/commands/comment.c @@ -49,6 +49,7 @@ @@ -3173,7 +2976,7 @@ index 64792f2..6d71642 100644 ReleaseSysCache(tuple); /* Call CreateComments() to create/drop the comments */ -@@ -1505,6 +1554,9 @@ CommentCast(List *qualname, List *arguments, char *comment) +@@ -1482,6 +1531,9 @@ CommentCast(List *qualname, List *arguments, char *comment) format_type_be(sourcetypeid), format_type_be(targettypeid)))); @@ -3183,7 +2986,7 @@ index 64792f2..6d71642 100644 ReleaseSysCache(tuple); /* Call CreateComments() to create/drop the comments */ -@@ -1522,6 +1574,8 @@ CommentTSParser(List *qualname, char *comment) +@@ -1499,6 +1551,8 @@ CommentTSParser(List *qualname, char *comment) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("must be superuser to comment on text search parser"))); @@ -3192,7 +2995,7 @@ index 64792f2..6d71642 100644 CreateComments(prsId, TSParserRelationId, 0, comment); } -@@ -1536,6 +1590,8 @@ CommentTSDictionary(List *qualname, char *comment) +@@ -1513,6 +1567,8 @@ CommentTSDictionary(List *qualname, char *comment) if (!pg_ts_dict_ownercheck(dictId, GetUserId())) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSDICTIONARY, NameListToString(qualname)); @@ -3201,7 +3004,7 @@ index 64792f2..6d71642 100644 CreateComments(dictId, TSDictionaryRelationId, 0, comment); } -@@ -1551,6 +1607,8 @@ CommentTSTemplate(List *qualname, char *comment) +@@ -1528,6 +1584,8 @@ CommentTSTemplate(List *qualname, char *comment) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("must be superuser to comment on text search template"))); @@ -3210,7 +3013,7 @@ index 64792f2..6d71642 100644 CreateComments(tmplId, TSTemplateRelationId, 0, comment); } -@@ -1565,6 +1623,8 @@ CommentTSConfiguration(List *qualname, char *comment) +@@ -1542,6 +1600,8 @@ CommentTSConfiguration(List *qualname, char *comment) if (!pg_ts_config_ownercheck(cfgId, GetUserId())) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TSCONFIGURATION, NameListToString(qualname)); @@ -3220,7 +3023,7 @@ index 64792f2..6d71642 100644 CreateComments(cfgId, TSConfigRelationId, 0, comment); } diff --git a/src/backend/commands/conversioncmds.c b/src/backend/commands/conversioncmds.c -index 57ddab0..0c10a64 100644 +index 2e5a7df..9647622 100644 --- a/src/backend/commands/conversioncmds.c +++ b/src/backend/commands/conversioncmds.c @@ -24,6 +24,7 @@ @@ -3289,7 +3092,7 @@ index 57ddab0..0c10a64 100644 /* * Modify the owner --- okay to scribble on tup because it's a copy diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c -index 9d46e47..270eb74 100644 +index 4e95a83..a09eabe 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -22,7 +22,10 @@ @@ -3794,7 +3597,7 @@ index 9d46e47..270eb74 100644 /* diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c -index e7dac22..16360db 100644 +index 3d54324..3687922 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -35,6 +35,8 @@ @@ -3983,7 +3786,7 @@ index e7dac22..16360db 100644 /* * Helper functions diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c -index 0bda24a..334b123 100644 +index e8dba94..4c4fc36 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -257,7 +257,7 @@ ExplainResultDesc(ExplainStmt *stmt) @@ -3996,7 +3799,7 @@ index 0bda24a..334b123 100644 xml ? XMLOID : TEXTOID, -1, 0); return tupdesc; diff --git a/src/backend/commands/foreigncmds.c b/src/backend/commands/foreigncmds.c -index 14356a2..d1f255e 100644 +index abbe731..b36c928 100644 --- a/src/backend/commands/foreigncmds.c +++ b/src/backend/commands/foreigncmds.c @@ -27,6 +27,7 @@ @@ -4160,7 +3963,7 @@ index 14356a2..d1f255e 100644 * Do the deletion */ diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c -index 9a584ed..f914280 100644 +index 26a3a52..e2b8683 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -43,6 +43,7 @@ @@ -4337,10 +4140,10 @@ index 9a584ed..f914280 100644 ereport(ERROR, (errcode(ERRCODE_DUPLICATE_FUNCTION), diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c -index 94657b8..7cb3634 100644 +index 780dbc2..f471123 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c -@@ -39,6 +39,7 @@ +@@ -40,6 +40,7 @@ #include "parser/parse_func.h" #include "parser/parse_oper.h" #include "parser/parsetree.h" @@ -4348,7 +4151,7 @@ index 94657b8..7cb3634 100644 #include "storage/lmgr.h" #include "storage/proc.h" #include "storage/procarray.h" -@@ -242,6 +243,10 @@ DefineIndex(RangeVar *heapRelation, +@@ -243,6 +244,10 @@ DefineIndex(RangeVar *heapRelation, get_tablespace_name(tablespaceId)); } @@ -4359,7 +4162,7 @@ index 94657b8..7cb3634 100644 /* * Force shared indexes into the pg_global tablespace. This is a bit of a * hack but seems simpler than marking them in the BKI commands. On the -@@ -363,7 +368,9 @@ DefineIndex(RangeVar *heapRelation, +@@ -364,7 +369,9 @@ DefineIndex(RangeVar *heapRelation, errmsg("primary keys cannot be expressions"))); /* System attributes are never null, so no problem */ @@ -4370,7 +4173,7 @@ index 94657b8..7cb3634 100644 continue; atttuple = SearchSysCacheAttName(relationId, key->name); -@@ -1572,6 +1579,9 @@ ReindexIndex(RangeVar *indexRelation) +@@ -1600,6 +1607,9 @@ ReindexIndex(RangeVar *indexRelation) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_CLASS, indexRelation->relname); @@ -4380,7 +4183,7 @@ index 94657b8..7cb3634 100644 ReleaseSysCache(tuple); reindex_index(indOid, false); -@@ -1604,6 +1614,9 @@ ReindexTable(RangeVar *relation) +@@ -1632,6 +1642,9 @@ ReindexTable(RangeVar *relation) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_CLASS, relation->relname); @@ -4390,7 +4193,7 @@ index 94657b8..7cb3634 100644 ReleaseSysCache(tuple); if (!reindex_relation(heapOid, true, false)) -@@ -1642,6 +1655,9 @@ ReindexDatabase(const char *databaseName, bool do_system, bool do_user) +@@ -1670,6 +1683,9 @@ ReindexDatabase(const char *databaseName, bool do_system, bool do_user) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_DATABASE, databaseName); @@ -4401,7 +4204,7 @@ index 94657b8..7cb3634 100644 * Create a memory context that will survive forced transaction commits we * do below. Since it is a child of PortalContext, it will go away diff --git a/src/backend/commands/lockcmds.c b/src/backend/commands/lockcmds.c -index 283947a..657ff95 100644 +index 34d657c..d3c69a3 100644 --- a/src/backend/commands/lockcmds.c +++ b/src/backend/commands/lockcmds.c @@ -20,6 +20,7 @@ @@ -4423,7 +4226,7 @@ index 283947a..657ff95 100644 * If requested, recurse to children. We use find_inheritance_children * not find_all_inheritors to avoid taking locks far in advance of diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c -index ac0270f..25b84fd 100644 +index cae1a31..c946c5c 100644 --- a/src/backend/commands/opclasscmds.c +++ b/src/backend/commands/opclasscmds.c @@ -35,6 +35,7 @@ @@ -4571,7 +4374,7 @@ index ac0270f..25b84fd 100644 /* rename */ namestrcpy(&(((Form_pg_opfamily) GETSTRUCT(tup))->opfname), newname); simple_heap_update(rel, &tup->t_self, tup); -@@ -1990,6 +2029,8 @@ AlterOpClassOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId) +@@ -2011,6 +2050,8 @@ AlterOpClassOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId) aclcheck_error(aclresult, ACL_KIND_NAMESPACE, get_namespace_name(namespaceOid)); } @@ -4580,7 +4383,7 @@ index ac0270f..25b84fd 100644 /* * Modify the owner --- okay to scribble on tup because it's a copy -@@ -2112,7 +2153,8 @@ AlterOpFamilyOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId) +@@ -2154,7 +2195,8 @@ AlterOpFamilyOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId) aclcheck_error(aclresult, ACL_KIND_NAMESPACE, get_namespace_name(namespaceOid)); } @@ -4591,7 +4394,7 @@ index ac0270f..25b84fd 100644 * Modify the owner --- okay to scribble on tup because it's a copy */ diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c -index 9c07cf3..2e19448 100644 +index fa84a9b..36a4ac7 100644 --- a/src/backend/commands/operatorcmds.c +++ b/src/backend/commands/operatorcmds.c @@ -45,6 +45,7 @@ @@ -4602,7 +4405,7 @@ index 9c07cf3..2e19448 100644 #include "utils/acl.h" #include "utils/lsyscache.h" #include "utils/rel.h" -@@ -319,6 +320,9 @@ RemoveOperator(RemoveFuncStmt *stmt) +@@ -329,6 +330,9 @@ RemoveOperator(RemoveFuncStmt *stmt) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_OPER, NameListToString(operatorName)); @@ -4612,7 +4415,7 @@ index 9c07cf3..2e19448 100644 ReleaseSysCache(tup); /* -@@ -426,6 +430,8 @@ AlterOperatorOwner_internal(Relation rel, Oid operOid, Oid newOwnerId) +@@ -436,6 +440,8 @@ AlterOperatorOwner_internal(Relation rel, Oid operOid, Oid newOwnerId) aclcheck_error(aclresult, ACL_KIND_NAMESPACE, get_namespace_name(oprForm->oprnamespace)); } @@ -4622,7 +4425,7 @@ index 9c07cf3..2e19448 100644 /* * Modify the owner --- okay to scribble on tup because it's a copy diff --git a/src/backend/commands/prepare.c b/src/backend/commands/prepare.c -index e765382..a54dd3f 100644 +index 7fa8278..9b3662d 100644 --- a/src/backend/commands/prepare.c +++ b/src/backend/commands/prepare.c @@ -759,7 +759,7 @@ pg_prepared_statement(PG_FUNCTION_ARGS) @@ -4635,7 +4438,7 @@ index e765382..a54dd3f 100644 TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "statement", diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c -index 633a093..a3375b2 100644 +index 8292ae1..0ce601a 100644 --- a/src/backend/commands/proclang.c +++ b/src/backend/commands/proclang.c @@ -29,6 +29,7 @@ @@ -4677,7 +4480,7 @@ index 633a093..a3375b2 100644 } else diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c -index b0a9a22..57951fe 100644 +index b30fdce..8430e3e 100644 --- a/src/backend/commands/schemacmds.c +++ b/src/backend/commands/schemacmds.c @@ -21,10 +21,12 @@ @@ -4795,7 +4598,7 @@ index b0a9a22..57951fe 100644 + heap_close(rel, RowExclusiveLock); +} diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c -index f52e1d8..ecff05d 100644 +index 292a427..3c8a36f 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -26,6 +26,7 @@ @@ -4857,7 +4660,7 @@ index f52e1d8..ecff05d 100644 if (!seqrel->rd_islocaltemp) PreventCommandIfReadOnly("setval()"); diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c -index 9b5ce65..34ffbe2 100644 +index c4d81bb..9516700 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -32,6 +32,7 @@ @@ -4906,7 +4709,7 @@ index 9b5ce65..34ffbe2 100644 static void ATExecDropNotNull(Relation rel, const char *colName); static void ATExecSetNotNull(AlteredTableInfo *tab, Relation rel, const char *colName); -@@ -355,6 +360,7 @@ DefineRelation(CreateStmt *stmt, char relkind) +@@ -367,6 +372,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId) List *old_constraints; bool localHasOids; int parentOidCount; @@ -4914,7 +4717,7 @@ index 9b5ce65..34ffbe2 100644 List *rawDefaults; List *cookedDefaults; Datum reloptions; -@@ -362,6 +368,7 @@ DefineRelation(CreateStmt *stmt, char relkind) +@@ -374,6 +380,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId) AttrNumber attnum; static char *validnsps[] = HEAP_RELOPT_NAMESPACES; Oid ofTypeId; @@ -4922,7 +4725,7 @@ index 9b5ce65..34ffbe2 100644 /* * Truncate relname to appropriate length (probably a waste of time, as -@@ -461,7 +468,8 @@ DefineRelation(CreateStmt *stmt, char relkind) +@@ -477,7 +484,8 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId) */ schema = MergeAttributes(schema, stmt->inhRelations, stmt->relation->istemp, @@ -4932,7 +4735,7 @@ index 9b5ce65..34ffbe2 100644 /* * Create a tuple descriptor from the relation schema. Note that this -@@ -473,6 +481,16 @@ DefineRelation(CreateStmt *stmt, char relkind) +@@ -489,6 +497,16 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId) localHasOids = interpretOidsOption(stmt->options); descriptor->tdhasoid = (localHasOids || parentOidCount > 0); @@ -4949,7 +4752,7 @@ index 9b5ce65..34ffbe2 100644 /* * Find columns with default values and prepare for insertion of the * defaults. Pre-cooked (that is, inherited) defaults go into a list of -@@ -546,7 +564,8 @@ DefineRelation(CreateStmt *stmt, char relkind) +@@ -562,7 +580,8 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId) stmt->oncommit, reloptions, true, @@ -4959,7 +4762,7 @@ index 9b5ce65..34ffbe2 100644 StoreCatalogInheritance(relationId, inheritOids); -@@ -755,6 +774,9 @@ RemoveRelations(DropStmt *drop) +@@ -771,6 +790,9 @@ RemoveRelations(DropStmt *drop) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_CLASS, rel->relname); @@ -4969,7 +4772,7 @@ index 9b5ce65..34ffbe2 100644 if (!allowSystemTableMods && IsSystemClass(classform)) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), -@@ -918,6 +940,9 @@ ExecuteTruncate(TruncateStmt *stmt) +@@ -934,6 +956,9 @@ ExecuteTruncate(TruncateStmt *stmt) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_CLASS, RelationGetRelationName(seq_rel)); @@ -4979,7 +4782,7 @@ index 9b5ce65..34ffbe2 100644 seq_relids = lappend_oid(seq_relids, seq_relid); relation_close(seq_rel, NoLock); -@@ -1086,6 +1111,8 @@ truncate_check_rel(Relation rel) +@@ -1102,6 +1127,8 @@ truncate_check_rel(Relation rel) if (aclresult != ACLCHECK_OK) aclcheck_error(aclresult, ACL_KIND_CLASS, RelationGetRelationName(rel)); @@ -4988,7 +4791,7 @@ index 9b5ce65..34ffbe2 100644 if (!allowSystemTableMods && IsSystemRelation(rel)) ereport(ERROR, -@@ -1146,6 +1173,7 @@ storage_name(char c) +@@ -1162,6 +1189,7 @@ storage_name(char c) * 'supconstr' receives a list of constraints belonging to the parents, * updated as necessary to be valid for the child. * 'supOidCount' is set to the number of parents that have OID columns. @@ -4996,7 +4799,7 @@ index 9b5ce65..34ffbe2 100644 * * Return value: * Completed schema list. -@@ -1191,13 +1219,15 @@ storage_name(char c) +@@ -1207,13 +1235,15 @@ storage_name(char c) */ static List * MergeAttributes(List *schema, List *supers, bool istemp, @@ -5013,7 +4816,7 @@ index 9b5ce65..34ffbe2 100644 bool have_bogus_defaults = false; int child_attno; static Node bogus_marker = {0}; /* marks conflicting defaults */ -@@ -1325,6 +1355,8 @@ MergeAttributes(List *schema, List *supers, bool istemp, +@@ -1341,6 +1371,8 @@ MergeAttributes(List *schema, List *supers, bool istemp, if (relation->rd_rel->relhasoids) parentsWithOids++; @@ -5022,7 +4825,7 @@ index 9b5ce65..34ffbe2 100644 tupleDesc = RelationGetDescr(relation); constr = tupleDesc->constr; -@@ -1626,6 +1658,7 @@ MergeAttributes(List *schema, List *supers, bool istemp, +@@ -1642,6 +1674,7 @@ MergeAttributes(List *schema, List *supers, bool istemp, *supOids = parentOids; *supconstr = constraints; *supOidCount = parentsWithOids; @@ -5030,7 +4833,7 @@ index 9b5ce65..34ffbe2 100644 return schema; } -@@ -1985,6 +2018,9 @@ renameatt(Oid myrelid, +@@ -2001,6 +2034,9 @@ renameatt(Oid myrelid, errmsg("permission denied: \"%s\" is a system catalog", RelationGetRelationName(targetrelation)))); @@ -5040,7 +4843,7 @@ index 9b5ce65..34ffbe2 100644 /* * if the 'recurse' flag is set then we are supposed to rename this * attribute in all classes that inherit from 'relname' (as well as in -@@ -2136,6 +2172,9 @@ RenameRelation(Oid myrelid, const char *newrelname, ObjectType reltype) +@@ -2152,6 +2188,9 @@ RenameRelation(Oid myrelid, const char *newrelname, ObjectType reltype) errmsg("\"%s\" is not a view", RelationGetRelationName(targetrelation)))); @@ -5050,7 +4853,7 @@ index 9b5ce65..34ffbe2 100644 /* * Don't allow ALTER TABLE on composite types. We want people to use ALTER * TYPE for that. -@@ -2566,6 +2605,27 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, +@@ -2580,6 +2619,27 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, } pass = AT_PASS_DROP; break; @@ -5078,7 +4881,7 @@ index 9b5ce65..34ffbe2 100644 case AT_SetTableSpace: /* SET TABLESPACE */ ATSimplePermissionsRelationOrIndex(rel); /* This command never recurses */ -@@ -2690,7 +2750,7 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, +@@ -2709,7 +2769,7 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, case AT_AddColumn: /* ADD COLUMN */ case AT_AddColumnToView: /* add column via CREATE OR REPLACE * VIEW */ @@ -5087,7 +4890,7 @@ index 9b5ce65..34ffbe2 100644 break; case AT_ColumnDefault: /* ALTER COLUMN DEFAULT */ ATExecColumnDefault(rel, cmd->name, cmd->def); -@@ -2762,17 +2822,22 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, +@@ -2781,17 +2841,22 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, case AT_AddOids: /* SET WITH OIDS */ /* Use the ADD COLUMN code, unless prep decided to do nothing */ if (cmd->def != NULL) @@ -5113,7 +4916,7 @@ index 9b5ce65..34ffbe2 100644 /* * Nothing to do here; Phase 3 does the work */ -@@ -3126,6 +3191,7 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) +@@ -3145,6 +3210,7 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) MemoryContext oldCxt; List *dropped_attrs = NIL; ListCell *lc; @@ -5121,7 +4924,7 @@ index 9b5ce65..34ffbe2 100644 econtext = GetPerTupleExprContext(estate); -@@ -3156,6 +3222,19 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) +@@ -3175,6 +3241,19 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) } /* @@ -5141,7 +4944,7 @@ index 9b5ce65..34ffbe2 100644 * Scan through the rows, generating a new row if needed and then * checking all the constraints. */ -@@ -3172,11 +3251,16 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) +@@ -3191,11 +3270,16 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) if (newrel) { Oid tupOid = InvalidOid; @@ -5158,7 +4961,7 @@ index 9b5ce65..34ffbe2 100644 /* Set dropped attributes to null in new tuple */ foreach(lc, dropped_attrs) -@@ -3208,6 +3292,9 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) +@@ -3227,6 +3311,9 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) /* Preserve OID, if any */ if (newTupDesc->tdhasoid) HeapTupleSetOid(tuple, tupOid); @@ -5168,7 +4971,7 @@ index 9b5ce65..34ffbe2 100644 } /* Now check any constraints on the possibly-changed tuple */ -@@ -3601,7 +3688,7 @@ ATPrepAddColumn(List **wqueue, Relation rel, bool recurse, +@@ -3625,7 +3712,7 @@ ATPrepAddColumn(List **wqueue, Relation rel, bool recurse, static void ATExecAddColumn(AlteredTableInfo *tab, Relation rel, @@ -5177,24 +4980,18 @@ index 9b5ce65..34ffbe2 100644 { Oid myrelid = RelationGetRelid(rel); Relation pgclass, -@@ -3615,12 +3702,16 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, +@@ -3639,6 +3726,10 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, int32 typmod; Form_pg_type tform; Expr *defval; + Oid securityId; - - if (rel->rd_rel->reloftype) - ereport(ERROR, - (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("cannot add column to typed table"))); - ++ + /* SELinux permission check */ + securityId = sepgsql_attribute_create(myrelid, colDef->colname); -+ + attrdesc = heap_open(AttributeRelationId, RowExclusiveLock); - /* -@@ -3648,6 +3739,13 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, +@@ -3667,6 +3758,13 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, errmsg("child table \"%s\" has different type for column \"%s\"", RelationGetRelationName(rel), colDef->colname))); @@ -5208,7 +5005,7 @@ index 9b5ce65..34ffbe2 100644 /* If it's OID, child column must actually be OID */ if (isOid && childatt->attnum != ObjectIdAttributeNumber) ereport(ERROR, -@@ -3655,6 +3753,13 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, +@@ -3674,6 +3772,13 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, errmsg("child table \"%s\" has a conflicting \"%s\" column", RelationGetRelationName(rel), colDef->colname))); @@ -5222,7 +5019,7 @@ index 9b5ce65..34ffbe2 100644 /* Bump the existing child att's inhcount */ childatt->attinhcount++; simple_heap_update(attrdesc, &tuple->t_self, tuple); -@@ -3694,6 +3799,8 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, +@@ -3713,6 +3818,8 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, /* Determine the new attribute's number */ if (isOid) newattnum = ObjectIdAttributeNumber; @@ -5231,7 +5028,7 @@ index 9b5ce65..34ffbe2 100644 else { newattnum = ((Form_pg_class) GETSTRUCT(reltup))->relnatts + 1; -@@ -3733,7 +3840,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, +@@ -3752,7 +3859,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, ReleaseSysCache(typeTuple); @@ -5240,7 +5037,7 @@ index 9b5ce65..34ffbe2 100644 heap_close(attrdesc, RowExclusiveLock); -@@ -3742,6 +3849,8 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, +@@ -3761,6 +3868,8 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, */ if (isOid) ((Form_pg_class) GETSTRUCT(reltup))->relhasoids = true; @@ -5249,7 +5046,7 @@ index 9b5ce65..34ffbe2 100644 else ((Form_pg_class) GETSTRUCT(reltup))->relnatts = newattnum; -@@ -3853,7 +3962,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, +@@ -3872,7 +3981,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, * If we are adding an OID column, we have to tell Phase 3 to rewrite the * table to fix that. */ @@ -5258,7 +5055,7 @@ index 9b5ce65..34ffbe2 100644 tab->new_changeoids = true; /* -@@ -3906,6 +4015,31 @@ ATPrepAddOids(List **wqueue, Relation rel, bool recurse, AlterTableCmd *cmd) +@@ -3925,6 +4034,31 @@ ATPrepAddOids(List **wqueue, Relation rel, bool recurse, AlterTableCmd *cmd) } /* @@ -5290,7 +5087,7 @@ index 9b5ce65..34ffbe2 100644 * ALTER TABLE ALTER COLUMN DROP NOT NULL */ static void -@@ -3917,6 +4051,9 @@ ATExecDropNotNull(Relation rel, const char *colName) +@@ -3936,6 +4070,9 @@ ATExecDropNotNull(Relation rel, const char *colName) List *indexoidlist; ListCell *indexoidscan; @@ -5300,7 +5097,7 @@ index 9b5ce65..34ffbe2 100644 /* * lookup the attribute */ -@@ -4007,6 +4144,9 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel, +@@ -4026,6 +4163,9 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel, AttrNumber attnum; Relation attr_rel; @@ -5310,7 +5107,7 @@ index 9b5ce65..34ffbe2 100644 /* * lookup the attribute */ -@@ -4057,6 +4197,9 @@ ATExecColumnDefault(Relation rel, const char *colName, +@@ -4076,6 +4216,9 @@ ATExecColumnDefault(Relation rel, const char *colName, { AttrNumber attnum; @@ -5320,7 +5117,7 @@ index 9b5ce65..34ffbe2 100644 /* * get the number of the attribute */ -@@ -4131,6 +4274,9 @@ ATExecSetStatistics(Relation rel, const char *colName, Node *newValue) +@@ -4150,6 +4293,9 @@ ATExecSetStatistics(Relation rel, const char *colName, Node *newValue) HeapTuple tuple; Form_pg_attribute attrtuple; @@ -5330,7 +5127,7 @@ index 9b5ce65..34ffbe2 100644 Assert(IsA(newValue, Integer)); newtarget = intVal(newValue); -@@ -4197,6 +4343,9 @@ ATExecSetOptions(Relation rel, const char *colName, Node *options, +@@ -4216,6 +4362,9 @@ ATExecSetOptions(Relation rel, const char *colName, Node *options, bool repl_null[Natts_pg_attribute]; bool repl_repl[Natts_pg_attribute]; @@ -5340,7 +5137,7 @@ index 9b5ce65..34ffbe2 100644 attrelation = heap_open(AttributeRelationId, RowExclusiveLock); tuple = SearchSysCacheAttName(RelationGetRelid(rel), colName); -@@ -4256,6 +4405,9 @@ ATExecSetStorage(Relation rel, const char *colName, Node *newValue) +@@ -4275,6 +4424,9 @@ ATExecSetStorage(Relation rel, const char *colName, Node *newValue) HeapTuple tuple; Form_pg_attribute attrtuple; @@ -5350,7 +5147,7 @@ index 9b5ce65..34ffbe2 100644 Assert(IsA(newValue, String)); storagemode = strVal(newValue); -@@ -4346,6 +4498,9 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, +@@ -4373,6 +4525,9 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, if (recursing) ATSimplePermissions(rel, false); @@ -5360,7 +5157,7 @@ index 9b5ce65..34ffbe2 100644 /* * get the number of the attribute */ -@@ -4371,8 +4526,10 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, +@@ -4398,8 +4553,10 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, attnum = targetatt->attnum; @@ -5373,7 +5170,7 @@ index 9b5ce65..34ffbe2 100644 ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot drop system column \"%s\"", -@@ -4488,7 +4645,8 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, +@@ -4515,7 +4672,8 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, * If we dropped the OID column, must adjust pg_class.relhasoids and tell * Phase 3 to physically get rid of the column. */ @@ -5383,7 +5180,7 @@ index 9b5ce65..34ffbe2 100644 { Relation class_rel; Form_pg_class tuple_class; -@@ -4503,7 +4661,11 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, +@@ -4530,7 +4688,11 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, RelationGetRelid(rel)); tuple_class = (Form_pg_class) GETSTRUCT(tuple); @@ -5396,7 +5193,7 @@ index 9b5ce65..34ffbe2 100644 simple_heap_update(class_rel, &tuple->t_self, tuple); /* Keep the catalog indexes up to date */ -@@ -4650,6 +4812,9 @@ ATAddCheckConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel, +@@ -4677,6 +4839,9 @@ ATAddCheckConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel, if (recursing) ATSimplePermissions(rel, false); @@ -5406,7 +5203,7 @@ index 9b5ce65..34ffbe2 100644 /* * Call AddRelationNewConstraints to do the work, making sure it works on * a copy of the Constraint so transformExpr can't modify the original. It -@@ -4847,6 +5012,9 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel, +@@ -4883,6 +5048,9 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel, checkFkeyPermissions(pkrel, pkattnum, numpks); checkFkeyPermissions(rel, fkattnum, numfks); @@ -5416,7 +5213,7 @@ index 9b5ce65..34ffbe2 100644 /* * Look up the equality operators to use in the constraint. * -@@ -5592,6 +5760,9 @@ ATExecDropConstraint(Relation rel, const char *constrName, +@@ -5628,6 +5796,9 @@ ATExecDropConstraint(Relation rel, const char *constrName, if (recursing) ATSimplePermissions(rel, false); @@ -5426,7 +5223,7 @@ index 9b5ce65..34ffbe2 100644 conrel = heap_open(ConstraintRelationId, RowExclusiveLock); /* -@@ -5924,6 +6095,9 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, +@@ -5965,6 +6136,9 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, SysScanDesc scan; HeapTuple depTup; @@ -5436,7 +5233,7 @@ index 9b5ce65..34ffbe2 100644 attrelation = heap_open(AttributeRelationId, RowExclusiveLock); /* Look up the target column */ -@@ -6537,6 +6711,8 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing) +@@ -6578,6 +6752,8 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing) aclcheck_error(aclresult, ACL_KIND_NAMESPACE, get_namespace_name(namespaceOid)); } @@ -5445,7 +5242,7 @@ index 9b5ce65..34ffbe2 100644 } memset(repl_null, false, sizeof(repl_null)); -@@ -6702,6 +6878,9 @@ ATExecClusterOn(Relation rel, const char *indexName) +@@ -6743,6 +6919,9 @@ ATExecClusterOn(Relation rel, const char *indexName) { Oid indexOid; @@ -5455,7 +5252,7 @@ index 9b5ce65..34ffbe2 100644 indexOid = get_relname_relid(indexName, rel->rd_rel->relnamespace); if (!OidIsValid(indexOid)) -@@ -6726,6 +6905,9 @@ ATExecClusterOn(Relation rel, const char *indexName) +@@ -6767,6 +6946,9 @@ ATExecClusterOn(Relation rel, const char *indexName) static void ATExecDropCluster(Relation rel) { @@ -5465,7 +5262,7 @@ index 9b5ce65..34ffbe2 100644 mark_index_clustered(rel, InvalidOid); } -@@ -6776,6 +6958,9 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset) +@@ -6817,6 +6999,9 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset) bool repl_repl[Natts_pg_class]; static char *validnsps[] = HEAP_RELOPT_NAMESPACES; @@ -5475,7 +5272,7 @@ index 9b5ce65..34ffbe2 100644 if (defList == NIL) return; /* nothing to do */ -@@ -7090,6 +7275,9 @@ static void +@@ -7145,6 +7330,9 @@ static void ATExecEnableDisableTrigger(Relation rel, char *trigname, char fires_when, bool skip_system) { @@ -5485,7 +5282,7 @@ index 9b5ce65..34ffbe2 100644 EnableDisableTrigger(rel, trigname, fires_when, skip_system); } -@@ -7102,6 +7290,9 @@ static void +@@ -7157,6 +7345,9 @@ static void ATExecEnableDisableRule(Relation rel, char *trigname, char fires_when) { @@ -5495,7 +5292,7 @@ index 9b5ce65..34ffbe2 100644 EnableDisableRule(rel, trigname, fires_when); } -@@ -7135,6 +7326,10 @@ ATExecAddInherit(Relation child_rel, RangeVar *parent) +@@ -7199,6 +7390,10 @@ ATExecAddInherit(Relation child_rel, RangeVar *parent) */ ATSimplePermissions(parent_rel, false); @@ -5506,7 +5303,7 @@ index 9b5ce65..34ffbe2 100644 /* Permanent rels cannot inherit from temporary ones */ if (parent_rel->rd_istemp && !child_rel->rd_istemp) ereport(ERROR, -@@ -7487,6 +7682,9 @@ ATExecDropInherit(Relation rel, RangeVar *parent) +@@ -7551,6 +7746,9 @@ ATExecDropInherit(Relation rel, RangeVar *parent) List *connames; bool found = false; @@ -5516,7 +5313,7 @@ index 9b5ce65..34ffbe2 100644 /* * AccessShareLock on the parent is probably enough, seeing that DROP * TABLE doesn't lock parent tables at all. We need some lock since we'll -@@ -7784,6 +7982,9 @@ AlterTableNamespace(RangeVar *relation, const char *newschema, +@@ -7848,6 +8046,9 @@ AlterTableNamespace(RangeVar *relation, const char *newschema, /* get schema OID and check its permissions */ nspOid = LookupCreationNamespace(newschema); @@ -5526,7 +5323,7 @@ index 9b5ce65..34ffbe2 100644 if (oldNspOid == nspOid) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_TABLE), -@@ -7981,6 +8182,282 @@ AlterSeqNamespaces(Relation classRel, Relation rel, +@@ -8045,6 +8246,282 @@ AlterSeqNamespaces(Relation classRel, Relation rel, relation_close(depRel, AccessShareLock); } @@ -5810,7 +5607,7 @@ index 9b5ce65..34ffbe2 100644 /* * This code supports diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c -index 862cd2d..8ea4118 100644 +index 4c57a73..ce0bb99 100644 --- a/src/backend/commands/tablespace.c +++ b/src/backend/commands/tablespace.c @@ -65,6 +65,7 @@ @@ -5858,7 +5655,7 @@ index 862cd2d..8ea4118 100644 /* Disallow drop of the standard tablespaces, even by superuser */ if (tablespaceoid == GLOBALTABLESPACE_OID || tablespaceoid == DEFAULTTABLESPACE_OID) -@@ -787,6 +797,9 @@ RenameTableSpace(const char *oldname, const char *newname) +@@ -817,6 +827,9 @@ RenameTableSpace(const char *oldname, const char *newname) if (!pg_tablespace_ownercheck(HeapTupleGetOid(newtuple), GetUserId())) aclcheck_error(ACLCHECK_NO_PRIV, ACL_KIND_TABLESPACE, oldname); @@ -5868,7 +5665,7 @@ index 862cd2d..8ea4118 100644 /* Validate new name */ if (!allowSystemTableMods && IsReservedName(newname)) ereport(ERROR, -@@ -868,6 +881,9 @@ AlterTableSpaceOwner(const char *name, Oid newOwnerId) +@@ -898,6 +911,9 @@ AlterTableSpaceOwner(const char *name, Oid newOwnerId) /* Must be able to become new owner */ check_is_member_of_role(GetUserId(), newOwnerId); @@ -5878,7 +5675,7 @@ index 862cd2d..8ea4118 100644 /* * Normally we would also check for create permissions here, but there * are none for tablespaces so we follow what rename tablespace does -@@ -985,6 +1001,54 @@ AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt) +@@ -1015,6 +1031,54 @@ AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt) } /* @@ -5934,7 +5731,7 @@ index 862cd2d..8ea4118 100644 */ diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c -index 2cbc192..2ea9e6e 100644 +index 251c3e8..2f7d3d5 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -40,6 +40,7 @@ @@ -5977,7 +5774,7 @@ index 2cbc192..2ea9e6e 100644 * Grab an exclusive lock on the target table, which we will NOT release * until end of transaction. diff --git a/src/backend/commands/tsearchcmds.c b/src/backend/commands/tsearchcmds.c -index ba3de63..19bebb4 100644 +index 522ea6e..8c6e0d3 100644 --- a/src/backend/commands/tsearchcmds.c +++ b/src/backend/commands/tsearchcmds.c @@ -35,6 +35,7 @@ @@ -6222,7 +6019,7 @@ index ba3de63..19bebb4 100644 /* Add or drop mappings */ diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c -index 1e14dca..f7429f0 100644 +index abde562..a5cf445 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -56,6 +56,7 @@ @@ -6529,7 +6326,7 @@ index 1e14dca..f7429f0 100644 + ReleaseSysCache(typtup); +} diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c -index 2f0788e..8de31ae 100644 +index cdf7dc5..f6aee43 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -21,11 +21,13 @@ @@ -6621,24 +6418,21 @@ index 2f0788e..8de31ae 100644 pg_authmem_rel = heap_open(AuthMemRelationId, RowExclusiveLock); pg_authmem_dsc = RelationGetDescr(pg_authmem_rel); diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c -index 49a206e..4646c41 100644 +index e77430e..3dfc7d4 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c -@@ -980,6 +980,12 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound, - relation_close(onerel, NoLock); - - /* -+ * VACUUM FULL also reclaim orphan security labels, if exist -+ */ -+ if (vacstmt->options & VACOPT_FULL) +@@ -957,6 +957,9 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound, + */ + if (vacstmt->options & VACOPT_FULL) + { ++ /* Also reclaim unreferenced security labels */ + seclabelRelationReclaim(relid); + -+ /* - * Complete the transaction and free all temporary memory used. - */ - PopActiveSnapshot(); + /* close relation before vacuuming, but hold lock until commit */ + relation_close(onerel, NoLock); + onerel = NULL; diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c -index d7a06bc..5480c83 100644 +index c291529..dd0b12a 100644 --- a/src/backend/commands/view.c +++ b/src/backend/commands/view.c @@ -28,6 +28,7 @@ @@ -6660,7 +6454,7 @@ index d7a06bc..5480c83 100644 CheckTableNotInUse(rel, "CREATE OR REPLACE VIEW"); diff --git a/src/backend/executor/execJunk.c b/src/backend/executor/execJunk.c -index 5e555ad..963096d 100644 +index 2fa7e68..c2b926c 100644 --- a/src/backend/executor/execJunk.c +++ b/src/backend/executor/execJunk.c @@ -58,7 +58,8 @@ @@ -6683,7 +6477,7 @@ index 5e555ad..963096d 100644 /* * Use the given slot, or make a new slot if we weren't given one. diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c -index d299310..febb02e 100644 +index 0b6cbcc..fbce8e4 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -38,6 +38,7 @@ @@ -6818,7 +6612,7 @@ index d299310..febb02e 100644 heap_insert(myState->rel, tuple, diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c -index 005e15e..6e93932 100644 +index bfcce0f..a07b314 100644 --- a/src/backend/executor/execQual.c +++ b/src/backend/executor/execQual.c @@ -49,6 +49,7 @@ @@ -6857,7 +6651,7 @@ index 005e15e..6e93932 100644 TupleDescInitEntry(tupdesc, (AttrNumber) 1, "column", -@@ -4108,6 +4112,9 @@ ExecEvalArrayCoerceExpr(ArrayCoerceExprState *astate, +@@ -4118,6 +4122,9 @@ ExecEvalArrayCoerceExpr(ArrayCoerceExprState *astate, aclcheck_error(aclresult, ACL_KIND_PROC, get_func_name(acoerce->elemfuncid)); @@ -6868,7 +6662,7 @@ index 005e15e..6e93932 100644 fmgr_info_cxt(acoerce->elemfuncid, &(astate->elemfunc), econtext->ecxt_per_query_memory); diff --git a/src/backend/executor/execScan.c b/src/backend/executor/execScan.c -index 53fe195..68f790f 100644 +index fa5ff2d..fb9093c 100644 --- a/src/backend/executor/execScan.c +++ b/src/backend/executor/execScan.c @@ -20,6 +20,7 @@ @@ -6939,7 +6733,7 @@ index 53fe195..68f790f 100644 return true; } diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c -index 1caf976..64f6468 100644 +index e2ee706..d4d216b 100644 --- a/src/backend/executor/execTuples.c +++ b/src/backend/executor/execTuples.c @@ -98,7 +98,7 @@ @@ -7000,7 +6794,7 @@ index 1caf976..64f6468 100644 foreach(l, exprList) { diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c -index 98e4a64..14f9404 100644 +index 5886c1b..50f91f5 100644 --- a/src/backend/executor/execUtils.c +++ b/src/backend/executor/execUtils.c @@ -444,6 +444,7 @@ void @@ -7029,7 +6823,7 @@ index 98e4a64..14f9404 100644 } diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c -index d552698..ed1913f 100644 +index ea2cfc9..7b489db 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -1153,7 +1153,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, @@ -7060,7 +6854,7 @@ index d552698..ed1913f 100644 } Assert(tupdesc); diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c -index ddd91fc..cfb685e 100644 +index 74fc87a..4b222b1 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -89,6 +89,7 @@ @@ -7090,7 +6884,7 @@ index ddd91fc..cfb685e 100644 /* Create slot we're going to do argument evaluation in */ peraggstate->evalslot = ExecInitExtraTupleSlot(estate); diff --git a/src/backend/executor/nodeFunctionscan.c b/src/backend/executor/nodeFunctionscan.c -index 66e6b74..a31907c 100644 +index 6989961..471653f 100644 --- a/src/backend/executor/nodeFunctionscan.c +++ b/src/backend/executor/nodeFunctionscan.c @@ -178,7 +178,7 @@ ExecInitFunctionScan(FunctionScan *node, EState *estate, int eflags) @@ -7103,7 +6897,7 @@ index 66e6b74..a31907c 100644 (AttrNumber) 1, attname, diff --git a/src/backend/executor/nodeMergejoin.c b/src/backend/executor/nodeMergejoin.c -index ca6b0f8..b5c79d0 100644 +index 948f580..7d9f4f4 100644 --- a/src/backend/executor/nodeMergejoin.c +++ b/src/backend/executor/nodeMergejoin.c @@ -98,6 +98,7 @@ @@ -7114,7 +6908,7 @@ index ca6b0f8..b5c79d0 100644 #include "utils/acl.h" #include "utils/lsyscache.h" #include "utils/memutils.h" -@@ -216,6 +217,9 @@ MJExamineQuals(List *mergeclauses, +@@ -224,6 +225,9 @@ MJExamineQuals(List *mergeclauses, aclcheck_error(aclresult, ACL_KIND_PROC, get_func_name(cmpproc)); @@ -7125,7 +6919,7 @@ index ca6b0f8..b5c79d0 100644 fmgr_info(cmpproc, &(clause->cmpfinfo)); diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c -index 7856b66..eee2739 100644 +index 9699381..03afb4e 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -38,11 +38,13 @@ @@ -7252,10 +7046,10 @@ index 7856b66..eee2739 100644 { + Oid securityId = InvalidOid; + - planSlot = ExecProcNode(subplanstate); - - if (TupIsNull(planSlot)) -@@ -705,6 +760,14 @@ ExecModifyTable(ModifyTableState *node) + /* + * Reset the per-output-tuple exprcontext. This is needed because + * triggers expect to use that context as workspace. It's a bit ugly +@@ -713,6 +768,14 @@ ExecModifyTable(ModifyTableState *node) if (junkfilter != NULL) { @@ -7270,7 +7064,7 @@ index 7856b66..eee2739 100644 /* * extract the 'ctid' junk attribute. */ -@@ -734,11 +797,11 @@ ExecModifyTable(ModifyTableState *node) +@@ -742,11 +805,11 @@ ExecModifyTable(ModifyTableState *node) switch (operation) { case CMD_INSERT: @@ -7284,7 +7078,7 @@ index 7856b66..eee2739 100644 break; case CMD_DELETE: slot = ExecDelete(tupleid, planSlot, -@@ -850,7 +913,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) +@@ -858,7 +921,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) * RETURNING list. We assume the rest will look the same. */ tupDesc = ExecTypeFromTL((List *) linitial(node->returningLists), @@ -7293,7 +7087,7 @@ index 7856b66..eee2739 100644 /* Set up a slot for the output of the RETURNING projection(s) */ ExecInitResultTupleSlot(estate, &mtstate->ps); -@@ -884,7 +947,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) +@@ -892,7 +955,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) * We still must construct a dummy result tuple type, because InitPlan * expects one (maybe should change that?). */ @@ -7302,7 +7096,7 @@ index 7856b66..eee2739 100644 ExecInitResultTupleSlot(estate, &mtstate->ps); ExecAssignResultType(&mtstate->ps, tupDesc); -@@ -976,6 +1039,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) +@@ -984,6 +1047,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) j = ExecInitJunkFilter(subplan->targetlist, resultRelInfo->ri_RelationDesc->rd_att->tdhasoid, @@ -7311,7 +7105,7 @@ index 7856b66..eee2739 100644 if (operation == CMD_UPDATE || operation == CMD_DELETE) diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c -index 9f1ff16..bef704b 100644 +index d397b13..90e2e65 100644 --- a/src/backend/executor/nodeSubplan.c +++ b/src/backend/executor/nodeSubplan.c @@ -859,7 +859,7 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent) @@ -7333,7 +7127,7 @@ index 9f1ff16..bef704b 100644 ExecSetSlotDescriptor(slot, tupDesc); sstate->projRight = ExecBuildProjectionInfo(righttlist, diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c -index 712bab1..e69f3c7 100644 +index de6d038..2ee0a8f 100644 --- a/src/backend/executor/nodeWindowAgg.c +++ b/src/backend/executor/nodeWindowAgg.c @@ -43,6 +43,7 @@ @@ -7358,7 +7152,7 @@ index 712bab1..e69f3c7 100644 perfuncstate->wfuncstate = wfuncstate; perfuncstate->wfunc = wfunc; diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c -index 7f0b5e4..2e2c63b 100644 +index 1ffb1b2..623b2dd 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -767,6 +767,8 @@ SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum, @@ -7417,7 +7211,7 @@ index 7f0b5e4..2e2c63b 100644 char * diff --git a/src/backend/libpq/be-fsstubs.c b/src/backend/libpq/be-fsstubs.c -index f4f50f8..4ab5698 100644 +index 464183d..67d0316 100644 --- a/src/backend/libpq/be-fsstubs.c +++ b/src/backend/libpq/be-fsstubs.c @@ -46,6 +46,7 @@ @@ -7580,10 +7374,10 @@ index f4f50f8..4ab5698 100644 PG_RETURN_INT32(0); diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c -index e770e89..9642a66 100644 +index 3e237c1..387d85d 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c -@@ -1823,6 +1823,7 @@ _copyRangeTblEntry(RangeTblEntry *from) +@@ -1824,6 +1824,7 @@ _copyRangeTblEntry(RangeTblEntry *from) COPY_SCALAR_FIELD(checkAsUser); COPY_BITMAPSET_FIELD(selectedCols); COPY_BITMAPSET_FIELD(modifiedCols); @@ -7591,7 +7385,7 @@ index e770e89..9642a66 100644 return newnode; } -@@ -2755,6 +2756,21 @@ _copyAlterOwnerStmt(AlterOwnerStmt *from) +@@ -2756,6 +2757,21 @@ _copyAlterOwnerStmt(AlterOwnerStmt *from) return newnode; } @@ -7613,7 +7407,7 @@ index e770e89..9642a66 100644 static RuleStmt * _copyRuleStmt(RuleStmt *from) { -@@ -3968,6 +3984,9 @@ copyObject(void *from) +@@ -3970,6 +3986,9 @@ copyObject(void *from) case T_AlterOwnerStmt: retval = _copyAlterOwnerStmt(from); break; @@ -7624,7 +7418,7 @@ index e770e89..9642a66 100644 retval = _copyRuleStmt(from); break; diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c -index 5d83727..fd4071d 100644 +index dc5f883..33f2f5d 100644 --- a/src/backend/nodes/equalfuncs.c +++ b/src/backend/nodes/equalfuncs.c @@ -1308,6 +1308,19 @@ _equalAlterOwnerStmt(AlterOwnerStmt *a, AlterOwnerStmt *b) @@ -7647,7 +7441,7 @@ index 5d83727..fd4071d 100644 _equalRuleStmt(RuleStmt *a, RuleStmt *b) { COMPARE_NODE_FIELD(relation); -@@ -2186,6 +2199,7 @@ _equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b) +@@ -2187,6 +2200,7 @@ _equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b) COMPARE_SCALAR_FIELD(checkAsUser); COMPARE_BITMAPSET_FIELD(selectedCols); COMPARE_BITMAPSET_FIELD(modifiedCols); @@ -7655,7 +7449,7 @@ index 5d83727..fd4071d 100644 return true; } -@@ -2657,6 +2671,9 @@ equal(void *a, void *b) +@@ -2658,6 +2672,9 @@ equal(void *a, void *b) case T_AlterOwnerStmt: retval = _equalAlterOwnerStmt(a, b); break; @@ -7666,10 +7460,10 @@ index 5d83727..fd4071d 100644 retval = _equalRuleStmt(a, b); break; diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c -index e7dae4b..4e8b350 100644 +index 48c0888..34632d2 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c -@@ -2135,6 +2135,7 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node) +@@ -2136,6 +2136,7 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node) WRITE_OID_FIELD(checkAsUser); WRITE_BITMAPSET_FIELD(selectedCols); WRITE_BITMAPSET_FIELD(modifiedCols); @@ -7678,7 +7472,7 @@ index e7dae4b..4e8b350 100644 static void diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c -index bc6e2a6..792b9ff 100644 +index f28191d..f6f31e5 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -1171,6 +1171,7 @@ _readRangeTblEntry(void) @@ -7690,7 +7484,7 @@ index bc6e2a6..792b9ff 100644 READ_DONE(); } diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c -index 3950ab4..18e5d80 100644 +index 317a7e8..5b88ad6 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -39,6 +39,7 @@ @@ -7719,7 +7513,7 @@ index 3950ab4..18e5d80 100644 * pullup (so that all non-inherited RTEs are present) and before * inheritance expansion (so that the info is available for diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c -index e525ba6..6474fbc 100644 +index 8486516..acd6bac 100644 --- a/src/backend/optimizer/util/clauses.c +++ b/src/backend/optimizer/util/clauses.c @@ -38,6 +38,7 @@ @@ -7730,7 +7524,7 @@ index e525ba6..6474fbc 100644 #include "tcop/tcopprot.h" #include "utils/acl.h" #include "utils/builtins.h" -@@ -3712,6 +3713,10 @@ inline_function(Oid funcid, Oid result_type, List *args, +@@ -3724,6 +3725,10 @@ inline_function(Oid funcid, Oid result_type, List *args, if (pg_proc_aclcheck(funcid, GetUserId(), ACL_EXECUTE) != ACLCHECK_OK) return NULL; @@ -7741,7 +7535,7 @@ index e525ba6..6474fbc 100644 /* * Make a temporary memory context, so that we don't leak all the stuff * that parsing might create. -@@ -4164,7 +4169,8 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte) +@@ -4176,7 +4181,8 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte) funcform->provolatile == PROVOLATILE_VOLATILE || funcform->prosecdef || !funcform->proretset || @@ -7752,7 +7546,7 @@ index e525ba6..6474fbc 100644 ReleaseSysCache(func_tuple); return NULL; diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c -index 6b99a10..4eb9d24 100644 +index 1576613..51e197f 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -25,6 +25,7 @@ @@ -7781,7 +7575,7 @@ index 6b99a10..4eb9d24 100644 rte->modifiedCols = bms_add_member(rte->modifiedCols, diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y -index b793c4d..866e0ba 100644 +index 50ed871..d6b13da 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -183,8 +183,8 @@ static TypeName *TableFuncTypeName(List *columns); @@ -7842,7 +7636,7 @@ index b793c4d..866e0ba 100644 /* ALTER TABLE CLUSTER ON */ | CLUSTER ON name { -@@ -6022,6 +6039,102 @@ AlterOwnerStmt: ALTER AGGREGATE func_name aggr_args OWNER TO RoleId +@@ -6027,6 +6044,102 @@ AlterOwnerStmt: ALTER AGGREGATE func_name aggr_args OWNER TO RoleId } ; @@ -7945,7 +7739,7 @@ index b793c4d..866e0ba 100644 /***************************************************************************** * -@@ -10921,6 +11034,7 @@ unreserved_keyword: +@@ -10922,6 +11035,7 @@ unreserved_keyword: | INVOKER | ISOLATION | KEY @@ -7954,7 +7748,7 @@ index b793c4d..866e0ba 100644 | LARGE_P | LAST_P diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c -index 38c7e91..fbc4e9f 100644 +index 1d0fc82..7ad1eeb 100644 --- a/src/backend/parser/parse_relation.c +++ b/src/backend/parser/parse_relation.c @@ -2302,8 +2302,8 @@ specialAttNum(const char *attname) @@ -7991,7 +7785,7 @@ index 38c7e91..fbc4e9f 100644 } if (attid > rd->rd_att->natts) diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c -index e542dc0..8191f94 100644 +index 7e04a94..da10dc7 100644 --- a/src/backend/parser/parse_target.c +++ b/src/backend/parser/parse_target.c @@ -14,6 +14,7 @@ @@ -8128,7 +7922,7 @@ index e542dc0..8191f94 100644 forboth(lname, names, lvar, vars) { diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c -index 90d5c76..b78f9ba 100644 +index d1e1dac..8e994da 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -53,8 +53,10 @@ @@ -8158,7 +7952,7 @@ index 90d5c76..b78f9ba 100644 Assert(!stmt->ofTypename || !stmt->inhRelations); /* grammar enforces */ -@@ -587,6 +591,9 @@ transformInhRelation(ParseState *pstate, CreateStmtContext *cxt, +@@ -599,6 +603,9 @@ transformInhRelation(ParseState *pstate, CreateStmtContext *cxt, aclcheck_error(aclresult, ACL_KIND_CLASS, RelationGetRelationName(relation)); @@ -8168,7 +7962,7 @@ index 90d5c76..b78f9ba 100644 tupleDesc = RelationGetDescr(relation); constr = tupleDesc->constr; -@@ -1368,7 +1375,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt) +@@ -1380,7 +1387,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt) if (constraint->contype == CONSTR_PRIMARY) column->is_not_null = TRUE; } @@ -8177,7 +7971,7 @@ index 90d5c76..b78f9ba 100644 { /* * column will be a system column in the new table, so accept it. -@@ -1945,6 +1952,7 @@ transformAlterTableStmt(AlterTableStmt *stmt, const char *queryString) +@@ -1957,6 +1964,7 @@ transformAlterTableStmt(AlterTableStmt *stmt, const char *queryString) cxt.inhRelations = NIL; cxt.isalter = true; cxt.hasoids = false; /* need not be right */ @@ -8186,7 +7980,7 @@ index 90d5c76..b78f9ba 100644 cxt.ckconstraints = NIL; cxt.fkconstraints = NIL; diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c -index aa8f2da..604a72c 100644 +index 4666fd6..784723d 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -109,6 +109,7 @@ @@ -8236,18 +8030,17 @@ index aa8f2da..604a72c 100644 /* Reload authentication config files too */ if (!load_hba()) -@@ -2180,6 +2190,10 @@ pmdie(SIGNAL_ARGS) +@@ -2180,6 +2190,9 @@ pmdie(SIGNAL_ARGS) /* and the walwriter too */ if (WalWriterPID != 0) signal_child(WalWriterPID, SIGTERM); + /* and the security worker too */ + if (SecWorkerPID != 0) + signal_child(SecWorkerPID, SIGTERM); -+ + /* * If we're in recovery, we can't kill the startup process - * right away, because at present doing so does not release -@@ -2241,6 +2255,9 @@ pmdie(SIGNAL_ARGS) +@@ -2242,6 +2255,9 @@ pmdie(SIGNAL_ARGS) /* and the walwriter too */ if (WalWriterPID != 0) signal_child(WalWriterPID, SIGTERM); @@ -8257,7 +8050,7 @@ index aa8f2da..604a72c 100644 pmState = PM_WAIT_BACKENDS; } -@@ -2276,6 +2293,8 @@ pmdie(SIGNAL_ARGS) +@@ -2277,6 +2293,8 @@ pmdie(SIGNAL_ARGS) signal_child(PgArchPID, SIGQUIT); if (PgStatPID != 0) signal_child(PgStatPID, SIGQUIT); @@ -8266,7 +8059,7 @@ index aa8f2da..604a72c 100644 ExitPostmaster(0); break; } -@@ -2547,6 +2566,16 @@ reaper(SIGNAL_ARGS) +@@ -2549,6 +2567,16 @@ reaper(SIGNAL_ARGS) continue; } @@ -8283,7 +8076,7 @@ index aa8f2da..604a72c 100644 /* * Else do standard backend child cleanup. */ -@@ -2750,6 +2779,18 @@ HandleChildCrash(int pid, int exitstatus, const char *procname) +@@ -2765,6 +2793,18 @@ HandleChildCrash(int pid, int exitstatus, const char *procname) signal_child(AutoVacPID, (SendStop ? SIGSTOP : SIGQUIT)); } @@ -8302,7 +8095,7 @@ index aa8f2da..604a72c 100644 /* * Force a power-cycle of the pgarch process too. (This isn't absolutely * necessary, but it seems like a good idea for robustness, and it -@@ -2906,7 +2947,8 @@ PostmasterStateMachine(void) +@@ -2921,7 +2961,8 @@ PostmasterStateMachine(void) WalReceiverPID == 0 && (BgWriterPID == 0 || !FatalError) && WalWriterPID == 0 && @@ -8313,7 +8106,7 @@ index aa8f2da..604a72c 100644 if (FatalError) { diff --git a/src/backend/rewrite/rewriteDefine.c b/src/backend/rewrite/rewriteDefine.c -index 68be146..6ba1d2f 100644 +index 06469b3..34f8cbe 100644 --- a/src/backend/rewrite/rewriteDefine.c +++ b/src/backend/rewrite/rewriteDefine.c @@ -27,6 +27,7 @@ @@ -8335,7 +8128,7 @@ index 68be146..6ba1d2f 100644 * No rule actions that modify OLD or NEW */ diff --git a/src/backend/rewrite/rewriteRemove.c b/src/backend/rewrite/rewriteRemove.c -index c1c5ce9..0f6a446 100644 +index 2bbfc1f..b412ee9 100644 --- a/src/backend/rewrite/rewriteRemove.c +++ b/src/backend/rewrite/rewriteRemove.c @@ -22,6 +22,7 @@ @@ -12986,7 +12779,7 @@ index 0000000..3c4891c +} diff --git a/src/backend/sepgsql/rowlv.c b/src/backend/sepgsql/rowlv.c new file mode 100644 -index 0000000..1078777 +index 0000000..892daf9 --- /dev/null +++ b/src/backend/sepgsql/rowlv.c @@ -0,0 +1,346 @@ @@ -13094,7 +12887,6 @@ index 0000000..1078777 + Form_pg_type typForm; + sepgsql_sid_t tsid; + uint16 tclass; -+ bool result; + + /* object class? */ + switch (RelationGetRelid(rel)) @@ -13145,9 +12937,13 @@ index 0000000..1078777 + case RELKIND_COMPOSITE_TYPE: + tclass = SEPG_CLASS_DB_TUPLE; + break; -+ default: /* index, toast */ ++ case RELKIND_INDEX: ++ case RELKIND_TOASTVALUE: + tclass = SEPG_CLASS_DB_TABLE; + break; ++ default: ++ /* orphan attribute? */ ++ return !sepgsql_get_enforce(); + } + break; + @@ -13172,6 +12968,8 @@ index 0000000..1078777 + switch (get_rel_relkind(typForm->typrelid)) + { + case RELKIND_RELATION: ++ case RELKIND_INDEX: ++ case RELKIND_TOASTVALUE: + tclass = SEPG_CLASS_DB_TABLE; + break; + case RELKIND_SEQUENCE: @@ -13183,9 +12981,9 @@ index 0000000..1078777 + case RELKIND_COMPOSITE_TYPE: + tclass = SEPG_CLASS_DB_TUPLE; + break; -+ default: /* index, toast */ -+ tclass = SEPG_CLASS_DB_TABLE; -+ break; ++ default: ++ /* orphan type? */ ++ return !sepgsql_get_enforce(); + } + } + break; @@ -13199,12 +12997,7 @@ index 0000000..1078777 + tsid.relid = RelationGetRelid(rel); + tsid.secid = HeapTupleGetSecid(tuple); + -+ result = sepgsql_client_perms(tsid, tclass, required, NULL, abort); -+ -+ if (!result) -+ elog(NOTICE, "denied: oid=%u tsid(relid=%u, secid=%u) label=%s tclass=%d required=%u", HeapTupleGetOid(tuple), tsid.relid, tsid.secid, seclabelRawOutput(tsid.relid, tsid.secid), tclass, required); -+ -+ return result; ++ return sepgsql_client_perms(tsid, tclass, required, NULL, abort); +} +#endif + @@ -15225,7 +15018,7 @@ index 0000000..8cd65ae +#endif +} diff --git a/src/backend/storage/large_object/inv_api.c b/src/backend/storage/large_object/inv_api.c -index ca48cdd..bb0688f 100644 +index 36da56d..6240a62 100644 --- a/src/backend/storage/large_object/inv_api.c +++ b/src/backend/storage/large_object/inv_api.c @@ -197,14 +197,14 @@ getbytealen(bytea *data) @@ -15246,7 +15039,7 @@ index ca48cdd..bb0688f 100644 /* * dependency on the owner of largeobject diff --git a/src/backend/tcop/fastpath.c b/src/backend/tcop/fastpath.c -index 575fa86..eb2b5e8 100644 +index 5870081..7ae10b3 100644 --- a/src/backend/tcop/fastpath.c +++ b/src/backend/tcop/fastpath.c @@ -26,6 +26,7 @@ @@ -15257,7 +15050,7 @@ index 575fa86..eb2b5e8 100644 #include "tcop/fastpath.h" #include "tcop/tcopprot.h" #include "utils/acl.h" -@@ -347,6 +348,10 @@ HandleFunctionRequest(StringInfo msgBuf) +@@ -348,6 +349,10 @@ HandleFunctionRequest(StringInfo msgBuf) aclcheck_error(aclresult, ACL_KIND_PROC, get_func_name(fid)); @@ -15266,10 +15059,10 @@ index 575fa86..eb2b5e8 100644 + sepgsql_proc_execute(fid); + /* - * Prepare function call info block and insert arguments. - */ + * Restrict access to pg_get_expr(). This reflects the hack in + * transformFuncCall() in parse_expr.c, see comments there for an diff --git a/src/backend/tcop/pquery.c b/src/backend/tcop/pquery.c -index 8ad4915..54961d8 100644 +index d60dc49..0ef21eb 100644 --- a/src/backend/tcop/pquery.c +++ b/src/backend/tcop/pquery.c @@ -575,7 +575,7 @@ PortalStart(Portal portal, ParamListInfo params, Snapshot snapshot) @@ -15282,7 +15075,7 @@ index 8ad4915..54961d8 100644 /* diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c -index 8960246..e8f8ea3 100644 +index ec36644..a25bd00 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -165,6 +165,7 @@ check_xact_readonly(Node *parsetree) @@ -15293,7 +15086,7 @@ index 8960246..e8f8ea3 100644 case T_AlterSeqStmt: case T_AlterTableStmt: case T_RenameStmt: -@@ -696,6 +697,10 @@ standard_ProcessUtility(Node *parsetree, +@@ -697,6 +698,10 @@ standard_ProcessUtility(Node *parsetree, ExecAlterOwnerStmt((AlterOwnerStmt *) parsetree); break; @@ -15304,7 +15097,7 @@ index 8960246..e8f8ea3 100644 case T_AlterTableStmt: { List *stmts; -@@ -1760,6 +1765,46 @@ CreateCommandTag(Node *parsetree) +@@ -1761,6 +1766,46 @@ CreateCommandTag(Node *parsetree) } break; @@ -15351,7 +15144,7 @@ index 8960246..e8f8ea3 100644 case T_AlterTableStmt: switch (((AlterTableStmt *) parsetree)->relkind) { -@@ -2352,6 +2397,10 @@ GetCommandLogLevel(Node *parsetree) +@@ -2353,6 +2398,10 @@ GetCommandLogLevel(Node *parsetree) lev = LOGSTMT_DDL; break; @@ -15363,7 +15156,7 @@ index 8960246..e8f8ea3 100644 lev = LOGSTMT_DDL; break; diff --git a/src/backend/tsearch/wparser.c b/src/backend/tsearch/wparser.c -index 0fed35c..ca9e9d1 100644 +index d74256f..f876951 100644 --- a/src/backend/tsearch/wparser.c +++ b/src/backend/tsearch/wparser.c @@ -59,7 +59,7 @@ tt_setup_firstcall(FuncCallContext *funcctx, Oid prsid) @@ -15385,7 +15178,7 @@ index 0fed35c..ca9e9d1 100644 INT4OID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "token", diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c -index faad11e..53e6944 100644 +index 79ca6c1..70fc9fb 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -1695,7 +1695,7 @@ aclexplode(PG_FUNCTION_ARGS) @@ -15398,10 +15191,10 @@ index faad11e..53e6944 100644 OIDOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "grantee", diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c -index ed81ced..f3d4b99 100644 +index 8e342a9..2cbd1d9 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c -@@ -4193,7 +4193,7 @@ pg_timezone_abbrevs(PG_FUNCTION_ARGS) +@@ -4200,7 +4200,7 @@ pg_timezone_abbrevs(PG_FUNCTION_ARGS) * build tupdesc for result tuples. This must match this function's * pg_proc entry! */ @@ -15410,7 +15203,7 @@ index ed81ced..f3d4b99 100644 TupleDescInitEntry(tupdesc, (AttrNumber) 1, "abbrev", TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "utc_offset", -@@ -4286,7 +4286,7 @@ pg_timezone_names(PG_FUNCTION_ARGS) +@@ -4293,7 +4293,7 @@ pg_timezone_names(PG_FUNCTION_ARGS) * build tupdesc for result tuples. This must match this function's * pg_proc entry! */ @@ -15420,7 +15213,7 @@ index ed81ced..f3d4b99 100644 TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "abbrev", diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c -index a4e0252..36d07b7 100644 +index 8b5def4..9f79a5c 100644 --- a/src/backend/utils/adt/dbsize.c +++ b/src/backend/utils/adt/dbsize.c @@ -21,6 +21,7 @@ @@ -15451,7 +15244,7 @@ index a4e0252..36d07b7 100644 if (tblspcOid == DEFAULTTABLESPACE_OID) snprintf(tblspcPath, MAXPGPATH, "base"); diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.c -index e074b79..8bb707f 100644 +index 863727d..d4a5220 100644 --- a/src/backend/utils/adt/genfile.c +++ b/src/backend/utils/adt/genfile.c @@ -25,6 +25,7 @@ @@ -15499,7 +15292,7 @@ index e074b79..8bb707f 100644 if (!fctx->dirdesc) diff --git a/src/backend/utils/adt/lockfuncs.c b/src/backend/utils/adt/lockfuncs.c -index 07e6aab..e5c8182 100644 +index c72c4c1..0d23605 100644 --- a/src/backend/utils/adt/lockfuncs.c +++ b/src/backend/utils/adt/lockfuncs.c @@ -85,7 +85,7 @@ pg_lock_status(PG_FUNCTION_ARGS) @@ -15512,7 +15305,7 @@ index 07e6aab..e5c8182 100644 TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "database", diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c -index 11342b2..0ddf907 100644 +index 66c8598..c532dea 100644 --- a/src/backend/utils/adt/misc.c +++ b/src/backend/utils/adt/misc.c @@ -322,7 +322,7 @@ pg_get_keywords(PG_FUNCTION_ARGS) @@ -15525,7 +15318,7 @@ index 11342b2..0ddf907 100644 TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "catcode", diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c -index 8379407..d44655b 100644 +index 8b13c8a..09bb38e 100644 --- a/src/backend/utils/adt/pgstatfuncs.c +++ b/src/backend/utils/adt/pgstatfuncs.c @@ -419,7 +419,7 @@ pg_stat_get_activity(PG_FUNCTION_ARGS) @@ -15538,7 +15331,7 @@ index 8379407..d44655b 100644 TupleDescInitEntry(tupdesc, (AttrNumber) 2, "procpid", INT4OID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 3, "usesysid", OIDOID, -1, 0); diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c -index 9db070d..6881976 100644 +index 2d0ab44..87eb953 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -30,6 +30,7 @@ @@ -15615,7 +15408,7 @@ index 9db070d..6881976 100644 if (spi_result < 0) elog(ERROR, "SPI_execute_snapshot returned %d", spi_result); diff --git a/src/backend/utils/adt/tid.c b/src/backend/utils/adt/tid.c -index c837e67..1bf4eb8 100644 +index 8c18a26..843d702 100644 --- a/src/backend/utils/adt/tid.c +++ b/src/backend/utils/adt/tid.c @@ -27,6 +27,7 @@ @@ -15645,7 +15438,7 @@ index c837e67..1bf4eb8 100644 if (rel->rd_rel->relkind == RELKIND_VIEW) return currtid_for_view(rel, tid); diff --git a/src/backend/utils/adt/trigfuncs.c b/src/backend/utils/adt/trigfuncs.c -index 70246fb..b996537 100644 +index d831b60..badc1f5 100644 --- a/src/backend/utils/adt/trigfuncs.c +++ b/src/backend/utils/adt/trigfuncs.c @@ -76,6 +76,10 @@ suppress_redundant_updates_trigger(PG_FUNCTION_ARGS) @@ -15660,7 +15453,7 @@ index 70246fb..b996537 100644 if (newtuple->t_len == oldtuple->t_len && newheader->t_hoff == oldheader->t_hoff && diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c -index 78f08f4..4a44810 100644 +index 94c242d..b44cb63 100644 --- a/src/backend/utils/adt/tsvector_op.c +++ b/src/backend/utils/adt/tsvector_op.c @@ -975,7 +975,7 @@ ts_setup_firstcall(FunctionCallInfo fcinfo, FuncCallContext *funcctx, @@ -15673,10 +15466,10 @@ index 78f08f4..4a44810 100644 TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "ndoc", diff --git a/src/backend/utils/cache/plancache.c b/src/backend/utils/cache/plancache.c -index 88d8d8b..281acb0 100644 +index 06e2549..56c5df9 100644 --- a/src/backend/utils/cache/plancache.c +++ b/src/backend/utils/cache/plancache.c -@@ -924,12 +924,12 @@ PlanCacheComputeResultDesc(List *stmt_list) +@@ -926,12 +926,12 @@ PlanCacheComputeResultDesc(List *stmt_list) if (IsA(node, Query)) { query = (Query *) node; @@ -15691,7 +15484,7 @@ index 88d8d8b..281acb0 100644 } /* other cases shouldn't happen, but return NULL */ break; -@@ -940,13 +940,13 @@ PlanCacheComputeResultDesc(List *stmt_list) +@@ -942,13 +942,13 @@ PlanCacheComputeResultDesc(List *stmt_list) { query = (Query *) node; Assert(query->returningList); @@ -15708,10 +15501,10 @@ index 88d8d8b..281acb0 100644 /* other cases shouldn't happen, but return NULL */ break; diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c -index d462510..c704bc9 100644 +index 510f077..430d89e 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c -@@ -216,7 +216,7 @@ static void write_relcache_init_file(bool shared); +@@ -215,7 +215,7 @@ static void write_relcache_init_file(bool shared); static void write_item(const void *data, Size len, FILE *fp); static void formrdesc(const char *relationName, Oid relationReltype, @@ -15720,7 +15513,7 @@ index d462510..c704bc9 100644 int natts, const FormData_pg_attribute *attrs); static HeapTuple ScanPgRelation(Oid targetRelId, bool indexOK); -@@ -355,7 +355,8 @@ AllocateRelationDesc(Form_pg_class relp) +@@ -354,7 +354,8 @@ AllocateRelationDesc(Form_pg_class relp) /* and allocate attribute tuple form storage */ relation->rd_att = CreateTemplateTupleDesc(relationForm->relnatts, @@ -15730,7 +15523,7 @@ index d462510..c704bc9 100644 /* which we mark as a reference-counted tupdesc */ relation->rd_att->tdrefcount = 1; -@@ -437,6 +438,7 @@ RelationBuildTupleDesc(Relation relation) +@@ -436,6 +437,7 @@ RelationBuildTupleDesc(Relation relation) relation->rd_att->tdtypeid = relation->rd_rel->reltype; relation->rd_att->tdtypmod = -1; /* unnecessary, but... */ relation->rd_att->tdhasoid = relation->rd_rel->relhasoids; @@ -15738,7 +15531,7 @@ index d462510..c704bc9 100644 constr = (TupleConstr *) MemoryContextAlloc(CacheMemoryContext, sizeof(TupleConstr)); -@@ -1396,7 +1398,7 @@ LookupOpclassInfo(Oid operatorClassOid, +@@ -1395,7 +1397,7 @@ LookupOpclassInfo(Oid operatorClassOid, */ static void formrdesc(const char *relationName, Oid relationReltype, @@ -15747,7 +15540,7 @@ index d462510..c704bc9 100644 int natts, const FormData_pg_attribute *attrs) { Relation relation; -@@ -1459,6 +1461,7 @@ formrdesc(const char *relationName, Oid relationReltype, +@@ -1458,6 +1460,7 @@ formrdesc(const char *relationName, Oid relationReltype, relation->rd_rel->reltuples = 1; relation->rd_rel->relkind = RELKIND_RELATION; relation->rd_rel->relhasoids = hasoids; @@ -15755,7 +15548,7 @@ index d462510..c704bc9 100644 relation->rd_rel->relnatts = (int16) natts; /* -@@ -1468,7 +1471,7 @@ formrdesc(const char *relationName, Oid relationReltype, +@@ -1467,7 +1470,7 @@ formrdesc(const char *relationName, Oid relationReltype, * because it will never be replaced. The data comes from * src/include/catalog/ headers via genbki.pl. */ @@ -15764,7 +15557,7 @@ index d462510..c704bc9 100644 relation->rd_att->tdrefcount = 1; /* mark as refcounted */ relation->rd_att->tdtypeid = relationReltype; -@@ -2551,6 +2554,7 @@ RelationBuildLocalRelation(const char *relname, +@@ -2542,6 +2545,7 @@ RelationBuildLocalRelation(const char *relname, rel->rd_rel->relkind = RELKIND_UNCATALOGED; rel->rd_rel->relhasoids = rel->rd_att->tdhasoid; @@ -15772,7 +15565,7 @@ index d462510..c704bc9 100644 rel->rd_rel->relnatts = natts; rel->rd_rel->reltype = InvalidOid; /* needed when bootstrapping: */ -@@ -2793,11 +2797,11 @@ RelationCacheInitializePhase2(void) +@@ -2784,11 +2788,11 @@ RelationCacheInitializePhase2(void) if (!load_relcache_init_file(true)) { formrdesc("pg_database", DatabaseRelation_Rowtype_Id, true, @@ -15787,7 +15580,7 @@ index d462510..c704bc9 100644 #define NUM_CRITICAL_SHARED_RELS 3 /* fix if you change list above */ } -@@ -2848,13 +2852,13 @@ RelationCacheInitializePhase3(void) +@@ -2839,13 +2843,13 @@ RelationCacheInitializePhase3(void) needNewCacheFile = true; formrdesc("pg_class", RelationRelation_Rowtype_Id, false, @@ -15805,7 +15598,7 @@ index d462510..c704bc9 100644 #define NUM_CRITICAL_LOCAL_RELS 4 /* fix if you change list above */ } -@@ -3007,6 +3011,7 @@ RelationCacheInitializePhase3(void) +@@ -2998,6 +3002,7 @@ RelationCacheInitializePhase3(void) Assert(relation->rd_att->tdtypeid == relp->reltype); Assert(relation->rd_att->tdtypmod == -1); Assert(relation->rd_att->tdhasoid == relp->relhasoids); @@ -15813,7 +15606,7 @@ index d462510..c704bc9 100644 ReleaseSysCache(htup); -@@ -3117,7 +3122,7 @@ load_critical_index(Oid indexoid, Oid heapoid) +@@ -3108,7 +3113,7 @@ load_critical_index(Oid indexoid, Oid heapoid) */ static TupleDesc BuildHardcodedDescriptor(int natts, const FormData_pg_attribute *attrs, @@ -15822,7 +15615,7 @@ index d462510..c704bc9 100644 { TupleDesc result; MemoryContext oldcxt; -@@ -3125,7 +3130,7 @@ BuildHardcodedDescriptor(int natts, const FormData_pg_attribute *attrs, +@@ -3116,7 +3121,7 @@ BuildHardcodedDescriptor(int natts, const FormData_pg_attribute *attrs, oldcxt = MemoryContextSwitchTo(CacheMemoryContext); @@ -15831,7 +15624,7 @@ index d462510..c704bc9 100644 result->tdtypeid = RECORDOID; /* not right, but we don't care */ result->tdtypmod = -1; -@@ -3155,7 +3160,7 @@ GetPgClassDescriptor(void) +@@ -3146,7 +3151,7 @@ GetPgClassDescriptor(void) if (pgclassdesc == NULL) pgclassdesc = BuildHardcodedDescriptor(Natts_pg_class, Desc_pg_class, @@ -15840,7 +15633,7 @@ index d462510..c704bc9 100644 return pgclassdesc; } -@@ -3169,7 +3174,7 @@ GetPgIndexDescriptor(void) +@@ -3160,7 +3165,7 @@ GetPgIndexDescriptor(void) if (pgindexdesc == NULL) pgindexdesc = BuildHardcodedDescriptor(Natts_pg_index, Desc_pg_index, @@ -15849,7 +15642,7 @@ index d462510..c704bc9 100644 return pgindexdesc; } -@@ -3985,7 +3990,8 @@ load_relcache_init_file(bool shared) +@@ -3976,7 +3981,8 @@ load_relcache_init_file(bool shared) /* initialize attribute tuple forms */ rel->rd_att = CreateTemplateTupleDesc(relform->relnatts, @@ -15860,7 +15653,7 @@ index d462510..c704bc9 100644 rel->rd_att->tdtypeid = relform->reltype; diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c -index 61b06ac..b08654b 100644 +index 0224cfb..3137199 100644 --- a/src/backend/utils/cache/syscache.c +++ b/src/backend/utils/cache/syscache.c @@ -895,6 +895,30 @@ GetSysCacheOid(int cacheId, @@ -15895,7 +15688,7 @@ index 61b06ac..b08654b 100644 /* * SearchSysCacheAttName diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c -index c3c0440..fb5b762 100644 +index 04f91f1..6f82199 100644 --- a/src/backend/utils/fmgr/fmgr.c +++ b/src/backend/utils/fmgr/fmgr.c @@ -24,6 +24,7 @@ @@ -15974,7 +15767,7 @@ index c3c0440..fb5b762 100644 return result; } diff --git a/src/backend/utils/fmgr/funcapi.c b/src/backend/utils/fmgr/funcapi.c -index 382008c..e6eba47 100644 +index d946aab..f7581a7 100644 --- a/src/backend/utils/fmgr/funcapi.c +++ b/src/backend/utils/fmgr/funcapi.c @@ -1105,7 +1105,7 @@ build_function_result_tupdesc_d(Datum proallargtypes, @@ -15996,7 +15789,7 @@ index 382008c..e6eba47 100644 (AttrNumber) 1, attname, diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c -index 179d009..4bd7314 100644 +index fc97683..1fcb33f 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -37,6 +37,7 @@ @@ -16007,7 +15800,7 @@ index 179d009..4bd7314 100644 #include "storage/bufmgr.h" #include "storage/fd.h" #include "storage/ipc.h" -@@ -304,6 +305,9 @@ CheckMyDatabase(const char *name, bool am_superuser) +@@ -306,6 +307,9 @@ CheckMyDatabase(const char *name, bool am_superuser) errmsg("permission denied for database \"%s\"", name), errdetail("User does not have CONNECT privilege."))); @@ -16017,7 +15810,7 @@ index 179d009..4bd7314 100644 /* * Check connection limit for this database. * -@@ -800,6 +804,9 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username, +@@ -817,6 +821,9 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username, /* set up ACL framework (so CheckMyDatabase can check permissions) */ initialize_acl(); @@ -16028,7 +15821,7 @@ index 179d009..4bd7314 100644 * Re-read the pg_database row for our database, check permissions and set * up database-specific GUC settings. We can't do this until all the diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c -index 920daeb..44fd3a9 100644 +index 4e55b16..a9f9f7e 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -31,6 +31,7 @@ @@ -16045,9 +15838,9 @@ index 920daeb..44fd3a9 100644 #include "replication/walsender.h" +#include "sepgsql/sepgsql.h" #include "storage/bufmgr.h" + #include "storage/standby.h" #include "storage/fd.h" - #include "tcop/tcopprot.h" -@@ -337,6 +339,18 @@ static const struct config_enum_entry constraint_exclusion_options[] = { +@@ -335,6 +337,18 @@ static const struct config_enum_entry constraint_exclusion_options[] = { {NULL, 0, false} }; @@ -16066,7 +15859,7 @@ index 920daeb..44fd3a9 100644 /* * Options for enum values stored in other modules */ -@@ -366,6 +380,7 @@ bool log_btree_build_stats = false; +@@ -364,6 +378,7 @@ bool log_btree_build_stats = false; bool check_function_bodies = true; bool default_with_oids = false; @@ -16074,7 +15867,7 @@ index 920daeb..44fd3a9 100644 bool SQL_inheritance = true; bool Password_encryption = true; -@@ -1094,6 +1109,14 @@ static struct config_bool ConfigureNamesBool[] = +@@ -1103,6 +1118,14 @@ static struct config_bool ConfigureNamesBool[] = false, NULL, NULL }, { @@ -16089,7 +15882,7 @@ index 920daeb..44fd3a9 100644 {"logging_collector", PGC_POSTMASTER, LOGGING_WHERE, gettext_noop("Start a subprocess to capture stderr output and/or csvlogs into log files."), NULL -@@ -1261,6 +1284,36 @@ static struct config_bool ConfigureNamesBool[] = +@@ -1270,6 +1293,36 @@ static struct config_bool ConfigureNamesBool[] = false, NULL, NULL }, @@ -16126,7 +15919,7 @@ index 920daeb..44fd3a9 100644 /* End-of-list marker */ { {NULL, 0, 0, NULL, NULL}, NULL, false, NULL, NULL -@@ -2820,7 +2873,16 @@ static struct config_enum ConfigureNamesEnum[] = +@@ -2844,7 +2897,16 @@ static struct config_enum ConfigureNamesEnum[] = &xmloption, XMLOPTION_CONTENT, xmloption_options, NULL, NULL }, @@ -16144,7 +15937,7 @@ index 920daeb..44fd3a9 100644 /* End-of-list marker */ { -@@ -6113,7 +6175,7 @@ GetPGVariableResultDesc(const char *name) +@@ -6139,7 +6201,7 @@ GetPGVariableResultDesc(const char *name) if (guc_name_compare(name, "all") == 0) { /* need a tuple descriptor representing three TEXT columns */ @@ -16153,7 +15946,7 @@ index 920daeb..44fd3a9 100644 TupleDescInitEntry(tupdesc, (AttrNumber) 1, "name", TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "setting", -@@ -6129,7 +6191,7 @@ GetPGVariableResultDesc(const char *name) +@@ -6155,7 +6217,7 @@ GetPGVariableResultDesc(const char *name) (void) GetConfigOptionByName(name, &varname); /* need a tuple descriptor representing a single TEXT column */ @@ -16162,7 +15955,7 @@ index 920daeb..44fd3a9 100644 TupleDescInitEntry(tupdesc, (AttrNumber) 1, varname, TEXTOID, -1, 0); } -@@ -6152,7 +6214,7 @@ ShowGUCConfigOption(const char *name, DestReceiver *dest) +@@ -6178,7 +6240,7 @@ ShowGUCConfigOption(const char *name, DestReceiver *dest) value = GetConfigOptionByName(name, &varname); /* need a tuple descriptor representing a single TEXT column */ @@ -16171,7 +15964,7 @@ index 920daeb..44fd3a9 100644 TupleDescInitEntry(tupdesc, (AttrNumber) 1, varname, TEXTOID, -1, 0); -@@ -6179,7 +6241,7 @@ ShowAllGUCConfig(DestReceiver *dest) +@@ -6205,7 +6267,7 @@ ShowAllGUCConfig(DestReceiver *dest) bool isnull[3] = {false, false, false}; /* need a tuple descriptor representing three TEXT columns */ @@ -16180,7 +15973,7 @@ index 920daeb..44fd3a9 100644 TupleDescInitEntry(tupdesc, (AttrNumber) 1, "name", TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "setting", -@@ -6574,7 +6636,7 @@ show_all_settings(PG_FUNCTION_ARGS) +@@ -6600,7 +6662,7 @@ show_all_settings(PG_FUNCTION_ARGS) * need a tuple descriptor representing NUM_PG_SETTINGS_ATTS columns * of the appropriate types */ @@ -16190,7 +15983,7 @@ index 920daeb..44fd3a9 100644 TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "setting", diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample -index 2ed8412..10f8947 100644 +index a3b1457..b78c6d9 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -76,6 +76,8 @@ @@ -16203,10 +15996,10 @@ index 2ed8412..10f8947 100644 #ssl = off # (change requires restart) #ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH' # allowed SSL ciphers diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c -index ac62d45..f05a094 100644 +index 19c594d..b80b6ac 100644 --- a/src/backend/utils/mmgr/portalmem.c +++ b/src/backend/utils/mmgr/portalmem.c -@@ -894,7 +894,7 @@ pg_cursor(PG_FUNCTION_ARGS) +@@ -949,7 +949,7 @@ pg_cursor(PG_FUNCTION_ARGS) * build tupdesc for result tuples. This must match the definition of the * pg_cursors view in system_views.sql */ @@ -16216,7 +16009,7 @@ index ac62d45..f05a094 100644 TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "statement", diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c -index f40ad87..497bdf0 100644 +index 0aee70d..ceb9a87 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -87,6 +87,7 @@ static bool debug = false; @@ -16268,7 +16061,7 @@ index f40ad87..497bdf0 100644 show_setting = true; break; diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h -index 14fe652..40b7b40 100644 +index 5a73779..67fce14 100644 --- a/src/bin/pg_dump/pg_backup.h +++ b/src/bin/pg_dump/pg_backup.h @@ -103,6 +103,7 @@ typedef struct _restoreOptions @@ -16289,7 +16082,7 @@ index 14fe652..40b7b40 100644 const char *defn, const char *dropStmt, const char *copyStmt, diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c -index 6bbe2de..9da50b0 100644 +index be5339e..8352c93 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -540,6 +540,8 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, @@ -16345,7 +16138,7 @@ index 6bbe2de..9da50b0 100644 newToc->desc = strdup(desc); newToc->defn = strdup(defn); newToc->dropStmt = strdup(dropStmt); -@@ -2027,6 +2043,7 @@ WriteToc(ArchiveHandle *AH) +@@ -2046,6 +2062,7 @@ WriteToc(ArchiveHandle *AH) WriteStr(AH, te->tablespace); WriteStr(AH, te->owner); WriteStr(AH, te->withOids ? "true" : "false"); @@ -16353,7 +16146,7 @@ index 6bbe2de..9da50b0 100644 /* Dump list of dependencies */ for (i = 0; i < te->nDeps; i++) -@@ -2138,6 +2155,16 @@ ReadToc(ArchiveHandle *AH) +@@ -2157,6 +2174,16 @@ ReadToc(ArchiveHandle *AH) else te->withOids = true; @@ -16370,7 +16163,7 @@ index 6bbe2de..9da50b0 100644 /* Read TOC entry dependencies */ if (AH->version >= K_VERS_1_5) { -@@ -2256,6 +2283,9 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt, bool include_acls) +@@ -2275,6 +2302,9 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt, bool include_acls) if ((!include_acls || ropt->aclsSkip) && _tocEntryIsACL(te)) return 0; @@ -16378,9 +16171,9 @@ index 6bbe2de..9da50b0 100644 + return 0; + /* Ignore DATABASE entry unless we should create it */ - if (!ropt->create && strcmp(te->desc, "DATABASE") == 0) + if (!ropt->createDB && strcmp(te->desc, "DATABASE") == 0) return 0; -@@ -2322,6 +2352,8 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt, bool include_acls) +@@ -2341,6 +2371,8 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt, bool include_acls) (strcmp(te->desc, "ACL") == 0 && strncmp(te->tag, "LARGE OBJECT ", 13) == 0) || (strcmp(te->desc, "COMMENT") == 0 && @@ -16389,7 +16182,7 @@ index 6bbe2de..9da50b0 100644 strncmp(te->tag, "LARGE OBJECT ", 13) == 0)) res = res & REQ_DATA; else -@@ -2473,6 +2505,36 @@ _doSetWithOids(ArchiveHandle *AH, const bool withOids) +@@ -2492,6 +2524,36 @@ _doSetWithOids(ArchiveHandle *AH, const bool withOids) destroyPQExpBuffer(cmd); } @@ -16426,7 +16219,7 @@ index 6bbe2de..9da50b0 100644 /* * Issue the commands to connect to the specified database. -@@ -2571,6 +2633,18 @@ _setWithOids(ArchiveHandle *AH, TocEntry *te) +@@ -2590,6 +2652,18 @@ _setWithOids(ArchiveHandle *AH, TocEntry *te) } } @@ -16445,7 +16238,7 @@ index 6bbe2de..9da50b0 100644 /* * Issue the commands to select the specified schema as the current schema -@@ -2808,9 +2882,12 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat +@@ -2827,9 +2901,12 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat _selectOutputSchema(AH, te->namespace); _selectTablespace(AH, te->tablespace); @@ -16460,7 +16253,7 @@ index 6bbe2de..9da50b0 100644 /* Emit header comment for item */ if (!AH->noTocComments) diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h -index 2e944c1..67f62ac 100644 +index 0a135ee..27b2ef5 100644 --- a/src/bin/pg_dump/pg_backup_archiver.h +++ b/src/bin/pg_dump/pg_backup_archiver.h @@ -63,7 +63,7 @@ typedef z_stream *z_streamp; @@ -16502,7 +16295,7 @@ index 2e944c1..67f62ac 100644 char *defn; char *dropStmt; diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c -index 2431d71..e7ef296 100644 +index 7a06f9b..f7fa80a 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -125,7 +125,7 @@ static int binary_upgrade = 0; @@ -16552,7 +16345,7 @@ index 2431d71..e7ef296 100644 else { fprintf(stderr, -@@ -515,6 +523,10 @@ main(int argc, char **argv) +@@ -516,6 +524,10 @@ main(int argc, char **argv) exit(1); } @@ -16563,7 +16356,7 @@ index 2431d71..e7ef296 100644 /* open the output file */ if (pg_strcasecmp(format, "a") == 0 || pg_strcasecmp(format, "append") == 0) { -@@ -833,6 +845,7 @@ help(const char *progname) +@@ -834,6 +846,7 @@ help(const char *progname) printf(_(" --use-set-session-authorization\n" " use SET SESSION AUTHORIZATION commands instead of\n" " ALTER OWNER commands to set ownership\n")); @@ -16571,7 +16364,7 @@ index 2431d71..e7ef296 100644 printf(_("\nConnection options:\n")); printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); -@@ -1127,7 +1140,7 @@ dumpTableData_copy(Archive *fout, void *dcontext) +@@ -1128,7 +1141,7 @@ dumpTableData_copy(Archive *fout, void *dcontext) * cases involving ADD COLUMN and inheritance.) */ if (g_fout->remoteVersion >= 70300) @@ -16580,7 +16373,7 @@ index 2431d71..e7ef296 100644 else column_list = ""; /* can't select columns in COPY */ -@@ -1251,14 +1264,16 @@ dumpTableData_insert(Archive *fout, void *dcontext) +@@ -1252,14 +1265,16 @@ dumpTableData_insert(Archive *fout, void *dcontext) if (fout->remoteVersion >= 70100) { appendPQExpBuffer(q, "DECLARE _pg_dump_cursor CURSOR FOR " @@ -16599,7 +16392,7 @@ index 2431d71..e7ef296 100644 fmtQualifiedId(tbinfo->dobj.namespace->dobj.name, classname)); } -@@ -1398,7 +1413,7 @@ dumpTableData(Archive *fout, TableDataInfo *tdinfo) +@@ -1399,7 +1414,7 @@ dumpTableData(Archive *fout, TableDataInfo *tdinfo) appendPQExpBuffer(copyBuf, "COPY %s ", fmtId(tbinfo->dobj.name)); appendPQExpBuffer(copyBuf, "%s %sFROM stdin;\n", @@ -16608,7 +16401,7 @@ index 2431d71..e7ef296 100644 (tdinfo->oids && tbinfo->hasoids) ? "WITH OIDS " : ""); copyStmt = copyBuf->data; } -@@ -1412,7 +1427,7 @@ dumpTableData(Archive *fout, TableDataInfo *tdinfo) +@@ -1413,7 +1428,7 @@ dumpTableData(Archive *fout, TableDataInfo *tdinfo) ArchiveEntry(fout, tdinfo->dobj.catId, tdinfo->dobj.dumpId, tbinfo->dobj.name, tbinfo->dobj.namespace->dobj.name, NULL, tbinfo->rolname, @@ -16617,7 +16410,7 @@ index 2431d71..e7ef296 100644 "", "", copyStmt, tdinfo->dobj.dependencies, tdinfo->dobj.nDeps, dumpFn, tdinfo); -@@ -1457,6 +1472,7 @@ getTableData(TableInfo *tblinfo, int numTables, bool oids) +@@ -1458,6 +1473,7 @@ getTableData(TableInfo *tblinfo, int numTables, bool oids) tdinfo->dobj.namespace = tblinfo[i].dobj.namespace; tdinfo->tdtable = &(tblinfo[i]); tdinfo->oids = oids; @@ -16625,7 +16418,7 @@ index 2431d71..e7ef296 100644 addObjectDependency(&tdinfo->dobj, tblinfo[i].dobj.dumpId); tblinfo[i].dataObj = tdinfo; -@@ -1780,6 +1796,7 @@ dumpDatabase(Archive *AH) +@@ -1781,6 +1797,7 @@ dumpDatabase(Archive *AH) NULL, /* Tablespace */ dba, /* Owner */ false, /* with oids */ @@ -16633,7 +16426,7 @@ index 2431d71..e7ef296 100644 "DATABASE", /* Desc */ SECTION_PRE_DATA, /* Section */ creaQry->data, /* Create */ -@@ -1825,7 +1842,7 @@ dumpDatabase(Archive *AH) +@@ -1826,7 +1843,7 @@ dumpDatabase(Archive *AH) LargeObjectRelationId); ArchiveEntry(AH, nilCatalogId, createDumpId(), "pg_largeobject", NULL, NULL, "", @@ -16642,7 +16435,7 @@ index 2431d71..e7ef296 100644 loOutQry->data, "", NULL, NULL, 0, NULL, NULL); -@@ -1857,7 +1874,7 @@ dumpDatabase(Archive *AH) +@@ -1858,7 +1875,7 @@ dumpDatabase(Archive *AH) appendPQExpBuffer(dbQry, ";\n"); ArchiveEntry(AH, dbCatId, createDumpId(), datname, NULL, NULL, @@ -16651,7 +16444,7 @@ index 2431d71..e7ef296 100644 dbQry->data, "", NULL, &dbDumpId, 1, NULL, NULL); } -@@ -1896,7 +1913,7 @@ dumpEncoding(Archive *AH) +@@ -1897,7 +1914,7 @@ dumpEncoding(Archive *AH) ArchiveEntry(AH, nilCatalogId, createDumpId(), "ENCODING", NULL, NULL, "", @@ -16660,7 +16453,7 @@ index 2431d71..e7ef296 100644 qry->data, "", NULL, NULL, 0, NULL, NULL); -@@ -1923,7 +1940,7 @@ dumpStdStrings(Archive *AH) +@@ -1924,7 +1941,7 @@ dumpStdStrings(Archive *AH) ArchiveEntry(AH, nilCatalogId, createDumpId(), "STDSTRINGS", NULL, NULL, "", @@ -16669,7 +16462,7 @@ index 2431d71..e7ef296 100644 qry->data, "", NULL, NULL, 0, NULL, NULL); -@@ -1956,16 +1973,17 @@ getBlobs(Archive *AH) +@@ -1957,16 +1974,17 @@ getBlobs(Archive *AH) /* Fetch BLOB OIDs, and owner/ACL data if >= 9.0 */ if (AH->remoteVersion >= 90000) appendPQExpBuffer(blobQry, @@ -16691,7 +16484,7 @@ index 2431d71..e7ef296 100644 " FROM pg_class WHERE relkind = 'l'"); res = PQexec(g_conn, blobQry->data); -@@ -1995,6 +2013,11 @@ getBlobs(Archive *AH) +@@ -1996,6 +2014,11 @@ getBlobs(Archive *AH) binfo[i].blobacl = strdup(PQgetvalue(res, i, 2)); else binfo[i].blobacl = NULL; @@ -16703,7 +16496,7 @@ index 2431d71..e7ef296 100644 } /* -@@ -2034,7 +2057,7 @@ dumpBlob(Archive *AH, BlobInfo *binfo) +@@ -2035,7 +2058,7 @@ dumpBlob(Archive *AH, BlobInfo *binfo) ArchiveEntry(AH, binfo->dobj.catId, binfo->dobj.dumpId, binfo->dobj.name, NULL, NULL, @@ -16712,7 +16505,7 @@ index 2431d71..e7ef296 100644 "BLOB", SECTION_PRE_DATA, cquery->data, dquery->data, NULL, binfo->dobj.dependencies, binfo->dobj.nDeps, -@@ -2049,6 +2072,10 @@ dumpBlob(Archive *AH, BlobInfo *binfo) +@@ -2050,6 +2073,10 @@ dumpBlob(Archive *AH, BlobInfo *binfo) NULL, binfo->rolname, binfo->dobj.catId, 0, binfo->dobj.dumpId); @@ -16723,7 +16516,7 @@ index 2431d71..e7ef296 100644 /* Dump ACL if any */ if (binfo->blobacl) dumpACL(AH, binfo->dobj.catId, binfo->dobj.dumpId, "LARGE OBJECT", -@@ -2356,6 +2383,7 @@ getNamespaces(int *numNamespaces) +@@ -2357,6 +2384,7 @@ getNamespaces(int *numNamespaces) int i_nspname; int i_rolname; int i_nspacl; @@ -16731,7 +16524,7 @@ index 2431d71..e7ef296 100644 /* * Before 7.3, there are no real namespaces; create two dummy entries, one -@@ -2372,6 +2400,7 @@ getNamespaces(int *numNamespaces) +@@ -2373,6 +2401,7 @@ getNamespaces(int *numNamespaces) nsinfo[0].dobj.name = strdup("public"); nsinfo[0].rolname = strdup(""); nsinfo[0].nspacl = strdup(""); @@ -16739,7 +16532,7 @@ index 2431d71..e7ef296 100644 selectDumpableNamespace(&nsinfo[0]); -@@ -2382,6 +2411,7 @@ getNamespaces(int *numNamespaces) +@@ -2383,6 +2412,7 @@ getNamespaces(int *numNamespaces) nsinfo[1].dobj.name = strdup("pg_catalog"); nsinfo[1].rolname = strdup(""); nsinfo[1].nspacl = strdup(""); @@ -16747,7 +16540,7 @@ index 2431d71..e7ef296 100644 selectDumpableNamespace(&nsinfo[1]); -@@ -2402,8 +2432,8 @@ getNamespaces(int *numNamespaces) +@@ -2403,8 +2433,8 @@ getNamespaces(int *numNamespaces) */ appendPQExpBuffer(query, "SELECT tableoid, oid, nspname, " "(%s nspowner) AS rolname, " @@ -16758,7 +16551,7 @@ index 2431d71..e7ef296 100644 res = PQexec(g_conn, query->data); check_sql_result(res, g_conn, query->data, PGRES_TUPLES_OK); -@@ -2417,6 +2447,7 @@ getNamespaces(int *numNamespaces) +@@ -2418,6 +2448,7 @@ getNamespaces(int *numNamespaces) i_nspname = PQfnumber(res, "nspname"); i_rolname = PQfnumber(res, "rolname"); i_nspacl = PQfnumber(res, "nspacl"); @@ -16766,7 +16559,7 @@ index 2431d71..e7ef296 100644 for (i = 0; i < ntups; i++) { -@@ -2427,6 +2458,7 @@ getNamespaces(int *numNamespaces) +@@ -2428,6 +2459,7 @@ getNamespaces(int *numNamespaces) nsinfo[i].dobj.name = strdup(PQgetvalue(res, i, i_nspname)); nsinfo[i].rolname = strdup(PQgetvalue(res, i, i_rolname)); nsinfo[i].nspacl = strdup(PQgetvalue(res, i, i_nspacl)); @@ -16774,7 +16567,7 @@ index 2431d71..e7ef296 100644 /* Decide whether to dump this namespace */ selectDumpableNamespace(&nsinfo[i]); -@@ -2515,6 +2547,7 @@ getTypes(int *numTypes) +@@ -2516,6 +2548,7 @@ getTypes(int *numTypes) int i_typtype; int i_typisdefined; int i_isarray; @@ -16782,7 +16575,7 @@ index 2431d71..e7ef296 100644 /* * we include even the built-in types because those may be used as array -@@ -2547,8 +2580,10 @@ getTypes(int *numTypes) +@@ -2548,8 +2581,10 @@ getTypes(int *numTypes) "typtype, typisdefined, " "typname[0] = '_' AND typelem != 0 AND " "(SELECT typarray FROM pg_type te WHERE oid = pg_type.typelem) = oid AS isarray " @@ -16794,7 +16587,7 @@ index 2431d71..e7ef296 100644 } else if (g_fout->remoteVersion >= 70300) { -@@ -2561,6 +2596,7 @@ getTypes(int *numTypes) +@@ -2562,6 +2597,7 @@ getTypes(int *numTypes) "ELSE (SELECT relkind FROM pg_class WHERE oid = typrelid) END AS typrelkind, " "typtype, typisdefined, " "typname[0] = '_' AND typelem != 0 AS isarray " @@ -16802,7 +16595,7 @@ index 2431d71..e7ef296 100644 "FROM pg_type", username_subquery); } -@@ -2575,6 +2611,7 @@ getTypes(int *numTypes) +@@ -2576,6 +2612,7 @@ getTypes(int *numTypes) "ELSE (SELECT relkind FROM pg_class WHERE oid = typrelid) END AS typrelkind, " "typtype, typisdefined, " "typname[0] = '_' AND typelem != 0 AS isarray " @@ -16810,7 +16603,7 @@ index 2431d71..e7ef296 100644 "FROM pg_type", username_subquery); } -@@ -2591,6 +2628,7 @@ getTypes(int *numTypes) +@@ -2592,6 +2629,7 @@ getTypes(int *numTypes) "ELSE (SELECT relkind FROM pg_class WHERE oid = typrelid) END AS typrelkind, " "typtype, typisdefined, " "typname[0] = '_' AND typelem != 0 AS isarray " @@ -16818,7 +16611,7 @@ index 2431d71..e7ef296 100644 "FROM pg_type", username_subquery); } -@@ -2615,6 +2653,7 @@ getTypes(int *numTypes) +@@ -2616,6 +2654,7 @@ getTypes(int *numTypes) i_typtype = PQfnumber(res, "typtype"); i_typisdefined = PQfnumber(res, "typisdefined"); i_isarray = PQfnumber(res, "isarray"); @@ -16826,7 +16619,7 @@ index 2431d71..e7ef296 100644 for (i = 0; i < ntups; i++) { -@@ -2642,6 +2681,8 @@ getTypes(int *numTypes) +@@ -2643,6 +2682,8 @@ getTypes(int *numTypes) else tyinfo[i].isArray = false; @@ -16835,7 +16628,7 @@ index 2431d71..e7ef296 100644 /* Decide whether we want to dump it */ selectDumpableType(&tyinfo[i]); -@@ -3407,6 +3448,7 @@ getTables(int *numTables) +@@ -3408,6 +3449,7 @@ getTables(int *numTables) int i_relhasindex; int i_relhasrules; int i_relhasoids; @@ -16843,7 +16636,7 @@ index 2431d71..e7ef296 100644 int i_relfrozenxid; int i_owning_tab; int i_owning_col; -@@ -3414,6 +3456,7 @@ getTables(int *numTables) +@@ -3415,6 +3457,7 @@ getTables(int *numTables) int i_reloptions; int i_toastreloptions; int i_reloftype; @@ -16851,7 +16644,7 @@ index 2431d71..e7ef296 100644 /* Make sure we are in proper schema */ selectSourceSchema("pg_catalog"); -@@ -3450,6 +3493,7 @@ getTables(int *numTables) +@@ -3451,6 +3494,7 @@ getTables(int *numTables) "(%s c.relowner) AS rolname, " "c.relchecks, c.relhastriggers, " "c.relhasindex, c.relhasrules, c.relhasoids, " @@ -16859,7 +16652,7 @@ index 2431d71..e7ef296 100644 "c.relfrozenxid, " "CASE WHEN c.reloftype <> 0 THEN c.reloftype::pg_catalog.regtype ELSE NULL END AS reloftype, " "d.refobjid AS owning_tab, " -@@ -3457,6 +3501,7 @@ getTables(int *numTables) +@@ -3458,6 +3502,7 @@ getTables(int *numTables) "(SELECT spcname FROM pg_tablespace t WHERE t.oid = c.reltablespace) AS reltablespace, " "array_to_string(c.reloptions, ', ') AS reloptions, " "array_to_string(array(SELECT 'toast.' || x FROM unnest(tc.reloptions) x), ', ') AS toast_reloptions " @@ -16867,7 +16660,7 @@ index 2431d71..e7ef296 100644 "FROM pg_class c " "LEFT JOIN pg_depend d ON " "(c.relkind = '%c' AND " -@@ -3467,6 +3512,7 @@ getTables(int *numTables) +@@ -3468,6 +3513,7 @@ getTables(int *numTables) "WHERE c.relkind in ('%c', '%c', '%c', '%c') " "ORDER BY c.oid", username_subquery, @@ -16875,7 +16668,7 @@ index 2431d71..e7ef296 100644 RELKIND_SEQUENCE, RELKIND_RELATION, RELKIND_SEQUENCE, RELKIND_VIEW, RELKIND_COMPOSITE_TYPE); -@@ -3483,6 +3529,7 @@ getTables(int *numTables) +@@ -3484,6 +3530,7 @@ getTables(int *numTables) "(%s c.relowner) AS rolname, " "c.relchecks, c.relhastriggers, " "c.relhasindex, c.relhasrules, c.relhasoids, " @@ -16883,7 +16676,7 @@ index 2431d71..e7ef296 100644 "c.relfrozenxid, " "NULL AS reloftype, " "d.refobjid AS owning_tab, " -@@ -3490,6 +3537,7 @@ getTables(int *numTables) +@@ -3491,6 +3538,7 @@ getTables(int *numTables) "(SELECT spcname FROM pg_tablespace t WHERE t.oid = c.reltablespace) AS reltablespace, " "array_to_string(c.reloptions, ', ') AS reloptions, " "array_to_string(array(SELECT 'toast.' || x FROM unnest(tc.reloptions) x), ', ') AS toast_reloptions " @@ -16891,7 +16684,7 @@ index 2431d71..e7ef296 100644 "FROM pg_class c " "LEFT JOIN pg_depend d ON " "(c.relkind = '%c' AND " -@@ -3500,6 +3548,7 @@ getTables(int *numTables) +@@ -3501,6 +3549,7 @@ getTables(int *numTables) "WHERE c.relkind in ('%c', '%c', '%c', '%c') " "ORDER BY c.oid", username_subquery, @@ -16899,7 +16692,7 @@ index 2431d71..e7ef296 100644 RELKIND_SEQUENCE, RELKIND_RELATION, RELKIND_SEQUENCE, RELKIND_VIEW, RELKIND_COMPOSITE_TYPE); -@@ -3516,6 +3565,7 @@ getTables(int *numTables) +@@ -3517,6 +3566,7 @@ getTables(int *numTables) "(%s relowner) AS rolname, " "relchecks, (reltriggers <> 0) AS relhastriggers, " "relhasindex, relhasrules, relhasoids, " @@ -16907,7 +16700,7 @@ index 2431d71..e7ef296 100644 "relfrozenxid, " "NULL AS reloftype, " "d.refobjid AS owning_tab, " -@@ -3523,6 +3573,7 @@ getTables(int *numTables) +@@ -3524,6 +3574,7 @@ getTables(int *numTables) "(SELECT spcname FROM pg_tablespace t WHERE t.oid = c.reltablespace) AS reltablespace, " "array_to_string(c.reloptions, ', ') AS reloptions, " "NULL AS toast_reloptions " @@ -16915,7 +16708,7 @@ index 2431d71..e7ef296 100644 "FROM pg_class c " "LEFT JOIN pg_depend d ON " "(c.relkind = '%c' AND " -@@ -3548,6 +3599,7 @@ getTables(int *numTables) +@@ -3549,6 +3600,7 @@ getTables(int *numTables) "(%s relowner) AS rolname, " "relchecks, (reltriggers <> 0) AS relhastriggers, " "relhasindex, relhasrules, relhasoids, " @@ -16923,7 +16716,7 @@ index 2431d71..e7ef296 100644 "0 AS relfrozenxid, " "NULL AS reloftype, " "d.refobjid AS owning_tab, " -@@ -3555,6 +3607,7 @@ getTables(int *numTables) +@@ -3556,6 +3608,7 @@ getTables(int *numTables) "(SELECT spcname FROM pg_tablespace t WHERE t.oid = c.reltablespace) AS reltablespace, " "NULL AS reloptions, " "NULL AS toast_reloptions " @@ -16931,7 +16724,7 @@ index 2431d71..e7ef296 100644 "FROM pg_class c " "LEFT JOIN pg_depend d ON " "(c.relkind = '%c' AND " -@@ -3580,6 +3633,7 @@ getTables(int *numTables) +@@ -3581,6 +3634,7 @@ getTables(int *numTables) "(%s relowner) AS rolname, " "relchecks, (reltriggers <> 0) AS relhastriggers, " "relhasindex, relhasrules, relhasoids, " @@ -16939,7 +16732,7 @@ index 2431d71..e7ef296 100644 "0 AS relfrozenxid, " "NULL AS reloftype, " "d.refobjid AS owning_tab, " -@@ -3587,6 +3641,7 @@ getTables(int *numTables) +@@ -3588,6 +3642,7 @@ getTables(int *numTables) "NULL AS reltablespace, " "NULL AS reloptions, " "NULL AS toast_reloptions " @@ -16947,7 +16740,7 @@ index 2431d71..e7ef296 100644 "FROM pg_class c " "LEFT JOIN pg_depend d ON " "(c.relkind = '%c' AND " -@@ -3608,6 +3663,7 @@ getTables(int *numTables) +@@ -3609,6 +3664,7 @@ getTables(int *numTables) "(%s relowner) AS rolname, " "relchecks, (reltriggers <> 0) AS relhastriggers, " "relhasindex, relhasrules, relhasoids, " @@ -16955,7 +16748,7 @@ index 2431d71..e7ef296 100644 "0 AS relfrozenxid, " "NULL AS reloftype, " "NULL::oid AS owning_tab, " -@@ -3615,6 +3671,7 @@ getTables(int *numTables) +@@ -3616,6 +3672,7 @@ getTables(int *numTables) "NULL AS reltablespace, " "NULL AS reloptions, " "NULL AS toast_reloptions " @@ -16963,7 +16756,7 @@ index 2431d71..e7ef296 100644 "FROM pg_class " "WHERE relkind IN ('%c', '%c', '%c') " "ORDER BY oid", -@@ -3631,6 +3688,7 @@ getTables(int *numTables) +@@ -3632,6 +3689,7 @@ getTables(int *numTables) "relchecks, (reltriggers <> 0) AS relhastriggers, " "relhasindex, relhasrules, " "'t'::bool AS relhasoids, " @@ -16971,7 +16764,7 @@ index 2431d71..e7ef296 100644 "0 AS relfrozenxid, " "NULL AS reloftype, " "NULL::oid AS owning_tab, " -@@ -3638,6 +3696,7 @@ getTables(int *numTables) +@@ -3639,6 +3697,7 @@ getTables(int *numTables) "NULL AS reltablespace, " "NULL AS reloptions, " "NULL AS toast_reloptions " @@ -16979,7 +16772,7 @@ index 2431d71..e7ef296 100644 "FROM pg_class " "WHERE relkind IN ('%c', '%c', '%c') " "ORDER BY oid", -@@ -3671,6 +3730,7 @@ getTables(int *numTables) +@@ -3672,6 +3731,7 @@ getTables(int *numTables) "NULL AS reltablespace, " "NULL AS reloptions, " "NULL AS toast_reloptions " @@ -16987,7 +16780,7 @@ index 2431d71..e7ef296 100644 "FROM pg_class c " "WHERE relkind IN ('%c', '%c') " "ORDER BY oid", -@@ -3709,6 +3769,7 @@ getTables(int *numTables) +@@ -3710,6 +3770,7 @@ getTables(int *numTables) i_relhasindex = PQfnumber(res, "relhasindex"); i_relhasrules = PQfnumber(res, "relhasrules"); i_relhasoids = PQfnumber(res, "relhasoids"); @@ -16995,7 +16788,7 @@ index 2431d71..e7ef296 100644 i_relfrozenxid = PQfnumber(res, "relfrozenxid"); i_owning_tab = PQfnumber(res, "owning_tab"); i_owning_col = PQfnumber(res, "owning_col"); -@@ -3716,6 +3777,7 @@ getTables(int *numTables) +@@ -3717,6 +3778,7 @@ getTables(int *numTables) i_reloptions = PQfnumber(res, "reloptions"); i_toastreloptions = PQfnumber(res, "toast_reloptions"); i_reloftype = PQfnumber(res, "reloftype"); @@ -17003,7 +16796,7 @@ index 2431d71..e7ef296 100644 if (lockWaitTimeout && g_fout->remoteVersion >= 70300) { -@@ -3748,6 +3810,7 @@ getTables(int *numTables) +@@ -3749,6 +3811,7 @@ getTables(int *numTables) tblinfo[i].hasrules = (strcmp(PQgetvalue(res, i, i_relhasrules), "t") == 0); tblinfo[i].hastriggers = (strcmp(PQgetvalue(res, i, i_relhastriggers), "t") == 0); tblinfo[i].hasoids = (strcmp(PQgetvalue(res, i, i_relhasoids), "t") == 0); @@ -17011,7 +16804,7 @@ index 2431d71..e7ef296 100644 tblinfo[i].frozenxid = atooid(PQgetvalue(res, i, i_relfrozenxid)); if (PQgetisnull(res, i, i_reloftype)) tblinfo[i].reloftype = NULL; -@@ -3767,6 +3830,7 @@ getTables(int *numTables) +@@ -3768,6 +3831,7 @@ getTables(int *numTables) tblinfo[i].reltablespace = strdup(PQgetvalue(res, i, i_reltablespace)); tblinfo[i].reloptions = strdup(PQgetvalue(res, i, i_reloptions)); tblinfo[i].toast_reloptions = strdup(PQgetvalue(res, i, i_toastreloptions)); @@ -17019,7 +16812,7 @@ index 2431d71..e7ef296 100644 /* other fields were zeroed above */ -@@ -5082,6 +5146,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) +@@ -5083,6 +5147,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) int i_attalign; int i_attislocal; int i_attoptions; @@ -17027,7 +16820,7 @@ index 2431d71..e7ef296 100644 PGresult *res; int ntups; bool hasdefaults; -@@ -5128,11 +5193,13 @@ getTableAttrs(TableInfo *tblinfo, int numTables) +@@ -5129,11 +5194,13 @@ getTableAttrs(TableInfo *tblinfo, int numTables) "a.attlen, a.attalign, a.attislocal, " "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, " "array_to_string(attoptions, ', ') AS attoptions " @@ -17041,7 +16834,7 @@ index 2431d71..e7ef296 100644 tbinfo->dobj.catId.oid); } else if (g_fout->remoteVersion >= 70300) -@@ -5144,6 +5211,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) +@@ -5145,6 +5212,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) "a.attlen, a.attalign, a.attislocal, " "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, " "'' AS attoptions " @@ -17049,7 +16842,7 @@ index 2431d71..e7ef296 100644 "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " "ON a.atttypid = t.oid " "WHERE a.attrelid = '%u'::pg_catalog.oid " -@@ -5165,6 +5233,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) +@@ -5166,6 +5234,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) "a.attalign, false AS attislocal, " "format_type(t.oid,a.atttypmod) AS atttypname, " "'' AS attoptions " @@ -17057,7 +16850,7 @@ index 2431d71..e7ef296 100644 "FROM pg_attribute a LEFT JOIN pg_type t " "ON a.atttypid = t.oid " "WHERE a.attrelid = '%u'::oid " -@@ -5183,6 +5252,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) +@@ -5184,6 +5253,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) "false AS attislocal, " "(SELECT typname FROM pg_type WHERE oid = atttypid) AS atttypname, " "'' AS attoptions " @@ -17065,7 +16858,7 @@ index 2431d71..e7ef296 100644 "FROM pg_attribute a " "WHERE attrelid = '%u'::oid " "AND attnum > 0::int2 " -@@ -5209,6 +5279,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) +@@ -5210,6 +5280,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) i_attalign = PQfnumber(res, "attalign"); i_attislocal = PQfnumber(res, "attislocal"); i_attoptions = PQfnumber(res, "attoptions"); @@ -17073,7 +16866,7 @@ index 2431d71..e7ef296 100644 tbinfo->numatts = ntups; tbinfo->attnames = (char **) malloc(ntups * sizeof(char *)); -@@ -5227,6 +5298,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) +@@ -5228,6 +5299,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) tbinfo->inhAttrs = (bool *) malloc(ntups * sizeof(bool)); tbinfo->inhAttrDef = (bool *) malloc(ntups * sizeof(bool)); tbinfo->inhNotNull = (bool *) malloc(ntups * sizeof(bool)); @@ -17081,7 +16874,7 @@ index 2431d71..e7ef296 100644 hasdefaults = false; for (j = 0; j < ntups; j++) -@@ -5256,6 +5328,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) +@@ -5257,6 +5329,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) tbinfo->inhAttrs[j] = false; tbinfo->inhAttrDef[j] = false; tbinfo->inhNotNull[j] = false; @@ -17089,7 +16882,7 @@ index 2431d71..e7ef296 100644 } PQclear(res); -@@ -6146,7 +6219,7 @@ dumpComment(Archive *fout, const char *target, +@@ -6147,7 +6220,7 @@ dumpComment(Archive *fout, const char *target, */ ArchiveEntry(fout, nilCatalogId, createDumpId(), target, namespace, NULL, owner, @@ -17098,7 +16891,7 @@ index 2431d71..e7ef296 100644 query->data, "", NULL, &(dumpId), 1, NULL, NULL); -@@ -6207,7 +6280,7 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo, +@@ -6208,7 +6281,7 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo, target->data, tbinfo->dobj.namespace->dobj.name, NULL, tbinfo->rolname, @@ -17107,7 +16900,7 @@ index 2431d71..e7ef296 100644 query->data, "", NULL, &(tbinfo->dobj.dumpId), 1, NULL, NULL); -@@ -6229,7 +6302,7 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo, +@@ -6230,7 +6303,7 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo, target->data, tbinfo->dobj.namespace->dobj.name, NULL, tbinfo->rolname, @@ -17116,7 +16909,7 @@ index 2431d71..e7ef296 100644 query->data, "", NULL, &(tbinfo->dobj.dumpId), 1, NULL, NULL); -@@ -6509,7 +6582,7 @@ dumpDumpableObject(Archive *fout, DumpableObject *dobj) +@@ -6510,7 +6583,7 @@ dumpDumpableObject(Archive *fout, DumpableObject *dobj) case DO_BLOB_DATA: ArchiveEntry(fout, dobj->catId, dobj->dumpId, dobj->name, NULL, NULL, "", @@ -17125,7 +16918,7 @@ index 2431d71..e7ef296 100644 "", "", NULL, dobj->dependencies, dobj->nDeps, dumpBlobs, NULL); -@@ -6549,7 +6622,7 @@ dumpNamespace(Archive *fout, NamespaceInfo *nspinfo) +@@ -6550,7 +6623,7 @@ dumpNamespace(Archive *fout, NamespaceInfo *nspinfo) nspinfo->dobj.name, NULL, NULL, nspinfo->rolname, @@ -17134,7 +16927,7 @@ index 2431d71..e7ef296 100644 q->data, delq->data, NULL, nspinfo->dobj.dependencies, nspinfo->dobj.nDeps, NULL, NULL); -@@ -6561,6 +6634,9 @@ dumpNamespace(Archive *fout, NamespaceInfo *nspinfo) +@@ -6562,6 +6635,9 @@ dumpNamespace(Archive *fout, NamespaceInfo *nspinfo) NULL, nspinfo->rolname, nspinfo->dobj.catId, 0, nspinfo->dobj.dumpId); @@ -17144,7 +16937,7 @@ index 2431d71..e7ef296 100644 dumpACL(fout, nspinfo->dobj.catId, nspinfo->dobj.dumpId, "SCHEMA", qnspname, NULL, nspinfo->dobj.name, NULL, nspinfo->rolname, nspinfo->nspacl); -@@ -6678,7 +6754,7 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo) +@@ -6679,7 +6755,7 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo) tyinfo->dobj.name, tyinfo->dobj.namespace->dobj.name, NULL, @@ -17153,7 +16946,7 @@ index 2431d71..e7ef296 100644 "TYPE", SECTION_PRE_DATA, q->data, delq->data, NULL, tyinfo->dobj.dependencies, tyinfo->dobj.nDeps, -@@ -6692,6 +6768,12 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo) +@@ -6693,6 +6769,12 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo) tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); @@ -17166,7 +16959,7 @@ index 2431d71..e7ef296 100644 PQclear(res); destroyPQExpBuffer(q); destroyPQExpBuffer(delq); -@@ -7054,7 +7136,7 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo) +@@ -7055,7 +7137,7 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo) tyinfo->dobj.name, tyinfo->dobj.namespace->dobj.name, NULL, @@ -17175,7 +16968,7 @@ index 2431d71..e7ef296 100644 "TYPE", SECTION_PRE_DATA, q->data, delq->data, NULL, tyinfo->dobj.dependencies, tyinfo->dobj.nDeps, -@@ -7068,6 +7150,12 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo) +@@ -7069,6 +7151,12 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo) tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); @@ -17188,7 +16981,7 @@ index 2431d71..e7ef296 100644 PQclear(res); destroyPQExpBuffer(q); destroyPQExpBuffer(delq); -@@ -7178,7 +7266,7 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo) +@@ -7179,7 +7267,7 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo) tyinfo->dobj.name, tyinfo->dobj.namespace->dobj.name, NULL, @@ -17197,7 +16990,7 @@ index 2431d71..e7ef296 100644 "DOMAIN", SECTION_PRE_DATA, q->data, delq->data, NULL, tyinfo->dobj.dependencies, tyinfo->dobj.nDeps, -@@ -7192,6 +7280,12 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo) +@@ -7193,6 +7281,12 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo) tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); @@ -17210,7 +17003,7 @@ index 2431d71..e7ef296 100644 destroyPQExpBuffer(q); destroyPQExpBuffer(delq); destroyPQExpBuffer(query); -@@ -7283,7 +7377,7 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) +@@ -7284,7 +7378,7 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) tyinfo->dobj.name, tyinfo->dobj.namespace->dobj.name, NULL, @@ -17219,7 +17012,7 @@ index 2431d71..e7ef296 100644 "TYPE", SECTION_PRE_DATA, q->data, delq->data, NULL, tyinfo->dobj.dependencies, tyinfo->dobj.nDeps, -@@ -7298,6 +7392,12 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) +@@ -7299,6 +7393,12 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); @@ -17232,7 +17025,7 @@ index 2431d71..e7ef296 100644 PQclear(res); destroyPQExpBuffer(q); destroyPQExpBuffer(delq); -@@ -7402,7 +7502,7 @@ dumpCompositeTypeColComments(Archive *fout, TypeInfo *tyinfo) +@@ -7403,7 +7503,7 @@ dumpCompositeTypeColComments(Archive *fout, TypeInfo *tyinfo) target->data, tyinfo->dobj.namespace->dobj.name, NULL, tyinfo->rolname, @@ -17241,7 +17034,7 @@ index 2431d71..e7ef296 100644 query->data, "", NULL, &(tyinfo->dobj.dumpId), 1, NULL, NULL); -@@ -7454,7 +7554,7 @@ dumpShellType(Archive *fout, ShellTypeInfo *stinfo) +@@ -7455,7 +7555,7 @@ dumpShellType(Archive *fout, ShellTypeInfo *stinfo) stinfo->dobj.name, stinfo->dobj.namespace->dobj.name, NULL, @@ -17250,7 +17043,7 @@ index 2431d71..e7ef296 100644 "SHELL TYPE", SECTION_PRE_DATA, q->data, "", NULL, stinfo->dobj.dependencies, stinfo->dobj.nDeps, -@@ -7609,7 +7709,7 @@ dumpProcLang(Archive *fout, ProcLangInfo *plang) +@@ -7610,7 +7710,7 @@ dumpProcLang(Archive *fout, ProcLangInfo *plang) ArchiveEntry(fout, plang->dobj.catId, plang->dobj.dumpId, plang->dobj.name, lanschema, NULL, plang->lanowner, @@ -17259,7 +17052,7 @@ index 2431d71..e7ef296 100644 defqry->data, delqry->data, NULL, plang->dobj.dependencies, plang->dobj.nDeps, NULL, NULL); -@@ -7795,6 +7895,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7796,6 +7896,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) char **argmodes = NULL; char **argnames = NULL; char **configitems = NULL; @@ -17267,7 +17060,7 @@ index 2431d71..e7ef296 100644 int nconfigitems = 0; int i; -@@ -7825,8 +7926,10 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7826,8 +7927,10 @@ dumpFunc(Archive *fout, FuncInfo *finfo) "proiswindow, provolatile, proisstrict, prosecdef, " "proconfig, procost, prorows, " "(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) AS lanname " @@ -17278,7 +17071,7 @@ index 2431d71..e7ef296 100644 finfo->dobj.catId.oid); } else if (g_fout->remoteVersion >= 80300) -@@ -7838,6 +7941,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7839,6 +7942,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) "provolatile, proisstrict, prosecdef, " "proconfig, procost, prorows, " "(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) AS lanname " @@ -17286,7 +17079,7 @@ index 2431d71..e7ef296 100644 "FROM pg_catalog.pg_proc " "WHERE oid = '%u'::pg_catalog.oid", finfo->dobj.catId.oid); -@@ -7851,6 +7955,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7852,6 +7956,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) "provolatile, proisstrict, prosecdef, " "null AS proconfig, 0 AS procost, 0 AS prorows, " "(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) AS lanname " @@ -17294,7 +17087,7 @@ index 2431d71..e7ef296 100644 "FROM pg_catalog.pg_proc " "WHERE oid = '%u'::pg_catalog.oid", finfo->dobj.catId.oid); -@@ -7866,6 +7971,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7867,6 +7972,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) "provolatile, proisstrict, prosecdef, " "null AS proconfig, 0 AS procost, 0 AS prorows, " "(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) AS lanname " @@ -17302,7 +17095,7 @@ index 2431d71..e7ef296 100644 "FROM pg_catalog.pg_proc " "WHERE oid = '%u'::pg_catalog.oid", finfo->dobj.catId.oid); -@@ -7881,6 +7987,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7882,6 +7988,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) "provolatile, proisstrict, prosecdef, " "null AS proconfig, 0 AS procost, 0 AS prorows, " "(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) AS lanname " @@ -17310,7 +17103,7 @@ index 2431d71..e7ef296 100644 "FROM pg_catalog.pg_proc " "WHERE oid = '%u'::pg_catalog.oid", finfo->dobj.catId.oid); -@@ -7898,6 +8005,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7899,6 +8006,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) "false AS prosecdef, " "null AS proconfig, 0 AS procost, 0 AS prorows, " "(SELECT lanname FROM pg_language WHERE oid = prolang) AS lanname " @@ -17318,7 +17111,7 @@ index 2431d71..e7ef296 100644 "FROM pg_proc " "WHERE oid = '%u'::oid", finfo->dobj.catId.oid); -@@ -7915,6 +8023,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7916,6 +8024,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) "false AS prosecdef, " "NULL AS proconfig, 0 AS procost, 0 AS prorows, " "(SELECT lanname FROM pg_language WHERE oid = prolang) AS lanname " @@ -17326,7 +17119,7 @@ index 2431d71..e7ef296 100644 "FROM pg_proc " "WHERE oid = '%u'::oid", finfo->dobj.catId.oid); -@@ -7959,6 +8068,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7960,6 +8069,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) procost = PQgetvalue(res, 0, PQfnumber(res, "procost")); prorows = PQgetvalue(res, 0, PQfnumber(res, "prorows")); lanname = PQgetvalue(res, 0, PQfnumber(res, "lanname")); @@ -17334,7 +17127,7 @@ index 2431d71..e7ef296 100644 /* * See backend/commands/functioncmds.c for details of how the 'AS' clause -@@ -8169,7 +8279,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -8170,7 +8280,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) funcsig_tag, finfo->dobj.namespace->dobj.name, NULL, @@ -17343,7 +17136,7 @@ index 2431d71..e7ef296 100644 "FUNCTION", SECTION_PRE_DATA, q->data, delqry->data, NULL, finfo->dobj.dependencies, finfo->dobj.nDeps, -@@ -8182,6 +8292,12 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -8183,6 +8293,12 @@ dumpFunc(Archive *fout, FuncInfo *finfo) finfo->dobj.namespace->dobj.name, finfo->rolname, finfo->dobj.catId, 0, finfo->dobj.dumpId); @@ -17356,7 +17149,7 @@ index 2431d71..e7ef296 100644 dumpACL(fout, finfo->dobj.catId, finfo->dobj.dumpId, "FUNCTION", funcsig, NULL, funcsig_tag, finfo->dobj.namespace->dobj.name, -@@ -8323,7 +8439,7 @@ dumpCast(Archive *fout, CastInfo *cast) +@@ -8324,7 +8440,7 @@ dumpCast(Archive *fout, CastInfo *cast) ArchiveEntry(fout, cast->dobj.catId, cast->dobj.dumpId, castsig->data, "pg_catalog", NULL, "", @@ -17365,7 +17158,7 @@ index 2431d71..e7ef296 100644 defqry->data, delqry->data, NULL, cast->dobj.dependencies, cast->dobj.nDeps, NULL, NULL); -@@ -8567,7 +8683,7 @@ dumpOpr(Archive *fout, OprInfo *oprinfo) +@@ -8568,7 +8684,7 @@ dumpOpr(Archive *fout, OprInfo *oprinfo) oprinfo->dobj.namespace->dobj.name, NULL, oprinfo->rolname, @@ -17374,7 +17167,7 @@ index 2431d71..e7ef296 100644 q->data, delq->data, NULL, oprinfo->dobj.dependencies, oprinfo->dobj.nDeps, NULL, NULL); -@@ -9026,7 +9142,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) +@@ -9027,7 +9143,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) opcinfo->dobj.namespace->dobj.name, NULL, opcinfo->rolname, @@ -17383,7 +17176,7 @@ index 2431d71..e7ef296 100644 q->data, delq->data, NULL, opcinfo->dobj.dependencies, opcinfo->dobj.nDeps, NULL, NULL); -@@ -9307,7 +9423,7 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) +@@ -9308,7 +9424,7 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) opfinfo->dobj.namespace->dobj.name, NULL, opfinfo->rolname, @@ -17392,7 +17185,7 @@ index 2431d71..e7ef296 100644 q->data, delq->data, NULL, opfinfo->dobj.dependencies, opfinfo->dobj.nDeps, NULL, NULL); -@@ -9423,7 +9539,7 @@ dumpConversion(Archive *fout, ConvInfo *convinfo) +@@ -9424,7 +9540,7 @@ dumpConversion(Archive *fout, ConvInfo *convinfo) convinfo->dobj.namespace->dobj.name, NULL, convinfo->rolname, @@ -17401,7 +17194,7 @@ index 2431d71..e7ef296 100644 q->data, delq->data, NULL, convinfo->dobj.dependencies, convinfo->dobj.nDeps, NULL, NULL); -@@ -9504,11 +9620,13 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9505,11 +9621,13 @@ dumpAgg(Archive *fout, AggInfo *agginfo) int i_aggtranstype; int i_agginitval; int i_convertok; @@ -17415,7 +17208,7 @@ index 2431d71..e7ef296 100644 bool convertok; /* Skip if not to be dumped */ -@@ -9531,9 +9649,11 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9532,9 +9650,11 @@ dumpAgg(Archive *fout, AggInfo *agginfo) "aggsortop::pg_catalog.regoperator, " "agginitval, " "'t'::boolean AS convertok " @@ -17427,7 +17220,7 @@ index 2431d71..e7ef296 100644 agginfo->aggfn.dobj.catId.oid); } else if (g_fout->remoteVersion >= 70300) -@@ -9543,6 +9663,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9544,6 +9664,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) "0 AS aggsortop, " "agginitval, " "'t'::boolean AS convertok " @@ -17435,7 +17228,7 @@ index 2431d71..e7ef296 100644 "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " "WHERE a.aggfnoid = p.oid " "AND p.oid = '%u'::pg_catalog.oid", -@@ -9555,6 +9676,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9556,6 +9677,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) "0 AS aggsortop, " "agginitval, " "'t'::boolean AS convertok " @@ -17443,7 +17236,7 @@ index 2431d71..e7ef296 100644 "FROM pg_aggregate " "WHERE oid = '%u'::oid", agginfo->aggfn.dobj.catId.oid); -@@ -9567,6 +9689,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9568,6 +9690,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) "0 AS aggsortop, " "agginitval1 AS agginitval, " "(aggtransfn2 = 0 and aggtranstype2 = 0 and agginitval2 is null) AS convertok " @@ -17451,7 +17244,7 @@ index 2431d71..e7ef296 100644 "FROM pg_aggregate " "WHERE oid = '%u'::oid", agginfo->aggfn.dobj.catId.oid); -@@ -9592,6 +9715,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9593,6 +9716,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) i_aggtranstype = PQfnumber(res, "aggtranstype"); i_agginitval = PQfnumber(res, "agginitval"); i_convertok = PQfnumber(res, "convertok"); @@ -17459,7 +17252,7 @@ index 2431d71..e7ef296 100644 aggtransfn = PQgetvalue(res, 0, i_aggtransfn); aggfinalfn = PQgetvalue(res, 0, i_aggfinalfn); -@@ -9599,6 +9723,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9600,6 +9724,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) aggtranstype = PQgetvalue(res, 0, i_aggtranstype); agginitval = PQgetvalue(res, 0, i_agginitval); convertok = (PQgetvalue(res, 0, i_convertok)[0] == 't'); @@ -17467,7 +17260,7 @@ index 2431d71..e7ef296 100644 aggsig = format_aggregate_signature(agginfo, fout, true); aggsig_tag = format_aggregate_signature(agginfo, fout, false); -@@ -9667,7 +9792,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9668,7 +9793,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) agginfo->aggfn.dobj.namespace->dobj.name, NULL, agginfo->aggfn.rolname, @@ -17476,7 +17269,7 @@ index 2431d71..e7ef296 100644 q->data, delq->data, NULL, agginfo->aggfn.dobj.dependencies, agginfo->aggfn.dobj.nDeps, NULL, NULL); -@@ -9679,6 +9804,12 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9680,6 +9805,12 @@ dumpAgg(Archive *fout, AggInfo *agginfo) agginfo->aggfn.dobj.namespace->dobj.name, agginfo->aggfn.rolname, agginfo->aggfn.dobj.catId, 0, agginfo->aggfn.dobj.dumpId); @@ -17489,7 +17282,7 @@ index 2431d71..e7ef296 100644 /* * Since there is no GRANT ON AGGREGATE syntax, we have to make the ACL * command look like a function's GRANT; in particular this affects the -@@ -9755,7 +9886,7 @@ dumpTSParser(Archive *fout, TSParserInfo *prsinfo) +@@ -9756,7 +9887,7 @@ dumpTSParser(Archive *fout, TSParserInfo *prsinfo) prsinfo->dobj.namespace->dobj.name, NULL, "", @@ -17498,7 +17291,7 @@ index 2431d71..e7ef296 100644 q->data, delq->data, NULL, prsinfo->dobj.dependencies, prsinfo->dobj.nDeps, NULL, NULL); -@@ -9847,7 +9978,7 @@ dumpTSDictionary(Archive *fout, TSDictInfo *dictinfo) +@@ -9848,7 +9979,7 @@ dumpTSDictionary(Archive *fout, TSDictInfo *dictinfo) dictinfo->dobj.namespace->dobj.name, NULL, dictinfo->rolname, @@ -17507,7 +17300,7 @@ index 2431d71..e7ef296 100644 q->data, delq->data, NULL, dictinfo->dobj.dependencies, dictinfo->dobj.nDeps, NULL, NULL); -@@ -9907,7 +10038,7 @@ dumpTSTemplate(Archive *fout, TSTemplateInfo *tmplinfo) +@@ -9908,7 +10039,7 @@ dumpTSTemplate(Archive *fout, TSTemplateInfo *tmplinfo) tmplinfo->dobj.namespace->dobj.name, NULL, "", @@ -17516,7 +17309,7 @@ index 2431d71..e7ef296 100644 q->data, delq->data, NULL, tmplinfo->dobj.dependencies, tmplinfo->dobj.nDeps, NULL, NULL); -@@ -10040,7 +10171,7 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo) +@@ -10041,7 +10172,7 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo) cfginfo->dobj.namespace->dobj.name, NULL, cfginfo->rolname, @@ -17525,7 +17318,7 @@ index 2431d71..e7ef296 100644 q->data, delq->data, NULL, cfginfo->dobj.dependencies, cfginfo->dobj.nDeps, NULL, NULL); -@@ -10096,7 +10227,7 @@ dumpForeignDataWrapper(Archive *fout, FdwInfo *fdwinfo) +@@ -10097,7 +10228,7 @@ dumpForeignDataWrapper(Archive *fout, FdwInfo *fdwinfo) NULL, NULL, fdwinfo->rolname, @@ -17534,7 +17327,7 @@ index 2431d71..e7ef296 100644 q->data, delq->data, NULL, fdwinfo->dobj.dependencies, fdwinfo->dobj.nDeps, NULL, NULL); -@@ -10183,7 +10314,7 @@ dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo) +@@ -10185,7 +10316,7 @@ dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo) NULL, NULL, srvinfo->rolname, @@ -17543,7 +17336,7 @@ index 2431d71..e7ef296 100644 q->data, delq->data, NULL, srvinfo->dobj.dependencies, srvinfo->dobj.nDeps, NULL, NULL); -@@ -10279,7 +10410,7 @@ dumpUserMappings(Archive *fout, const char *target, +@@ -10290,7 +10421,7 @@ dumpUserMappings(Archive *fout, tag->data, namespace, NULL, @@ -17552,7 +17345,7 @@ index 2431d71..e7ef296 100644 "USER MAPPING", SECTION_PRE_DATA, q->data, delq->data, NULL, &dumpId, 1, -@@ -10350,7 +10481,7 @@ dumpDefaultACL(Archive *fout, DefaultACLInfo *daclinfo) +@@ -10361,7 +10492,7 @@ dumpDefaultACL(Archive *fout, DefaultACLInfo *daclinfo) daclinfo->dobj.namespace ? daclinfo->dobj.namespace->dobj.name : NULL, NULL, daclinfo->defaclrole, @@ -17561,7 +17354,7 @@ index 2431d71..e7ef296 100644 q->data, "", NULL, daclinfo->dobj.dependencies, daclinfo->dobj.nDeps, NULL, NULL); -@@ -10407,7 +10538,7 @@ dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId, +@@ -10418,7 +10549,7 @@ dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId, tag, nspname, NULL, owner ? owner : "", @@ -17570,7 +17363,7 @@ index 2431d71..e7ef296 100644 sql->data, "", NULL, &(objDumpId), 1, NULL, NULL); -@@ -10416,6 +10547,123 @@ dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId, +@@ -10427,6 +10558,123 @@ dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId, } /* @@ -17694,7 +17487,7 @@ index 2431d71..e7ef296 100644 * dumpTable * write out to fout the declarations (not data) of a user-defined table */ -@@ -10571,7 +10819,6 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) +@@ -10582,7 +10830,6 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) appendPQExpBuffer(q, "CREATE VIEW %s AS\n %s\n", fmtId(tbinfo->dobj.name), viewdef); @@ -17702,7 +17495,7 @@ index 2431d71..e7ef296 100644 PQclear(res); } else -@@ -10922,6 +11169,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) +@@ -10933,6 +11180,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) (tbinfo->relkind == RELKIND_VIEW) ? NULL : tbinfo->reltablespace, tbinfo->rolname, (strcmp(reltypename, "TABLE") == 0) ? tbinfo->hasoids : false, @@ -17710,7 +17503,7 @@ index 2431d71..e7ef296 100644 reltypename, SECTION_PRE_DATA, q->data, delq->data, NULL, tbinfo->dobj.dependencies, tbinfo->dobj.nDeps, -@@ -10942,6 +11190,27 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) +@@ -10953,6 +11201,27 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) dumpTableConstraintComment(fout, constr); } @@ -17738,7 +17531,7 @@ index 2431d71..e7ef296 100644 destroyPQExpBuffer(query); destroyPQExpBuffer(q); destroyPQExpBuffer(delq); -@@ -10990,7 +11259,7 @@ dumpAttrDef(Archive *fout, AttrDefInfo *adinfo) +@@ -11001,7 +11270,7 @@ dumpAttrDef(Archive *fout, AttrDefInfo *adinfo) tbinfo->dobj.namespace->dobj.name, NULL, tbinfo->rolname, @@ -17747,7 +17540,7 @@ index 2431d71..e7ef296 100644 q->data, delq->data, NULL, adinfo->dobj.dependencies, adinfo->dobj.nDeps, NULL, NULL); -@@ -11086,7 +11355,7 @@ dumpIndex(Archive *fout, IndxInfo *indxinfo) +@@ -11097,7 +11366,7 @@ dumpIndex(Archive *fout, IndxInfo *indxinfo) indxinfo->dobj.name, tbinfo->dobj.namespace->dobj.name, indxinfo->tablespace, @@ -17756,7 +17549,7 @@ index 2431d71..e7ef296 100644 "INDEX", SECTION_POST_DATA, q->data, delq->data, NULL, indxinfo->dobj.dependencies, indxinfo->dobj.nDeps, -@@ -11211,7 +11480,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) +@@ -11222,7 +11491,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) coninfo->dobj.name, tbinfo->dobj.namespace->dobj.name, indxinfo->tablespace, @@ -17765,7 +17558,7 @@ index 2431d71..e7ef296 100644 "CONSTRAINT", SECTION_POST_DATA, q->data, delq->data, NULL, coninfo->dobj.dependencies, coninfo->dobj.nDeps, -@@ -11244,7 +11513,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) +@@ -11255,7 +11524,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) coninfo->dobj.name, tbinfo->dobj.namespace->dobj.name, NULL, @@ -17774,7 +17567,7 @@ index 2431d71..e7ef296 100644 "FK CONSTRAINT", SECTION_POST_DATA, q->data, delq->data, NULL, coninfo->dobj.dependencies, coninfo->dobj.nDeps, -@@ -11279,7 +11548,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) +@@ -11290,7 +11559,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) coninfo->dobj.name, tbinfo->dobj.namespace->dobj.name, NULL, @@ -17783,7 +17576,7 @@ index 2431d71..e7ef296 100644 "CHECK CONSTRAINT", SECTION_POST_DATA, q->data, delq->data, NULL, coninfo->dobj.dependencies, coninfo->dobj.nDeps, -@@ -11315,7 +11584,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) +@@ -11326,7 +11595,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) coninfo->dobj.name, tyinfo->dobj.namespace->dobj.name, NULL, @@ -17792,7 +17585,7 @@ index 2431d71..e7ef296 100644 "CHECK CONSTRAINT", SECTION_POST_DATA, q->data, delq->data, NULL, coninfo->dobj.dependencies, coninfo->dobj.nDeps, -@@ -11601,7 +11870,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) +@@ -11612,7 +11881,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) tbinfo->dobj.namespace->dobj.name, NULL, tbinfo->rolname, @@ -17801,7 +17594,7 @@ index 2431d71..e7ef296 100644 query->data, delqry->data, NULL, tbinfo->dobj.dependencies, tbinfo->dobj.nDeps, NULL, NULL); -@@ -11637,7 +11906,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) +@@ -11648,7 +11917,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) tbinfo->dobj.namespace->dobj.name, NULL, tbinfo->rolname, @@ -17810,7 +17603,7 @@ index 2431d71..e7ef296 100644 query->data, "", NULL, &(tbinfo->dobj.dumpId), 1, NULL, NULL); -@@ -11650,6 +11919,12 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) +@@ -11661,6 +11930,12 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) dumpComment(fout, query->data, tbinfo->dobj.namespace->dobj.name, tbinfo->rolname, tbinfo->dobj.catId, 0, tbinfo->dobj.dumpId); @@ -17823,7 +17616,7 @@ index 2431d71..e7ef296 100644 } if (!schemaOnly) -@@ -11665,7 +11940,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) +@@ -11676,7 +11951,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) tbinfo->dobj.namespace->dobj.name, NULL, tbinfo->rolname, @@ -17832,7 +17625,7 @@ index 2431d71..e7ef296 100644 query->data, "", NULL, &(tbinfo->dobj.dumpId), 1, NULL, NULL); -@@ -11849,7 +12124,7 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo) +@@ -11860,7 +12135,7 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo) tginfo->dobj.name, tbinfo->dobj.namespace->dobj.name, NULL, @@ -17841,7 +17634,7 @@ index 2431d71..e7ef296 100644 "TRIGGER", SECTION_POST_DATA, query->data, delqry->data, NULL, tginfo->dobj.dependencies, tginfo->dobj.nDeps, -@@ -11969,7 +12244,7 @@ dumpRule(Archive *fout, RuleInfo *rinfo) +@@ -11980,7 +12255,7 @@ dumpRule(Archive *fout, RuleInfo *rinfo) rinfo->dobj.name, tbinfo->dobj.namespace->dobj.name, NULL, @@ -17850,7 +17643,7 @@ index 2431d71..e7ef296 100644 "RULE", SECTION_POST_DATA, cmd->data, delcmd->data, NULL, rinfo->dobj.dependencies, rinfo->dobj.nDeps, -@@ -12334,7 +12609,7 @@ fmtQualifiedId(const char *schema, const char *id) +@@ -12345,7 +12620,7 @@ fmtQualifiedId(const char *schema, const char *id) * "", not an invalid "()" column list. */ static const char * @@ -17859,7 +17652,7 @@ index 2431d71..e7ef296 100644 { static PQExpBuffer q = NULL; int numatts = ti->numatts; -@@ -12350,6 +12625,11 @@ fmtCopyColumnList(const TableInfo *ti) +@@ -12361,6 +12636,11 @@ fmtCopyColumnList(const TableInfo *ti) appendPQExpBuffer(q, "("); needComma = false; @@ -17872,7 +17665,7 @@ index 2431d71..e7ef296 100644 { if (attisdropped[i]) diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h -index c93bada..78a50bd 100644 +index c309f69..2a35392 100644 --- a/src/bin/pg_dump/pg_dump.h +++ b/src/bin/pg_dump/pg_dump.h @@ -137,6 +137,7 @@ typedef struct _namespaceInfo @@ -17928,7 +17721,7 @@ index c93bada..78a50bd 100644 /* global decls */ diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c -index 0c3f63f..83f1678 100644 +index 85032a9..3e4aad6 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -69,6 +69,7 @@ static int disable_triggers = 0; @@ -17956,16 +17749,16 @@ index 0c3f63f..83f1678 100644 else { fprintf(stderr, -@@ -330,6 +334,8 @@ main(int argc, char *argv[]) +@@ -368,6 +372,8 @@ main(int argc, char *argv[]) appendPQExpBuffer(pgdumpopts, " --no-tablespaces"); if (use_setsessauth) appendPQExpBuffer(pgdumpopts, " --use-set-session-authorization"); + if (security_label) + appendPQExpBuffer(pgdumpopts, " --security-label"); - if (optind < argc) - { -@@ -561,6 +567,7 @@ help(void) + /* + * If there was a database specified on the command line, use that, +@@ -562,6 +568,7 @@ help(void) printf(_(" --use-set-session-authorization\n" " use SET SESSION AUTHORIZATION commands instead of\n" " ALTER OWNER commands to set ownership\n")); @@ -17973,7 +17766,7 @@ index 0c3f63f..83f1678 100644 printf(_("\nConnection options:\n")); printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); -@@ -949,6 +956,7 @@ dropTablespaces(PGconn *conn) +@@ -950,6 +957,7 @@ dropTablespaces(PGconn *conn) static void dumpTablespaces(PGconn *conn) { @@ -17981,7 +17774,7 @@ index 0c3f63f..83f1678 100644 PGresult *res; int i; -@@ -957,31 +965,37 @@ dumpTablespaces(PGconn *conn) +@@ -958,31 +966,37 @@ dumpTablespaces(PGconn *conn) * pg_xxx) */ if (server_version >= 90000) @@ -18023,7 +17816,7 @@ index 0c3f63f..83f1678 100644 if (PQntuples(res) > 0) fprintf(OPF, "--\n-- Tablespaces\n--\n\n"); -@@ -994,6 +1008,7 @@ dumpTablespaces(PGconn *conn) +@@ -995,6 +1009,7 @@ dumpTablespaces(PGconn *conn) char *spcacl = PQgetvalue(res, i, 3); char *spcoptions = PQgetvalue(res, i, 4); char *spccomment = PQgetvalue(res, i, 5); @@ -18031,7 +17824,7 @@ index 0c3f63f..83f1678 100644 char *fspcname; /* needed for buildACLCommands() */ -@@ -1010,6 +1025,10 @@ dumpTablespaces(PGconn *conn) +@@ -1011,6 +1026,10 @@ dumpTablespaces(PGconn *conn) appendPQExpBuffer(buf, "ALTER TABLESPACE %s SET (%s);\n", fspcname, spcoptions); @@ -18042,7 +17835,7 @@ index 0c3f63f..83f1678 100644 if (!skip_acls && !buildACLCommands(fspcname, NULL, "TABLESPACE", spcacl, spcowner, "", server_version, buf)) -@@ -1153,48 +1172,48 @@ dumpCreateDB(PGconn *conn) +@@ -1154,48 +1173,48 @@ dumpCreateDB(PGconn *conn) /* Now collect all the information about databases to dump */ if (server_version >= 80400) @@ -18102,7 +17895,7 @@ index 0c3f63f..83f1678 100644 "coalesce(" "(select usename from pg_shadow where usesysid=datdba), " "(select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), " -@@ -1202,6 +1221,7 @@ dumpCreateDB(PGconn *conn) +@@ -1203,6 +1222,7 @@ dumpCreateDB(PGconn *conn) "null::text AS datcollate, null::text AS datctype, 0 AS datfrozenxid, " "datistemplate, '' as datacl, -1 as datconnlimit, " "'pg_default' AS dattablespace " @@ -18110,7 +17903,7 @@ index 0c3f63f..83f1678 100644 "FROM pg_database d " "WHERE datallowconn ORDER BY 1"); else -@@ -1210,18 +1230,20 @@ dumpCreateDB(PGconn *conn) +@@ -1211,18 +1231,20 @@ dumpCreateDB(PGconn *conn) * Note: 7.0 fails to cope with sub-select in COALESCE, so just deal * with getting a NULL by not printing any OWNER clause. */ @@ -18133,7 +17926,7 @@ index 0c3f63f..83f1678 100644 for (i = 0; i < PQntuples(res); i++) { char *dbname = PQgetvalue(res, i, 0); -@@ -1234,6 +1256,7 @@ dumpCreateDB(PGconn *conn) +@@ -1235,6 +1257,7 @@ dumpCreateDB(PGconn *conn) char *dbacl = PQgetvalue(res, i, 7); char *dbconnlimit = PQgetvalue(res, i, 8); char *dbtablespace = PQgetvalue(res, i, 9); @@ -18141,7 +17934,7 @@ index 0c3f63f..83f1678 100644 char *fdbname; fdbname = strdup(fmtId(dbname)); -@@ -1309,6 +1332,9 @@ dumpCreateDB(PGconn *conn) +@@ -1310,6 +1333,9 @@ dumpCreateDB(PGconn *conn) appendPQExpBuffer(buf, ";\n"); } } @@ -18152,7 +17945,7 @@ index 0c3f63f..83f1678 100644 if (!skip_acls && !buildACLCommands(fdbname, NULL, "DATABASE", dbacl, dbowner, diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c -index b0bcbc2..cdb2592 100644 +index dbdf7ac..03b9d67 100644 --- a/src/bin/pg_dump/pg_restore.c +++ b/src/bin/pg_dump/pg_restore.c @@ -76,6 +76,7 @@ main(int argc, char **argv) @@ -18180,7 +17973,7 @@ index b0bcbc2..cdb2592 100644 else { fprintf(stderr, -@@ -326,6 +330,7 @@ main(int argc, char **argv) +@@ -337,6 +341,7 @@ main(int argc, char **argv) opts->noDataForFailedTables = no_data_for_failed_tables; opts->noTablespace = outputNoTablespaces; opts->use_setsessauth = use_setsessauth; @@ -18188,7 +17981,7 @@ index b0bcbc2..cdb2592 100644 if (opts->formatName) { -@@ -437,6 +442,7 @@ usage(const char *progname) +@@ -448,6 +453,7 @@ usage(const char *progname) " ALTER OWNER commands to set ownership\n")); printf(_(" -1, --single-transaction\n" " restore as a single transaction\n")); @@ -18197,7 +17990,7 @@ index b0bcbc2..cdb2592 100644 printf(_("\nConnection options:\n")); printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); diff --git a/src/include/access/htup.h b/src/include/access/htup.h -index d87e888..270ff67 100644 +index 3be701b..4501289 100644 --- a/src/include/access/htup.h +++ b/src/include/access/htup.h @@ -163,7 +163,7 @@ typedef HeapTupleHeaderData *HeapTupleHeader; @@ -18270,7 +18063,7 @@ index d87e888..270ff67 100644 /* * WAL record definitions for heapam.c's WAL operations diff --git a/src/include/access/sysattr.h b/src/include/access/sysattr.h -index 59cd2cd..ad5903b 100644 +index 6047735..ce9a994 100644 --- a/src/include/access/sysattr.h +++ b/src/include/access/sysattr.h @@ -25,7 +25,8 @@ @@ -18284,7 +18077,7 @@ index 59cd2cd..ad5903b 100644 #endif /* SYSATTR_H */ diff --git a/src/include/access/tupdesc.h b/src/include/access/tupdesc.h -index 53e0be6..dea713b 100644 +index e38a6e76..d5688d5 100644 --- a/src/include/access/tupdesc.h +++ b/src/include/access/tupdesc.h @@ -75,13 +75,14 @@ typedef struct tupleDesc @@ -18305,7 +18098,7 @@ index 53e0be6..dea713b 100644 extern TupleDesc CreateTupleDescCopy(TupleDesc tupdesc); diff --git a/src/include/bootstrap/bootstrap.h b/src/include/bootstrap/bootstrap.h -index 49a32e3..f088876 100644 +index 5e989ef..c3ed1d5 100644 --- a/src/include/bootstrap/bootstrap.h +++ b/src/include/bootstrap/bootstrap.h @@ -24,6 +24,7 @@ typedef enum @@ -18317,7 +18110,7 @@ index 49a32e3..f088876 100644 NUM_AUXPROCTYPES /* Must be last! */ } AuxProcType; diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h -index 8292273..e2a86e8 100644 +index 557c311..162ad1c 100644 --- a/src/include/catalog/heap.h +++ b/src/include/catalog/heap.h @@ -61,7 +61,8 @@ extern Oid heap_create_with_catalog(const char *relname, @@ -18365,7 +18158,7 @@ index 8292273..e2a86e8 100644 extern void CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind, bool allow_system_table_mods); diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h -index 4f437fd..069256f 100644 +index 752a35e..a3da55e 100644 --- a/src/include/catalog/indexing.h +++ b/src/include/catalog/indexing.h @@ -255,6 +255,11 @@ DECLARE_UNIQUE_INDEX(pg_type_oid_index, 2703, on pg_type using btree(oid oid_ops @@ -18381,7 +18174,7 @@ index 4f437fd..069256f 100644 #define ForeignDataWrapperOidIndexId 112 diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h -index 5ea514d..0f07482 100644 +index 2296fa2..4a412aa 100644 --- a/src/include/catalog/pg_class.h +++ b/src/include/catalog/pg_class.h @@ -60,6 +60,7 @@ CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83) BKI_SCHEMA_MACRO @@ -18444,7 +18237,7 @@ index 5ea514d..0f07482 100644 #define RELKIND_INDEX 'i' /* secondary index */ diff --git a/src/include/catalog/pg_conversion_fn.h b/src/include/catalog/pg_conversion_fn.h -index d40dea6..add5fd9 100644 +index 3086936..47f49e2 100644 --- a/src/include/catalog/pg_conversion_fn.h +++ b/src/include/catalog/pg_conversion_fn.h @@ -17,7 +17,7 @@ @@ -18457,7 +18250,7 @@ index d40dea6..add5fd9 100644 extern Oid FindDefaultConversion(Oid connamespace, int32 for_encoding, int32 to_encoding); diff --git a/src/include/catalog/pg_largeobject.h b/src/include/catalog/pg_largeobject.h -index c4c4a26..6025f56 100644 +index 78b3119..cf43db1 100644 --- a/src/include/catalog/pg_largeobject.h +++ b/src/include/catalog/pg_largeobject.h @@ -51,9 +51,10 @@ typedef FormData_pg_largeobject *Form_pg_largeobject; @@ -18473,7 +18266,7 @@ index c4c4a26..6025f56 100644 #endif /* PG_LARGEOBJECT_H */ diff --git a/src/include/catalog/pg_namespace.h b/src/include/catalog/pg_namespace.h -index 425f039..0f8043d 100644 +index cc576a5..eeb1079 100644 --- a/src/include/catalog/pg_namespace.h +++ b/src/include/catalog/pg_namespace.h @@ -77,6 +77,6 @@ DESCR("standard public schema"); @@ -18485,10 +18278,10 @@ index 425f039..0f8043d 100644 #endif /* PG_NAMESPACE_H */ diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h -index f2751a4..3e024b3 100644 +index 31a9650..254e19b 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h -@@ -3719,6 +3719,10 @@ DESCR("current user privilege on role by role name"); +@@ -3715,6 +3715,10 @@ DESCR("current user privilege on role by role name"); DATA(insert OID = 2710 ( pg_has_role PGNSP PGUID 12 1 0 0 f f f t f s 2 0 16 "26 25" _null_ _null_ _null_ _null_ pg_has_role_id _null_ _null_ _null_ )); DESCR("current user privilege on role by role oid"); @@ -18500,7 +18293,7 @@ index f2751a4..3e024b3 100644 DESCR("bytes required to store the value, perhaps with compression"); DATA(insert OID = 2322 ( pg_tablespace_size PGNSP PGUID 12 1 0 0 f f f t f v 1 0 20 "26" _null_ _null_ _null_ _null_ pg_tablespace_size_oid _null_ _null_ _null_ )); diff --git a/src/include/catalog/pg_proc_fn.h b/src/include/catalog/pg_proc_fn.h -index c886f81..f2351c1 100644 +index 0cb82b0..44ee57b 100644 --- a/src/include/catalog/pg_proc_fn.h +++ b/src/include/catalog/pg_proc_fn.h @@ -37,7 +37,8 @@ extern Oid ProcedureCreate(const char *procedureName, @@ -18599,7 +18392,7 @@ index 0000000..21b25de + +#endif /* PG_SECLABEL_H */ diff --git a/src/include/catalog/pg_type_fn.h b/src/include/catalog/pg_type_fn.h -index 5cf90af..1ca2dd4 100644 +index baf3012..c344bf8 100644 --- a/src/include/catalog/pg_type_fn.h +++ b/src/include/catalog/pg_type_fn.h @@ -50,7 +50,8 @@ extern Oid TypeCreate(Oid newTypeOid, @@ -18613,7 +18406,7 @@ index 5cf90af..1ca2dd4 100644 extern void GenerateTypeDependencies(Oid typeNamespace, Oid typeObjectId, diff --git a/src/include/catalog/toasting.h b/src/include/catalog/toasting.h -index fb6f678..f642ded 100644 +index 056fd19..e99dea7 100644 --- a/src/include/catalog/toasting.h +++ b/src/include/catalog/toasting.h @@ -58,5 +58,8 @@ DECLARE_TOAST(pg_shdescription, 2846, 2847); @@ -18626,7 +18419,7 @@ index fb6f678..f642ded 100644 #endif /* TOASTING_H */ diff --git a/src/include/commands/alter.h b/src/include/commands/alter.h -index b1e04fb..6cd19ba 100644 +index 83e735a..37b772e 100644 --- a/src/include/commands/alter.h +++ b/src/include/commands/alter.h @@ -19,5 +19,6 @@ @@ -18637,7 +18430,7 @@ index b1e04fb..6cd19ba 100644 #endif /* ALTER_H */ diff --git a/src/include/commands/dbcommands.h b/src/include/commands/dbcommands.h -index 542fc27..874e07a 100644 +index f150da3..c085321 100644 --- a/src/include/commands/dbcommands.h +++ b/src/include/commands/dbcommands.h @@ -58,6 +58,7 @@ extern void RenameDatabase(const char *oldname, const char *newname); @@ -18649,7 +18442,7 @@ index 542fc27..874e07a 100644 extern Oid get_database_oid(const char *dbname); extern char *get_database_name(Oid dbid); diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h -index e8dbe81..7fc4922 100644 +index cd5be6e..9a71ae4 100644 --- a/src/include/commands/defrem.h +++ b/src/include/commands/defrem.h @@ -60,6 +60,8 @@ extern void SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType); @@ -18662,7 +18455,7 @@ index e8dbe81..7fc4922 100644 extern void CreateCast(CreateCastStmt *stmt); extern void DropCast(DropCastStmt *stmt); diff --git a/src/include/commands/schemacmds.h b/src/include/commands/schemacmds.h -index c914bd5..edd5abd 100644 +index 62562fa..d122106 100644 --- a/src/include/commands/schemacmds.h +++ b/src/include/commands/schemacmds.h @@ -26,5 +26,6 @@ extern void RemoveSchemaById(Oid schemaOid); @@ -18673,7 +18466,7 @@ index c914bd5..edd5abd 100644 #endif /* SCHEMACMDS_H */ diff --git a/src/include/commands/tablecmds.h b/src/include/commands/tablecmds.h -index f9269cc..a531f45 100644 +index c1774a2..cc6b11a 100644 --- a/src/include/commands/tablecmds.h +++ b/src/include/commands/tablecmds.h @@ -35,6 +35,13 @@ extern void AlterRelationNamespaceInternal(Relation classRel, Oid relOid, @@ -18691,7 +18484,7 @@ index f9269cc..a531f45 100644 extern void ExecuteTruncate(TruncateStmt *stmt); diff --git a/src/include/commands/tablespace.h b/src/include/commands/tablespace.h -index cf005ee..e9e8a55 100644 +index 3d46eeb..71fa5d2 100644 --- a/src/include/commands/tablespace.h +++ b/src/include/commands/tablespace.h @@ -44,6 +44,7 @@ extern void DropTableSpace(DropTableSpaceStmt *stmt); @@ -18703,7 +18496,7 @@ index cf005ee..e9e8a55 100644 extern void TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo); diff --git a/src/include/commands/typecmds.h b/src/include/commands/typecmds.h -index 8e5b610..f8c5872 100644 +index 4dc2d4f..e50a83f 100644 --- a/src/include/commands/typecmds.h +++ b/src/include/commands/typecmds.h @@ -43,5 +43,7 @@ extern void AlterTypeNamespace(List *names, const char *newschema); @@ -18715,7 +18508,7 @@ index 8e5b610..f8c5872 100644 #endif /* TYPECMDS_H */ diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h -index 820314c..7873b44 100644 +index b2424a0..609f31b 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -131,8 +131,8 @@ extern TupleHashEntry FindTupleHashEntry(TupleHashTable hashtable, @@ -18749,7 +18542,7 @@ index 820314c..7873b44 100644 extern void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg); diff --git a/src/include/fmgr.h b/src/include/fmgr.h -index d1a0dc1..e9de809 100644 +index e588bb1..1298e3e 100644 --- a/src/include/fmgr.h +++ b/src/include/fmgr.h @@ -51,6 +51,7 @@ typedef struct FmgrInfo @@ -18761,7 +18554,7 @@ index d1a0dc1..e9de809 100644 fmNodePtr fn_expr; /* expression parse tree for call, or NULL */ } FmgrInfo; diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h -index 1b5e476..37ffdfa 100644 +index 401b69e..4e2c59d 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -346,6 +346,7 @@ typedef enum NodeTag @@ -18773,7 +18566,7 @@ index 1b5e476..37ffdfa 100644 /* * TAGS FOR PARSE TREE NODES (parsenodes.h) diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h -index b591073..53609e8 100644 +index 54eebbc..94d0969 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -731,6 +731,7 @@ typedef struct RangeTblEntry @@ -18793,7 +18586,7 @@ index b591073..53609e8 100644 AT_SetTableSpace, /* SET TABLESPACE */ AT_SetRelOptions, /* SET (...) -- AM specific parameters */ AT_ResetRelOptions, /* RESET (...) -- AM specific parameters */ -@@ -2073,6 +2076,20 @@ typedef struct AlterOwnerStmt +@@ -2074,6 +2077,20 @@ typedef struct AlterOwnerStmt char *newowner; /* the new owner */ } AlterOwnerStmt; @@ -18815,7 +18608,7 @@ index b591073..53609e8 100644 /* ---------------------- * Create Rule Statement diff --git a/src/include/parser/kwlist.h b/src/include/parser/kwlist.h -index 49d4b6c..13c88a1 100644 +index 5065bd6..0c67e25 100644 --- a/src/include/parser/kwlist.h +++ b/src/include/parser/kwlist.h @@ -208,6 +208,7 @@ PG_KEYWORD("isnull", ISNULL, TYPE_FUNC_NAME_KEYWORD) @@ -18827,10 +18620,10 @@ index 49d4b6c..13c88a1 100644 PG_KEYWORD("large", LARGE_P, UNRESERVED_KEYWORD) PG_KEYWORD("last", LAST_P, UNRESERVED_KEYWORD) diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in -index 684aed4..2080c95 100644 +index fd169b6..4dd3ca7 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in -@@ -412,6 +412,9 @@ +@@ -418,6 +418,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SECURITY_PAM_APPL_H @@ -19464,7 +19257,7 @@ index 0000000..5fd7195 + +#endif /* SEPGSQL_H */ diff --git a/src/include/storage/large_object.h b/src/include/storage/large_object.h -index 43a61f3..6385b5c 100644 +index b8de372..2bd6973 100644 --- a/src/include/storage/large_object.h +++ b/src/include/storage/large_object.h @@ -70,7 +70,7 @@ typedef struct LargeObjectDesc @@ -19477,7 +19270,7 @@ index 43a61f3..6385b5c 100644 extern void inv_close(LargeObjectDesc *obj_desc); extern int inv_drop(Oid lobjId); diff --git a/src/include/storage/lwlock.h b/src/include/storage/lwlock.h -index 4eece8b..4176eac 100644 +index 0322007..f807707 100644 --- a/src/include/storage/lwlock.h +++ b/src/include/storage/lwlock.h @@ -70,6 +70,7 @@ typedef enum LWLockId @@ -19489,7 +19282,7 @@ index 4eece8b..4176eac 100644 FirstBufMappingLock, FirstLockMgrLock = FirstBufMappingLock + NUM_BUFFER_PARTITIONS, diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h -index c22c65a..5b94283 100644 +index 9eb37b88..6165c4d 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -166,6 +166,7 @@ extern bool log_btree_build_stats; @@ -19501,7 +19294,7 @@ index c22c65a..5b94283 100644 extern int log_min_error_statement; diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h -index 2f19e5c..6744782 100644 +index 9faefbe..90b7c94 100644 --- a/src/include/utils/syscache.h +++ b/src/include/utils/syscache.h @@ -101,6 +101,8 @@ extern bool SearchSysCacheExists(int cacheId, @@ -19530,7 +19323,7 @@ index 2f19e5c..6744782 100644 SearchSysCacheList(cacheId, 1, key1, 0, 0, 0) #define SearchSysCacheList2(cacheId, key1, key2) \ diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c -index 656ea73..2ce4e94 100644 +index 25d2760..9bb9d3f 100644 --- a/src/pl/plpgsql/src/pl_comp.c +++ b/src/pl/plpgsql/src/pl_comp.c @@ -1936,7 +1936,7 @@ build_row_from_vars(PLpgSQL_variable **vars, int numvars) From bd689b7bd7331fc60591704fc06bf1dbde9567dd Mon Sep 17 00:00:00 2001 From: KaiGai Kohei Date: Tue, 5 Oct 2010 21:49:04 +0900 Subject: [PATCH 2/5] upload postgresql-9.0.0.tar.gz --- .gitignore | 1 + sources | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 15f7b39..07eb4f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ postgresql-9.0beta1.tar.gz +/postgresql-9.0.0.tar.gz diff --git a/sources b/sources index 4ba8bc6..f048e2f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -acaa0852b970524b91ea9a2fd0fa61c8 postgresql-9.0beta1.tar.gz +9443b3b9c95a48d5e0713feafc209adc postgresql-9.0.0.tar.gz From 9b0f1fb6a6a15d33a6dcd4d07cfd1d04f0eb9a4a Mon Sep 17 00:00:00 2001 From: KaiGai Kohei Date: Tue, 5 Oct 2010 22:15:00 +0900 Subject: [PATCH 3/5] fixup specfile --- sepostgresql.spec | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sepostgresql.spec b/sepostgresql.spec index e31fa20..05ea0e8 100644 --- a/sepostgresql.spec +++ b/sepostgresql.spec @@ -46,9 +46,7 @@ the operating system. SE-PostgreSQL works as a userspace reference monitor to check any SQL query. %prep -#XXX - to be revert later -#%setup -q -n postgresql-%{version} -%setup -q -n postgresql-9.0beta1 +%setup -q -n postgresql-%{version} %patch0 -p1 %patch1 -p1 From b8c1f7f7174475d207605068536233066d7a83a4 Mon Sep 17 00:00:00 2001 From: KaiGai Kohei Date: Thu, 7 Oct 2010 10:09:42 +0900 Subject: [PATCH 4/5] upgrade base version v9.0.0->v9.0.1 --- .gitignore | 1 + sepostgresql-9.0-fullset.patch | 174 ++++++++++++++++----------------- sepostgresql.spec | 7 +- sources | 2 +- 4 files changed, 94 insertions(+), 90 deletions(-) diff --git a/.gitignore b/.gitignore index 07eb4f3..1b4ef6d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ postgresql-9.0beta1.tar.gz /postgresql-9.0.0.tar.gz +/postgresql-9.0.1.tar.gz diff --git a/sepostgresql-9.0-fullset.patch b/sepostgresql-9.0-fullset.patch index 01b861d..f3dddff 100644 --- a/sepostgresql-9.0-fullset.patch +++ b/sepostgresql-9.0-fullset.patch @@ -1,5 +1,5 @@ diff --git a/configure b/configure -index 7c54dc6..bb7e49c 100755 +index c4ba09e..bbed799 100755 --- a/configure +++ b/configure @@ -708,6 +708,7 @@ LDFLAGS_EX @@ -229,7 +229,7 @@ index 7c54dc6..bb7e49c 100755 # diff --git a/configure.in b/configure.in -index d7fec2c..cc3b119 100644 +index c381505..14d0aba 100644 --- a/configure.in +++ b/configure.in @@ -755,6 +755,19 @@ PGAC_ARG_BOOL(with, zlib, yes, @@ -3092,7 +3092,7 @@ index 2e5a7df..9647622 100644 /* * Modify the owner --- okay to scribble on tup because it's a copy diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c -index 4e95a83..a09eabe 100644 +index a6e1d35..50921ec 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -22,7 +22,10 @@ @@ -7374,10 +7374,10 @@ index 464183d..67d0316 100644 PG_RETURN_INT32(0); diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c -index 3e237c1..387d85d 100644 +index 6e6844b..8d58a17 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c -@@ -1824,6 +1824,7 @@ _copyRangeTblEntry(RangeTblEntry *from) +@@ -1825,6 +1825,7 @@ _copyRangeTblEntry(RangeTblEntry *from) COPY_SCALAR_FIELD(checkAsUser); COPY_BITMAPSET_FIELD(selectedCols); COPY_BITMAPSET_FIELD(modifiedCols); @@ -7385,7 +7385,7 @@ index 3e237c1..387d85d 100644 return newnode; } -@@ -2756,6 +2757,21 @@ _copyAlterOwnerStmt(AlterOwnerStmt *from) +@@ -2757,6 +2758,21 @@ _copyAlterOwnerStmt(AlterOwnerStmt *from) return newnode; } @@ -7407,7 +7407,7 @@ index 3e237c1..387d85d 100644 static RuleStmt * _copyRuleStmt(RuleStmt *from) { -@@ -3970,6 +3986,9 @@ copyObject(void *from) +@@ -3971,6 +3987,9 @@ copyObject(void *from) case T_AlterOwnerStmt: retval = _copyAlterOwnerStmt(from); break; @@ -7418,10 +7418,10 @@ index 3e237c1..387d85d 100644 retval = _copyRuleStmt(from); break; diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c -index dc5f883..33f2f5d 100644 +index 6e00584..2adfa91 100644 --- a/src/backend/nodes/equalfuncs.c +++ b/src/backend/nodes/equalfuncs.c -@@ -1308,6 +1308,19 @@ _equalAlterOwnerStmt(AlterOwnerStmt *a, AlterOwnerStmt *b) +@@ -1309,6 +1309,19 @@ _equalAlterOwnerStmt(AlterOwnerStmt *a, AlterOwnerStmt *b) } static bool @@ -7441,7 +7441,7 @@ index dc5f883..33f2f5d 100644 _equalRuleStmt(RuleStmt *a, RuleStmt *b) { COMPARE_NODE_FIELD(relation); -@@ -2187,6 +2200,7 @@ _equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b) +@@ -2188,6 +2201,7 @@ _equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b) COMPARE_SCALAR_FIELD(checkAsUser); COMPARE_BITMAPSET_FIELD(selectedCols); COMPARE_BITMAPSET_FIELD(modifiedCols); @@ -7449,7 +7449,7 @@ index dc5f883..33f2f5d 100644 return true; } -@@ -2658,6 +2672,9 @@ equal(void *a, void *b) +@@ -2659,6 +2673,9 @@ equal(void *a, void *b) case T_AlterOwnerStmt: retval = _equalAlterOwnerStmt(a, b); break; @@ -7460,10 +7460,10 @@ index dc5f883..33f2f5d 100644 retval = _equalRuleStmt(a, b); break; diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c -index 48c0888..34632d2 100644 +index ae0e2ab..36eee35 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c -@@ -2136,6 +2136,7 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node) +@@ -2137,6 +2137,7 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node) WRITE_OID_FIELD(checkAsUser); WRITE_BITMAPSET_FIELD(selectedCols); WRITE_BITMAPSET_FIELD(modifiedCols); @@ -15191,10 +15191,10 @@ index 79ca6c1..70fc9fb 100644 OIDOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "grantee", diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c -index 8e342a9..2cbd1d9 100644 +index 705fcf1..e897f55 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c -@@ -4200,7 +4200,7 @@ pg_timezone_abbrevs(PG_FUNCTION_ARGS) +@@ -4213,7 +4213,7 @@ pg_timezone_abbrevs(PG_FUNCTION_ARGS) * build tupdesc for result tuples. This must match this function's * pg_proc entry! */ @@ -15203,7 +15203,7 @@ index 8e342a9..2cbd1d9 100644 TupleDescInitEntry(tupdesc, (AttrNumber) 1, "abbrev", TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "utc_offset", -@@ -4293,7 +4293,7 @@ pg_timezone_names(PG_FUNCTION_ARGS) +@@ -4306,7 +4306,7 @@ pg_timezone_names(PG_FUNCTION_ARGS) * build tupdesc for result tuples. This must match this function's * pg_proc entry! */ @@ -15983,7 +15983,7 @@ index 4e55b16..a9f9f7e 100644 TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "setting", diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample -index a3b1457..b78c6d9 100644 +index e1f5ab6..43f47f6 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -76,6 +76,8 @@ @@ -16295,7 +16295,7 @@ index 0a135ee..27b2ef5 100644 char *defn; char *dropStmt; diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c -index 7a06f9b..f7fa80a 100644 +index f93affd..0a89cf2 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -125,7 +125,7 @@ static int binary_upgrade = 0; @@ -16882,7 +16882,7 @@ index 7a06f9b..f7fa80a 100644 } PQclear(res); -@@ -6147,7 +6220,7 @@ dumpComment(Archive *fout, const char *target, +@@ -6153,7 +6226,7 @@ dumpComment(Archive *fout, const char *target, */ ArchiveEntry(fout, nilCatalogId, createDumpId(), target, namespace, NULL, owner, @@ -16891,7 +16891,7 @@ index 7a06f9b..f7fa80a 100644 query->data, "", NULL, &(dumpId), 1, NULL, NULL); -@@ -6208,7 +6281,7 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo, +@@ -6214,7 +6287,7 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo, target->data, tbinfo->dobj.namespace->dobj.name, NULL, tbinfo->rolname, @@ -16900,7 +16900,7 @@ index 7a06f9b..f7fa80a 100644 query->data, "", NULL, &(tbinfo->dobj.dumpId), 1, NULL, NULL); -@@ -6230,7 +6303,7 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo, +@@ -6236,7 +6309,7 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo, target->data, tbinfo->dobj.namespace->dobj.name, NULL, tbinfo->rolname, @@ -16909,7 +16909,7 @@ index 7a06f9b..f7fa80a 100644 query->data, "", NULL, &(tbinfo->dobj.dumpId), 1, NULL, NULL); -@@ -6510,7 +6583,7 @@ dumpDumpableObject(Archive *fout, DumpableObject *dobj) +@@ -6516,7 +6589,7 @@ dumpDumpableObject(Archive *fout, DumpableObject *dobj) case DO_BLOB_DATA: ArchiveEntry(fout, dobj->catId, dobj->dumpId, dobj->name, NULL, NULL, "", @@ -16918,7 +16918,7 @@ index 7a06f9b..f7fa80a 100644 "", "", NULL, dobj->dependencies, dobj->nDeps, dumpBlobs, NULL); -@@ -6550,7 +6623,7 @@ dumpNamespace(Archive *fout, NamespaceInfo *nspinfo) +@@ -6556,7 +6629,7 @@ dumpNamespace(Archive *fout, NamespaceInfo *nspinfo) nspinfo->dobj.name, NULL, NULL, nspinfo->rolname, @@ -16927,7 +16927,7 @@ index 7a06f9b..f7fa80a 100644 q->data, delq->data, NULL, nspinfo->dobj.dependencies, nspinfo->dobj.nDeps, NULL, NULL); -@@ -6562,6 +6635,9 @@ dumpNamespace(Archive *fout, NamespaceInfo *nspinfo) +@@ -6568,6 +6641,9 @@ dumpNamespace(Archive *fout, NamespaceInfo *nspinfo) NULL, nspinfo->rolname, nspinfo->dobj.catId, 0, nspinfo->dobj.dumpId); @@ -16937,7 +16937,7 @@ index 7a06f9b..f7fa80a 100644 dumpACL(fout, nspinfo->dobj.catId, nspinfo->dobj.dumpId, "SCHEMA", qnspname, NULL, nspinfo->dobj.name, NULL, nspinfo->rolname, nspinfo->nspacl); -@@ -6679,7 +6755,7 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo) +@@ -6685,7 +6761,7 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo) tyinfo->dobj.name, tyinfo->dobj.namespace->dobj.name, NULL, @@ -16946,7 +16946,7 @@ index 7a06f9b..f7fa80a 100644 "TYPE", SECTION_PRE_DATA, q->data, delq->data, NULL, tyinfo->dobj.dependencies, tyinfo->dobj.nDeps, -@@ -6693,6 +6769,12 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo) +@@ -6699,6 +6775,12 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo) tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); @@ -16959,7 +16959,7 @@ index 7a06f9b..f7fa80a 100644 PQclear(res); destroyPQExpBuffer(q); destroyPQExpBuffer(delq); -@@ -7055,7 +7137,7 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo) +@@ -7061,7 +7143,7 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo) tyinfo->dobj.name, tyinfo->dobj.namespace->dobj.name, NULL, @@ -16968,7 +16968,7 @@ index 7a06f9b..f7fa80a 100644 "TYPE", SECTION_PRE_DATA, q->data, delq->data, NULL, tyinfo->dobj.dependencies, tyinfo->dobj.nDeps, -@@ -7069,6 +7151,12 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo) +@@ -7075,6 +7157,12 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo) tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); @@ -16981,7 +16981,7 @@ index 7a06f9b..f7fa80a 100644 PQclear(res); destroyPQExpBuffer(q); destroyPQExpBuffer(delq); -@@ -7179,7 +7267,7 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo) +@@ -7185,7 +7273,7 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo) tyinfo->dobj.name, tyinfo->dobj.namespace->dobj.name, NULL, @@ -16990,7 +16990,7 @@ index 7a06f9b..f7fa80a 100644 "DOMAIN", SECTION_PRE_DATA, q->data, delq->data, NULL, tyinfo->dobj.dependencies, tyinfo->dobj.nDeps, -@@ -7193,6 +7281,12 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo) +@@ -7199,6 +7287,12 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo) tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); @@ -17003,7 +17003,7 @@ index 7a06f9b..f7fa80a 100644 destroyPQExpBuffer(q); destroyPQExpBuffer(delq); destroyPQExpBuffer(query); -@@ -7284,7 +7378,7 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) +@@ -7290,7 +7384,7 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) tyinfo->dobj.name, tyinfo->dobj.namespace->dobj.name, NULL, @@ -17012,7 +17012,7 @@ index 7a06f9b..f7fa80a 100644 "TYPE", SECTION_PRE_DATA, q->data, delq->data, NULL, tyinfo->dobj.dependencies, tyinfo->dobj.nDeps, -@@ -7299,6 +7393,12 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) +@@ -7305,6 +7399,12 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); @@ -17025,7 +17025,7 @@ index 7a06f9b..f7fa80a 100644 PQclear(res); destroyPQExpBuffer(q); destroyPQExpBuffer(delq); -@@ -7403,7 +7503,7 @@ dumpCompositeTypeColComments(Archive *fout, TypeInfo *tyinfo) +@@ -7409,7 +7509,7 @@ dumpCompositeTypeColComments(Archive *fout, TypeInfo *tyinfo) target->data, tyinfo->dobj.namespace->dobj.name, NULL, tyinfo->rolname, @@ -17034,7 +17034,7 @@ index 7a06f9b..f7fa80a 100644 query->data, "", NULL, &(tyinfo->dobj.dumpId), 1, NULL, NULL); -@@ -7455,7 +7555,7 @@ dumpShellType(Archive *fout, ShellTypeInfo *stinfo) +@@ -7461,7 +7561,7 @@ dumpShellType(Archive *fout, ShellTypeInfo *stinfo) stinfo->dobj.name, stinfo->dobj.namespace->dobj.name, NULL, @@ -17043,7 +17043,7 @@ index 7a06f9b..f7fa80a 100644 "SHELL TYPE", SECTION_PRE_DATA, q->data, "", NULL, stinfo->dobj.dependencies, stinfo->dobj.nDeps, -@@ -7610,7 +7710,7 @@ dumpProcLang(Archive *fout, ProcLangInfo *plang) +@@ -7616,7 +7716,7 @@ dumpProcLang(Archive *fout, ProcLangInfo *plang) ArchiveEntry(fout, plang->dobj.catId, plang->dobj.dumpId, plang->dobj.name, lanschema, NULL, plang->lanowner, @@ -17052,7 +17052,7 @@ index 7a06f9b..f7fa80a 100644 defqry->data, delqry->data, NULL, plang->dobj.dependencies, plang->dobj.nDeps, NULL, NULL); -@@ -7796,6 +7896,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7802,6 +7902,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) char **argmodes = NULL; char **argnames = NULL; char **configitems = NULL; @@ -17060,7 +17060,7 @@ index 7a06f9b..f7fa80a 100644 int nconfigitems = 0; int i; -@@ -7826,8 +7927,10 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7832,8 +7933,10 @@ dumpFunc(Archive *fout, FuncInfo *finfo) "proiswindow, provolatile, proisstrict, prosecdef, " "proconfig, procost, prorows, " "(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) AS lanname " @@ -17071,7 +17071,7 @@ index 7a06f9b..f7fa80a 100644 finfo->dobj.catId.oid); } else if (g_fout->remoteVersion >= 80300) -@@ -7839,6 +7942,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7845,6 +7948,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) "provolatile, proisstrict, prosecdef, " "proconfig, procost, prorows, " "(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) AS lanname " @@ -17079,7 +17079,7 @@ index 7a06f9b..f7fa80a 100644 "FROM pg_catalog.pg_proc " "WHERE oid = '%u'::pg_catalog.oid", finfo->dobj.catId.oid); -@@ -7852,6 +7956,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7858,6 +7962,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) "provolatile, proisstrict, prosecdef, " "null AS proconfig, 0 AS procost, 0 AS prorows, " "(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) AS lanname " @@ -17087,7 +17087,7 @@ index 7a06f9b..f7fa80a 100644 "FROM pg_catalog.pg_proc " "WHERE oid = '%u'::pg_catalog.oid", finfo->dobj.catId.oid); -@@ -7867,6 +7972,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7873,6 +7978,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) "provolatile, proisstrict, prosecdef, " "null AS proconfig, 0 AS procost, 0 AS prorows, " "(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) AS lanname " @@ -17095,7 +17095,7 @@ index 7a06f9b..f7fa80a 100644 "FROM pg_catalog.pg_proc " "WHERE oid = '%u'::pg_catalog.oid", finfo->dobj.catId.oid); -@@ -7882,6 +7988,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7888,6 +7994,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) "provolatile, proisstrict, prosecdef, " "null AS proconfig, 0 AS procost, 0 AS prorows, " "(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) AS lanname " @@ -17103,7 +17103,7 @@ index 7a06f9b..f7fa80a 100644 "FROM pg_catalog.pg_proc " "WHERE oid = '%u'::pg_catalog.oid", finfo->dobj.catId.oid); -@@ -7899,6 +8006,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7905,6 +8012,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) "false AS prosecdef, " "null AS proconfig, 0 AS procost, 0 AS prorows, " "(SELECT lanname FROM pg_language WHERE oid = prolang) AS lanname " @@ -17111,7 +17111,7 @@ index 7a06f9b..f7fa80a 100644 "FROM pg_proc " "WHERE oid = '%u'::oid", finfo->dobj.catId.oid); -@@ -7916,6 +8024,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7922,6 +8030,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) "false AS prosecdef, " "NULL AS proconfig, 0 AS procost, 0 AS prorows, " "(SELECT lanname FROM pg_language WHERE oid = prolang) AS lanname " @@ -17119,7 +17119,7 @@ index 7a06f9b..f7fa80a 100644 "FROM pg_proc " "WHERE oid = '%u'::oid", finfo->dobj.catId.oid); -@@ -7960,6 +8069,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -7966,6 +8075,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) procost = PQgetvalue(res, 0, PQfnumber(res, "procost")); prorows = PQgetvalue(res, 0, PQfnumber(res, "prorows")); lanname = PQgetvalue(res, 0, PQfnumber(res, "lanname")); @@ -17127,7 +17127,7 @@ index 7a06f9b..f7fa80a 100644 /* * See backend/commands/functioncmds.c for details of how the 'AS' clause -@@ -8170,7 +8280,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -8176,7 +8286,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) funcsig_tag, finfo->dobj.namespace->dobj.name, NULL, @@ -17136,7 +17136,7 @@ index 7a06f9b..f7fa80a 100644 "FUNCTION", SECTION_PRE_DATA, q->data, delqry->data, NULL, finfo->dobj.dependencies, finfo->dobj.nDeps, -@@ -8183,6 +8293,12 @@ dumpFunc(Archive *fout, FuncInfo *finfo) +@@ -8189,6 +8299,12 @@ dumpFunc(Archive *fout, FuncInfo *finfo) finfo->dobj.namespace->dobj.name, finfo->rolname, finfo->dobj.catId, 0, finfo->dobj.dumpId); @@ -17149,7 +17149,7 @@ index 7a06f9b..f7fa80a 100644 dumpACL(fout, finfo->dobj.catId, finfo->dobj.dumpId, "FUNCTION", funcsig, NULL, funcsig_tag, finfo->dobj.namespace->dobj.name, -@@ -8324,7 +8440,7 @@ dumpCast(Archive *fout, CastInfo *cast) +@@ -8330,7 +8446,7 @@ dumpCast(Archive *fout, CastInfo *cast) ArchiveEntry(fout, cast->dobj.catId, cast->dobj.dumpId, castsig->data, "pg_catalog", NULL, "", @@ -17158,7 +17158,7 @@ index 7a06f9b..f7fa80a 100644 defqry->data, delqry->data, NULL, cast->dobj.dependencies, cast->dobj.nDeps, NULL, NULL); -@@ -8568,7 +8684,7 @@ dumpOpr(Archive *fout, OprInfo *oprinfo) +@@ -8574,7 +8690,7 @@ dumpOpr(Archive *fout, OprInfo *oprinfo) oprinfo->dobj.namespace->dobj.name, NULL, oprinfo->rolname, @@ -17167,7 +17167,7 @@ index 7a06f9b..f7fa80a 100644 q->data, delq->data, NULL, oprinfo->dobj.dependencies, oprinfo->dobj.nDeps, NULL, NULL); -@@ -9027,7 +9143,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) +@@ -9033,7 +9149,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) opcinfo->dobj.namespace->dobj.name, NULL, opcinfo->rolname, @@ -17176,7 +17176,7 @@ index 7a06f9b..f7fa80a 100644 q->data, delq->data, NULL, opcinfo->dobj.dependencies, opcinfo->dobj.nDeps, NULL, NULL); -@@ -9308,7 +9424,7 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) +@@ -9314,7 +9430,7 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) opfinfo->dobj.namespace->dobj.name, NULL, opfinfo->rolname, @@ -17185,7 +17185,7 @@ index 7a06f9b..f7fa80a 100644 q->data, delq->data, NULL, opfinfo->dobj.dependencies, opfinfo->dobj.nDeps, NULL, NULL); -@@ -9424,7 +9540,7 @@ dumpConversion(Archive *fout, ConvInfo *convinfo) +@@ -9430,7 +9546,7 @@ dumpConversion(Archive *fout, ConvInfo *convinfo) convinfo->dobj.namespace->dobj.name, NULL, convinfo->rolname, @@ -17194,7 +17194,7 @@ index 7a06f9b..f7fa80a 100644 q->data, delq->data, NULL, convinfo->dobj.dependencies, convinfo->dobj.nDeps, NULL, NULL); -@@ -9505,11 +9621,13 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9511,11 +9627,13 @@ dumpAgg(Archive *fout, AggInfo *agginfo) int i_aggtranstype; int i_agginitval; int i_convertok; @@ -17208,7 +17208,7 @@ index 7a06f9b..f7fa80a 100644 bool convertok; /* Skip if not to be dumped */ -@@ -9532,9 +9650,11 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9538,9 +9656,11 @@ dumpAgg(Archive *fout, AggInfo *agginfo) "aggsortop::pg_catalog.regoperator, " "agginitval, " "'t'::boolean AS convertok " @@ -17220,7 +17220,7 @@ index 7a06f9b..f7fa80a 100644 agginfo->aggfn.dobj.catId.oid); } else if (g_fout->remoteVersion >= 70300) -@@ -9544,6 +9664,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9550,6 +9670,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) "0 AS aggsortop, " "agginitval, " "'t'::boolean AS convertok " @@ -17228,7 +17228,7 @@ index 7a06f9b..f7fa80a 100644 "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " "WHERE a.aggfnoid = p.oid " "AND p.oid = '%u'::pg_catalog.oid", -@@ -9556,6 +9677,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9562,6 +9683,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) "0 AS aggsortop, " "agginitval, " "'t'::boolean AS convertok " @@ -17236,7 +17236,7 @@ index 7a06f9b..f7fa80a 100644 "FROM pg_aggregate " "WHERE oid = '%u'::oid", agginfo->aggfn.dobj.catId.oid); -@@ -9568,6 +9690,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9574,6 +9696,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) "0 AS aggsortop, " "agginitval1 AS agginitval, " "(aggtransfn2 = 0 and aggtranstype2 = 0 and agginitval2 is null) AS convertok " @@ -17244,7 +17244,7 @@ index 7a06f9b..f7fa80a 100644 "FROM pg_aggregate " "WHERE oid = '%u'::oid", agginfo->aggfn.dobj.catId.oid); -@@ -9593,6 +9716,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9599,6 +9722,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) i_aggtranstype = PQfnumber(res, "aggtranstype"); i_agginitval = PQfnumber(res, "agginitval"); i_convertok = PQfnumber(res, "convertok"); @@ -17252,7 +17252,7 @@ index 7a06f9b..f7fa80a 100644 aggtransfn = PQgetvalue(res, 0, i_aggtransfn); aggfinalfn = PQgetvalue(res, 0, i_aggfinalfn); -@@ -9600,6 +9724,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9606,6 +9730,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) aggtranstype = PQgetvalue(res, 0, i_aggtranstype); agginitval = PQgetvalue(res, 0, i_agginitval); convertok = (PQgetvalue(res, 0, i_convertok)[0] == 't'); @@ -17260,7 +17260,7 @@ index 7a06f9b..f7fa80a 100644 aggsig = format_aggregate_signature(agginfo, fout, true); aggsig_tag = format_aggregate_signature(agginfo, fout, false); -@@ -9668,7 +9793,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9674,7 +9799,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) agginfo->aggfn.dobj.namespace->dobj.name, NULL, agginfo->aggfn.rolname, @@ -17269,7 +17269,7 @@ index 7a06f9b..f7fa80a 100644 q->data, delq->data, NULL, agginfo->aggfn.dobj.dependencies, agginfo->aggfn.dobj.nDeps, NULL, NULL); -@@ -9680,6 +9805,12 @@ dumpAgg(Archive *fout, AggInfo *agginfo) +@@ -9686,6 +9811,12 @@ dumpAgg(Archive *fout, AggInfo *agginfo) agginfo->aggfn.dobj.namespace->dobj.name, agginfo->aggfn.rolname, agginfo->aggfn.dobj.catId, 0, agginfo->aggfn.dobj.dumpId); @@ -17282,7 +17282,7 @@ index 7a06f9b..f7fa80a 100644 /* * Since there is no GRANT ON AGGREGATE syntax, we have to make the ACL * command look like a function's GRANT; in particular this affects the -@@ -9756,7 +9887,7 @@ dumpTSParser(Archive *fout, TSParserInfo *prsinfo) +@@ -9762,7 +9893,7 @@ dumpTSParser(Archive *fout, TSParserInfo *prsinfo) prsinfo->dobj.namespace->dobj.name, NULL, "", @@ -17291,7 +17291,7 @@ index 7a06f9b..f7fa80a 100644 q->data, delq->data, NULL, prsinfo->dobj.dependencies, prsinfo->dobj.nDeps, NULL, NULL); -@@ -9848,7 +9979,7 @@ dumpTSDictionary(Archive *fout, TSDictInfo *dictinfo) +@@ -9854,7 +9985,7 @@ dumpTSDictionary(Archive *fout, TSDictInfo *dictinfo) dictinfo->dobj.namespace->dobj.name, NULL, dictinfo->rolname, @@ -17300,7 +17300,7 @@ index 7a06f9b..f7fa80a 100644 q->data, delq->data, NULL, dictinfo->dobj.dependencies, dictinfo->dobj.nDeps, NULL, NULL); -@@ -9908,7 +10039,7 @@ dumpTSTemplate(Archive *fout, TSTemplateInfo *tmplinfo) +@@ -9914,7 +10045,7 @@ dumpTSTemplate(Archive *fout, TSTemplateInfo *tmplinfo) tmplinfo->dobj.namespace->dobj.name, NULL, "", @@ -17309,7 +17309,7 @@ index 7a06f9b..f7fa80a 100644 q->data, delq->data, NULL, tmplinfo->dobj.dependencies, tmplinfo->dobj.nDeps, NULL, NULL); -@@ -10041,7 +10172,7 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo) +@@ -10047,7 +10178,7 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo) cfginfo->dobj.namespace->dobj.name, NULL, cfginfo->rolname, @@ -17318,7 +17318,7 @@ index 7a06f9b..f7fa80a 100644 q->data, delq->data, NULL, cfginfo->dobj.dependencies, cfginfo->dobj.nDeps, NULL, NULL); -@@ -10097,7 +10228,7 @@ dumpForeignDataWrapper(Archive *fout, FdwInfo *fdwinfo) +@@ -10103,7 +10234,7 @@ dumpForeignDataWrapper(Archive *fout, FdwInfo *fdwinfo) NULL, NULL, fdwinfo->rolname, @@ -17327,7 +17327,7 @@ index 7a06f9b..f7fa80a 100644 q->data, delq->data, NULL, fdwinfo->dobj.dependencies, fdwinfo->dobj.nDeps, NULL, NULL); -@@ -10185,7 +10316,7 @@ dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo) +@@ -10191,7 +10322,7 @@ dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo) NULL, NULL, srvinfo->rolname, @@ -17336,7 +17336,7 @@ index 7a06f9b..f7fa80a 100644 q->data, delq->data, NULL, srvinfo->dobj.dependencies, srvinfo->dobj.nDeps, NULL, NULL); -@@ -10290,7 +10421,7 @@ dumpUserMappings(Archive *fout, +@@ -10296,7 +10427,7 @@ dumpUserMappings(Archive *fout, tag->data, namespace, NULL, @@ -17345,7 +17345,7 @@ index 7a06f9b..f7fa80a 100644 "USER MAPPING", SECTION_PRE_DATA, q->data, delq->data, NULL, &dumpId, 1, -@@ -10361,7 +10492,7 @@ dumpDefaultACL(Archive *fout, DefaultACLInfo *daclinfo) +@@ -10367,7 +10498,7 @@ dumpDefaultACL(Archive *fout, DefaultACLInfo *daclinfo) daclinfo->dobj.namespace ? daclinfo->dobj.namespace->dobj.name : NULL, NULL, daclinfo->defaclrole, @@ -17354,7 +17354,7 @@ index 7a06f9b..f7fa80a 100644 q->data, "", NULL, daclinfo->dobj.dependencies, daclinfo->dobj.nDeps, NULL, NULL); -@@ -10418,7 +10549,7 @@ dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId, +@@ -10424,7 +10555,7 @@ dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId, tag, nspname, NULL, owner ? owner : "", @@ -17363,7 +17363,7 @@ index 7a06f9b..f7fa80a 100644 sql->data, "", NULL, &(objDumpId), 1, NULL, NULL); -@@ -10427,6 +10558,123 @@ dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId, +@@ -10433,6 +10564,123 @@ dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId, } /* @@ -17487,7 +17487,7 @@ index 7a06f9b..f7fa80a 100644 * dumpTable * write out to fout the declarations (not data) of a user-defined table */ -@@ -10582,7 +10830,6 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) +@@ -10588,7 +10836,6 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) appendPQExpBuffer(q, "CREATE VIEW %s AS\n %s\n", fmtId(tbinfo->dobj.name), viewdef); @@ -17495,7 +17495,7 @@ index 7a06f9b..f7fa80a 100644 PQclear(res); } else -@@ -10933,6 +11180,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) +@@ -10939,6 +11186,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) (tbinfo->relkind == RELKIND_VIEW) ? NULL : tbinfo->reltablespace, tbinfo->rolname, (strcmp(reltypename, "TABLE") == 0) ? tbinfo->hasoids : false, @@ -17503,7 +17503,7 @@ index 7a06f9b..f7fa80a 100644 reltypename, SECTION_PRE_DATA, q->data, delq->data, NULL, tbinfo->dobj.dependencies, tbinfo->dobj.nDeps, -@@ -10953,6 +11201,27 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) +@@ -10959,6 +11207,27 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) dumpTableConstraintComment(fout, constr); } @@ -17531,7 +17531,7 @@ index 7a06f9b..f7fa80a 100644 destroyPQExpBuffer(query); destroyPQExpBuffer(q); destroyPQExpBuffer(delq); -@@ -11001,7 +11270,7 @@ dumpAttrDef(Archive *fout, AttrDefInfo *adinfo) +@@ -11007,7 +11276,7 @@ dumpAttrDef(Archive *fout, AttrDefInfo *adinfo) tbinfo->dobj.namespace->dobj.name, NULL, tbinfo->rolname, @@ -17540,7 +17540,7 @@ index 7a06f9b..f7fa80a 100644 q->data, delq->data, NULL, adinfo->dobj.dependencies, adinfo->dobj.nDeps, NULL, NULL); -@@ -11097,7 +11366,7 @@ dumpIndex(Archive *fout, IndxInfo *indxinfo) +@@ -11103,7 +11372,7 @@ dumpIndex(Archive *fout, IndxInfo *indxinfo) indxinfo->dobj.name, tbinfo->dobj.namespace->dobj.name, indxinfo->tablespace, @@ -17549,7 +17549,7 @@ index 7a06f9b..f7fa80a 100644 "INDEX", SECTION_POST_DATA, q->data, delq->data, NULL, indxinfo->dobj.dependencies, indxinfo->dobj.nDeps, -@@ -11222,7 +11491,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) +@@ -11228,7 +11497,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) coninfo->dobj.name, tbinfo->dobj.namespace->dobj.name, indxinfo->tablespace, @@ -17558,7 +17558,7 @@ index 7a06f9b..f7fa80a 100644 "CONSTRAINT", SECTION_POST_DATA, q->data, delq->data, NULL, coninfo->dobj.dependencies, coninfo->dobj.nDeps, -@@ -11255,7 +11524,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) +@@ -11261,7 +11530,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) coninfo->dobj.name, tbinfo->dobj.namespace->dobj.name, NULL, @@ -17567,7 +17567,7 @@ index 7a06f9b..f7fa80a 100644 "FK CONSTRAINT", SECTION_POST_DATA, q->data, delq->data, NULL, coninfo->dobj.dependencies, coninfo->dobj.nDeps, -@@ -11290,7 +11559,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) +@@ -11296,7 +11565,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) coninfo->dobj.name, tbinfo->dobj.namespace->dobj.name, NULL, @@ -17576,7 +17576,7 @@ index 7a06f9b..f7fa80a 100644 "CHECK CONSTRAINT", SECTION_POST_DATA, q->data, delq->data, NULL, coninfo->dobj.dependencies, coninfo->dobj.nDeps, -@@ -11326,7 +11595,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) +@@ -11332,7 +11601,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) coninfo->dobj.name, tyinfo->dobj.namespace->dobj.name, NULL, @@ -17585,7 +17585,7 @@ index 7a06f9b..f7fa80a 100644 "CHECK CONSTRAINT", SECTION_POST_DATA, q->data, delq->data, NULL, coninfo->dobj.dependencies, coninfo->dobj.nDeps, -@@ -11612,7 +11881,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) +@@ -11618,7 +11887,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) tbinfo->dobj.namespace->dobj.name, NULL, tbinfo->rolname, @@ -17594,7 +17594,7 @@ index 7a06f9b..f7fa80a 100644 query->data, delqry->data, NULL, tbinfo->dobj.dependencies, tbinfo->dobj.nDeps, NULL, NULL); -@@ -11648,7 +11917,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) +@@ -11654,7 +11923,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) tbinfo->dobj.namespace->dobj.name, NULL, tbinfo->rolname, @@ -17603,7 +17603,7 @@ index 7a06f9b..f7fa80a 100644 query->data, "", NULL, &(tbinfo->dobj.dumpId), 1, NULL, NULL); -@@ -11661,6 +11930,12 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) +@@ -11667,6 +11936,12 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) dumpComment(fout, query->data, tbinfo->dobj.namespace->dobj.name, tbinfo->rolname, tbinfo->dobj.catId, 0, tbinfo->dobj.dumpId); @@ -17616,7 +17616,7 @@ index 7a06f9b..f7fa80a 100644 } if (!schemaOnly) -@@ -11676,7 +11951,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) +@@ -11682,7 +11957,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) tbinfo->dobj.namespace->dobj.name, NULL, tbinfo->rolname, @@ -17625,7 +17625,7 @@ index 7a06f9b..f7fa80a 100644 query->data, "", NULL, &(tbinfo->dobj.dumpId), 1, NULL, NULL); -@@ -11860,7 +12135,7 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo) +@@ -11866,7 +12141,7 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo) tginfo->dobj.name, tbinfo->dobj.namespace->dobj.name, NULL, @@ -17634,7 +17634,7 @@ index 7a06f9b..f7fa80a 100644 "TRIGGER", SECTION_POST_DATA, query->data, delqry->data, NULL, tginfo->dobj.dependencies, tginfo->dobj.nDeps, -@@ -11980,7 +12255,7 @@ dumpRule(Archive *fout, RuleInfo *rinfo) +@@ -11986,7 +12261,7 @@ dumpRule(Archive *fout, RuleInfo *rinfo) rinfo->dobj.name, tbinfo->dobj.namespace->dobj.name, NULL, @@ -17643,7 +17643,7 @@ index 7a06f9b..f7fa80a 100644 "RULE", SECTION_POST_DATA, cmd->data, delcmd->data, NULL, rinfo->dobj.dependencies, rinfo->dobj.nDeps, -@@ -12345,7 +12620,7 @@ fmtQualifiedId(const char *schema, const char *id) +@@ -12351,7 +12626,7 @@ fmtQualifiedId(const char *schema, const char *id) * "", not an invalid "()" column list. */ static const char * @@ -17652,7 +17652,7 @@ index 7a06f9b..f7fa80a 100644 { static PQExpBuffer q = NULL; int numatts = ti->numatts; -@@ -12361,6 +12636,11 @@ fmtCopyColumnList(const TableInfo *ti) +@@ -12367,6 +12642,11 @@ fmtCopyColumnList(const TableInfo *ti) appendPQExpBuffer(q, "("); needComma = false; diff --git a/sepostgresql.spec b/sepostgresql.spec index 05ea0e8..b79d3e7 100644 --- a/sepostgresql.spec +++ b/sepostgresql.spec @@ -11,8 +11,8 @@ Summary: Security Enhanced PostgreSQL Name: sepostgresql -Version: 9.0.0 -Release: 20101005%{?dist} +Version: 9.0.1 +Release: 20101007%{?dist} License: PostgreSQL Group: Applications/Databases Url: http://code.google.com/p/sepgsql/ @@ -181,6 +181,9 @@ fi %attr(700,sepgsql,sepgsql) %dir %{_localstatedir}/lib/sepgsql/backups %changelog +* Thu Oct 7 2010 KaiGai Kohei - 9.0.1-20101007 +- upgrade base version to 9.0.1 + * Tue Oct 5 2010 KaiGai Kohei - 9.0.0-20101005 - upgrade base version to 9.0.0 diff --git a/sources b/sources index f048e2f..5a1101a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -9443b3b9c95a48d5e0713feafc209adc postgresql-9.0.0.tar.gz +5093c321bc47af2ea9afa726605ff1ce postgresql-9.0.1.tar.gz From 44608b65d49d4bc3a7ff5ef82640cb1b83cdbfed Mon Sep 17 00:00:00 2001 From: KaiGai Kohei Date: Fri, 15 Apr 2011 09:31:54 +0200 Subject: [PATCH 5/5] upgrade base version to 9.0.3 --- .gitignore | 1 + sepostgresql-9.0-fullset.patch | 911 ++++++++++++++++++--------------- sepostgresql.spec | 12 +- sources | 2 +- 4 files changed, 520 insertions(+), 406 deletions(-) diff --git a/.gitignore b/.gitignore index 1b4ef6d..81ff717 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ postgresql-9.0beta1.tar.gz /postgresql-9.0.0.tar.gz /postgresql-9.0.1.tar.gz +/postgresql-9.0.3.tar.gz diff --git a/sepostgresql-9.0-fullset.patch b/sepostgresql-9.0-fullset.patch index f3dddff..e4b3c26 100644 --- a/sepostgresql-9.0-fullset.patch +++ b/sepostgresql-9.0-fullset.patch @@ -1,5 +1,182 @@ + configure | 198 ++++++ + configure.in | 13 + + contrib/adminpack/adminpack.c | 28 +- + src/Makefile.global.in | 1 + + src/backend/Makefile | 7 +- + src/backend/access/common/heaptuple.c | 14 + + src/backend/access/common/tupdesc.c | 20 +- + src/backend/access/gin/ginutil.c | 2 +- + src/backend/access/heap/heapam.c | 35 + + src/backend/access/heap/tuptoaster.c | 6 + + src/backend/access/transam/twophase.c | 2 +- + src/backend/access/transam/xact.c | 19 + + src/backend/access/transam/xlog.c | 2 +- + src/backend/bootstrap/bootparse.y | 7 +- + src/backend/bootstrap/bootstrap.c | 14 + + src/backend/catalog/Makefile | 4 +- + src/backend/catalog/aclchk.c | 20 + + src/backend/catalog/catalog.c | 6 + + src/backend/catalog/genbki.pl | 3 +- + src/backend/catalog/heap.c | 120 +++- + src/backend/catalog/index.c | 28 +- + src/backend/catalog/namespace.c | 26 +- + src/backend/catalog/pg_aggregate.c | 9 +- + src/backend/catalog/pg_conversion.c | 4 +- + src/backend/catalog/pg_largeobject.c | 65 ++- + src/backend/catalog/pg_namespace.c | 4 +- + src/backend/catalog/pg_operator.c | 21 + + src/backend/catalog/pg_proc.c | 8 +- + src/backend/catalog/pg_seclabel.c | 646 +++++++++++++++++++ + src/backend/catalog/pg_type.c | 17 +- + src/backend/catalog/toasting.c | 12 +- + src/backend/commands/aggregatecmds.c | 4 + + src/backend/commands/alter.c | 61 ++ + src/backend/commands/cluster.c | 23 +- + src/backend/commands/comment.c | 60 ++ + src/backend/commands/conversioncmds.c | 16 +- + src/backend/commands/copy.c | 265 +++++++-- + src/backend/commands/dbcommands.c | 87 +++ + src/backend/commands/explain.c | 2 +- + src/backend/commands/foreigncmds.c | 39 ++ + src/backend/commands/functioncmds.c | 82 +++- + src/backend/commands/indexcmds.c | 18 +- + src/backend/commands/lockcmds.c | 4 + + src/backend/commands/opclasscmds.c | 48 ++- + src/backend/commands/operatorcmds.c | 6 + + src/backend/commands/prepare.c | 2 +- + src/backend/commands/proclang.c | 10 +- + src/backend/commands/schemacmds.c | 57 ++- + src/backend/commands/sequence.c | 16 + + src/backend/commands/tablecmds.c | 509 +++++++++++++++- + src/backend/commands/tablespace.c | 64 ++ + src/backend/commands/trigger.c | 11 + + src/backend/commands/tsearchcmds.c | 64 ++- + src/backend/commands/typecmds.c | 159 +++++- + src/backend/commands/user.c | 20 + + src/backend/commands/vacuum.c | 3 + + src/backend/commands/view.c | 4 + + src/backend/executor/execJunk.c | 5 +- + src/backend/executor/execMain.c | 63 ++- + src/backend/executor/execQual.c | 11 +- + src/backend/executor/execScan.c | 23 +- + src/backend/executor/execTuples.c | 17 +- + src/backend/executor/execUtils.c | 6 +- + src/backend/executor/functions.c | 6 +- + src/backend/executor/nodeAgg.c | 5 +- + src/backend/executor/nodeFunctionscan.c | 2 +- + src/backend/executor/nodeMergejoin.c | 4 + + src/backend/executor/nodeModifyTable.c | 76 +++- + src/backend/executor/nodeSubplan.c | 4 +- + src/backend/executor/nodeWindowAgg.c | 7 + + src/backend/executor/spi.c | 13 +- + src/backend/libpq/be-fsstubs.c | 40 +- + src/backend/nodes/copyfuncs.c | 19 + + src/backend/nodes/equalfuncs.c | 17 + + src/backend/nodes/outfuncs.c | 1 + + src/backend/nodes/readfuncs.c | 1 + + src/backend/optimizer/plan/planner.c | 11 + + src/backend/optimizer/util/clauses.c | 8 +- + src/backend/parser/analyze.c | 4 +- + src/backend/parser/gram.y | 120 ++++- + src/backend/parser/parse_relation.c | 12 +- + src/backend/parser/parse_target.c | 75 ++- + src/backend/parser/parse_utilcmd.c | 10 +- + src/backend/postmaster/postmaster.c | 45 ++- + src/backend/rewrite/rewriteDefine.c | 4 + + src/backend/rewrite/rewriteRemove.c | 4 + + src/backend/sepgsql/Makefile | 21 + + src/backend/sepgsql/attribute.c | 260 ++++++++ + src/backend/sepgsql/avc.c | 503 +++++++++++++++ + src/backend/sepgsql/blob.c | 245 ++++++++ + src/backend/sepgsql/conversion.c | 147 +++++ + src/backend/sepgsql/database.c | 201 ++++++ + src/backend/sepgsql/fdw.c | 296 +++++++++ + src/backend/sepgsql/file.c | 287 +++++++++ + src/backend/sepgsql/label.c | 588 ++++++++++++++++++ + src/backend/sepgsql/misc.c | 147 +++++ + src/backend/sepgsql/operator.c | 454 ++++++++++++++ + src/backend/sepgsql/proc.c | 366 +++++++++++ + src/backend/sepgsql/relation.c | 819 +++++++++++++++++++++++++ + src/backend/sepgsql/role.c | 142 +++++ + src/backend/sepgsql/rowlv.c | 346 +++++++++++ + src/backend/sepgsql/schema.c | 173 ++++++ + src/backend/sepgsql/selinux.c | 690 +++++++++++++++++++++ + src/backend/sepgsql/tablespace.c | 157 +++++ + src/backend/sepgsql/tsearch.c | 524 ++++++++++++++++ + src/backend/sepgsql/type.c | 314 ++++++++++ + src/backend/storage/large_object/inv_api.c | 4 +- + src/backend/tcop/fastpath.c | 5 + + src/backend/tcop/pquery.c | 2 +- + src/backend/tcop/utility.c | 49 ++ + src/backend/tsearch/wparser.c | 4 +- + src/backend/utils/adt/acl.c | 2 +- + src/backend/utils/adt/datetime.c | 4 +- + src/backend/utils/adt/dbsize.c | 6 + + src/backend/utils/adt/genfile.c | 9 +- + src/backend/utils/adt/lockfuncs.c | 2 +- + src/backend/utils/adt/misc.c | 2 +- + src/backend/utils/adt/pgstatfuncs.c | 2 +- + src/backend/utils/adt/ri_triggers.c | 24 + + src/backend/utils/adt/tid.c | 5 + + src/backend/utils/adt/trigfuncs.c | 4 + + src/backend/utils/adt/tsvector_op.c | 2 +- + src/backend/utils/cache/plancache.c | 8 +- + src/backend/utils/cache/relcache.c | 38 +- + src/backend/utils/cache/syscache.c | 24 + + src/backend/utils/fmgr/fmgr.c | 32 +- + src/backend/utils/fmgr/funcapi.c | 4 +- + src/backend/utils/init/postinit.c | 7 + + src/backend/utils/misc/guc.c | 74 ++- + src/backend/utils/misc/postgresql.conf.sample | 2 + + src/backend/utils/mmgr/portalmem.c | 2 +- + src/bin/initdb/initdb.c | 13 + + src/bin/pg_dump/pg_backup.h | 3 +- + src/bin/pg_dump/pg_backup_archiver.c | 81 +++- + src/bin/pg_dump/pg_backup_archiver.h | 9 +- + src/bin/pg_dump/pg_dump.c | 400 ++++++++++-- + src/bin/pg_dump/pg_dump.h | 7 + + src/bin/pg_dump/pg_dumpall.c | 60 ++- + src/bin/pg_dump/pg_restore.c | 6 + + src/include/access/htup.h | 35 +- + src/include/access/sysattr.h | 3 +- + src/include/access/tupdesc.h | 5 +- + src/include/bootstrap/bootstrap.h | 1 + + src/include/catalog/heap.h | 16 +- + src/include/catalog/indexing.h | 5 + + src/include/catalog/pg_class.h | 28 +- + src/include/catalog/pg_conversion_fn.h | 2 +- + src/include/catalog/pg_largeobject.h | 3 +- + src/include/catalog/pg_namespace.h | 2 +- + src/include/catalog/pg_proc.h | 4 + + src/include/catalog/pg_proc_fn.h | 3 +- + src/include/catalog/pg_seclabel.h | 79 +++ + src/include/catalog/pg_type_fn.h | 3 +- + src/include/catalog/toasting.h | 3 + + src/include/commands/alter.h | 1 + + src/include/commands/dbcommands.h | 1 + + src/include/commands/defrem.h | 2 + + src/include/commands/schemacmds.h | 1 + + src/include/commands/tablecmds.h | 7 + + src/include/commands/tablespace.h | 1 + + src/include/commands/typecmds.h | 2 + + src/include/executor/executor.h | 9 +- + src/include/fmgr.h | 1 + + src/include/nodes/nodes.h | 1 + + src/include/nodes/parsenodes.h | 17 + + src/include/parser/kwlist.h | 1 + + src/include/pg_config.h.in | 3 + + src/include/sepgsql/hooks.h | 293 +++++++++ + src/include/sepgsql/sepgsql.h | 318 ++++++++++ + src/include/storage/large_object.h | 2 +- + src/include/storage/lwlock.h | 1 + + src/include/utils/guc.h | 1 + + src/include/utils/syscache.h | 11 + + src/pl/plpgsql/src/pl_comp.c | 2 +- + src/test/regress/expected/sanity_check.out | 3 +- + 175 files changed, 11679 insertions(+), 375 deletions(-) + diff --git a/configure b/configure -index c4ba09e..bbed799 100755 +index a4f4c9e..e8e71c1 100755 --- a/configure +++ b/configure @@ -708,6 +708,7 @@ LDFLAGS_EX @@ -229,7 +406,7 @@ index c4ba09e..bbed799 100755 # diff --git a/configure.in b/configure.in -index c381505..14d0aba 100644 +index 26166d0..0a58c40 100644 --- a/configure.in +++ b/configure.in @@ -755,6 +755,19 @@ PGAC_ARG_BOOL(with, zlib, yes, @@ -554,7 +731,7 @@ index 2a75820..065ba1a 100644 TupleDescInitEntry(state->tupdesc[i], (AttrNumber) 1, NULL, INT2OID, -1, 0); diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c -index 48a387e..f00a9cc 100644 +index 1c93400..1236873 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -52,6 +52,7 @@ @@ -737,10 +914,10 @@ index 8436dea..d9de0e4 100644 CurrentTransactionState = s; diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c -index 15b3476..54a9105 100644 +index bb06a2e..77feebf 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c -@@ -8895,7 +8895,7 @@ pg_xlogfile_name_offset(PG_FUNCTION_ARGS) +@@ -8916,7 +8916,7 @@ pg_xlogfile_name_offset(PG_FUNCTION_ARGS) * Construct a tuple descriptor for the result row. This must match this * function's pg_proc entry! */ @@ -860,7 +1037,7 @@ index a970039..0381d6b 100644 pg_foreign_data_wrapper.h pg_foreign_server.h pg_user_mapping.h \ pg_default_acl.h \ diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c -index 0470a70..62fedb1 100644 +index 9b5602e..80be522 100644 --- a/src/backend/catalog/aclchk.c +++ b/src/backend/catalog/aclchk.c @@ -38,6 +38,7 @@ @@ -879,7 +1056,7 @@ index 0470a70..62fedb1 100644 #include "utils/acl.h" #include "utils/builtins.h" #include "utils/fmgroids.h" -@@ -1500,6 +1502,10 @@ expand_all_col_privileges(Oid table_oid, Form_pg_class classForm, +@@ -1506,6 +1508,10 @@ expand_all_col_privileges(Oid table_oid, Form_pg_class classForm, if (curr_att == ObjectIdAttributeNumber && !classForm->relhasoids) continue; @@ -890,7 +1067,7 @@ index 0470a70..62fedb1 100644 /* Views don't have any system columns at all */ if (classForm->relkind == RELKIND_VIEW && curr_att < 0) continue; -@@ -1609,6 +1615,8 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname, +@@ -1615,6 +1621,8 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname, relOid, grantorId, ACL_KIND_COLUMN, relname, attnum, NameStr(pg_attribute_tuple->attname)); @@ -899,7 +1076,7 @@ index 0470a70..62fedb1 100644 /* * Generate new ACL. -@@ -1870,6 +1878,8 @@ ExecGrant_Relation(InternalGrant *istmt) +@@ -1876,6 +1884,8 @@ ExecGrant_Relation(InternalGrant *istmt) ? ACL_KIND_SEQUENCE : ACL_KIND_CLASS, NameStr(pg_class_tuple->relname), 0, NULL); @@ -908,7 +1085,7 @@ index 0470a70..62fedb1 100644 /* * Generate new ACL. -@@ -2064,6 +2074,8 @@ ExecGrant_Database(InternalGrant *istmt) +@@ -2070,6 +2080,8 @@ ExecGrant_Database(InternalGrant *istmt) datId, grantorId, ACL_KIND_DATABASE, NameStr(pg_database_tuple->datname), 0, NULL); @@ -917,7 +1094,7 @@ index 0470a70..62fedb1 100644 /* * Generate new ACL. -@@ -2189,6 +2201,8 @@ ExecGrant_Fdw(InternalGrant *istmt) +@@ -2195,6 +2207,8 @@ ExecGrant_Fdw(InternalGrant *istmt) fdwid, grantorId, ACL_KIND_FDW, NameStr(pg_fdw_tuple->fdwname), 0, NULL); @@ -926,7 +1103,7 @@ index 0470a70..62fedb1 100644 /* * Generate new ACL. -@@ -2314,6 +2328,8 @@ ExecGrant_ForeignServer(InternalGrant *istmt) +@@ -2320,6 +2334,8 @@ ExecGrant_ForeignServer(InternalGrant *istmt) srvid, grantorId, ACL_KIND_FOREIGN_SERVER, NameStr(pg_server_tuple->srvname), 0, NULL); @@ -935,7 +1112,7 @@ index 0470a70..62fedb1 100644 /* * Generate new ACL. -@@ -2832,6 +2848,8 @@ ExecGrant_Namespace(InternalGrant *istmt) +@@ -2838,6 +2854,8 @@ ExecGrant_Namespace(InternalGrant *istmt) nspid, grantorId, ACL_KIND_NAMESPACE, NameStr(pg_namespace_tuple->nspname), 0, NULL); @@ -944,7 +1121,7 @@ index 0470a70..62fedb1 100644 /* * Generate new ACL. -@@ -2956,6 +2974,8 @@ ExecGrant_Tablespace(InternalGrant *istmt) +@@ -2962,6 +2980,8 @@ ExecGrant_Tablespace(InternalGrant *istmt) tblId, grantorId, ACL_KIND_TABLESPACE, NameStr(pg_tablespace_tuple->spcname), 0, NULL); @@ -1350,7 +1527,7 @@ index 47e0c9b..73cbfcf 100644 diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c -index dea6889..18d96da 100644 +index 8af382b..01f53fd 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -39,6 +39,7 @@ @@ -1361,7 +1538,7 @@ index dea6889..18d96da 100644 #include "catalog/pg_tablespace.h" #include "catalog/pg_trigger.h" #include "catalog/pg_type.h" -@@ -90,7 +91,8 @@ static TupleDesc ConstructTupleDescriptor(Relation heapRelation, +@@ -89,7 +90,8 @@ static TupleDesc ConstructTupleDescriptor(Relation heapRelation, Oid *classObjectId); static void InitializeAttributeOids(Relation indexRelation, int numatts, Oid indexoid); @@ -1371,7 +1548,7 @@ index dea6889..18d96da 100644 static void UpdateIndexRelation(Oid indexoid, Oid heapoid, IndexInfo *indexInfo, Oid *classOids, -@@ -155,7 +157,7 @@ ConstructTupleDescriptor(Relation heapRelation, +@@ -154,7 +156,7 @@ ConstructTupleDescriptor(Relation heapRelation, /* * allocate the new tuple descriptor */ @@ -1380,7 +1557,7 @@ index dea6889..18d96da 100644 /* * For simple index columns, we copy the pg_attribute row from the parent -@@ -182,7 +184,8 @@ ConstructTupleDescriptor(Relation heapRelation, +@@ -181,7 +183,8 @@ ConstructTupleDescriptor(Relation heapRelation, * here we are indexing on a system attribute (-1...-n) */ from = SystemAttributeDefinition(atnum, @@ -1390,7 +1567,7 @@ index dea6889..18d96da 100644 } else { -@@ -339,13 +342,16 @@ InitializeAttributeOids(Relation indexRelation, +@@ -338,13 +341,16 @@ InitializeAttributeOids(Relation indexRelation, * ---------------------------------------------------------------- */ static void @@ -1408,7 +1585,7 @@ index dea6889..18d96da 100644 /* * open the attribute relation and its indexes */ -@@ -367,7 +373,8 @@ AppendAttributeTuples(Relation indexRelation, int numatts) +@@ -366,7 +372,8 @@ AppendAttributeTuples(Relation indexRelation, int numatts) Assert(indexTupDesc->attrs[i]->attnum == i + 1); Assert(indexTupDesc->attrs[i]->attcacheoff == -1); @@ -1418,7 +1595,7 @@ index dea6889..18d96da 100644 } CatalogCloseIndexes(indstate); -@@ -545,6 +552,7 @@ index_create(Oid heapRelationId, +@@ -544,6 +551,7 @@ index_create(Oid heapRelationId, bool mapped_relation; bool is_exclusion; Oid namespaceId; @@ -1426,7 +1603,7 @@ index dea6889..18d96da 100644 int i; is_exclusion = (indexInfo->ii_ExclusionOps != NULL); -@@ -682,15 +690,21 @@ index_create(Oid heapRelationId, +@@ -681,15 +689,21 @@ index_create(Oid heapRelationId, indexRelation->rd_rel->relam = accessMethodObjectId; indexRelation->rd_rel->relkind = RELKIND_INDEX; indexRelation->rd_rel->relhasoids = false; @@ -1449,7 +1626,7 @@ index dea6889..18d96da 100644 /* done with pg_class */ heap_close(pg_class, RowExclusiveLock); -@@ -706,7 +720,7 @@ index_create(Oid heapRelationId, +@@ -705,7 +719,7 @@ index_create(Oid heapRelationId, /* * append ATTRIBUTE tuples for the index */ @@ -2716,7 +2893,7 @@ index cecdfa5..5b51f68 100644 + } +} diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c -index 7a1b8e8..69988d0 100644 +index 61020dc..f8408b4 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -30,12 +30,14 @@ @@ -2794,7 +2971,7 @@ index 7a1b8e8..69988d0 100644 /* The heap rewrite module does the rest */ rewrite_heap_tuple(rwstate, tuple, copiedTuple); -@@ -1464,7 +1480,8 @@ get_tables_to_cluster(MemoryContext cluster_context) +@@ -1469,7 +1485,8 @@ get_tables_to_cluster(MemoryContext cluster_context) { index = (Form_pg_index) GETSTRUCT(indexTuple); @@ -4140,7 +4317,7 @@ index 26a3a52..e2b8683 100644 ereport(ERROR, (errcode(ERRCODE_DUPLICATE_FUNCTION), diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c -index 780dbc2..f471123 100644 +index a129511..6c2dbc4 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -40,6 +40,7 @@ @@ -4192,7 +4369,7 @@ index 780dbc2..f471123 100644 + ReleaseSysCache(tuple); - if (!reindex_relation(heapOid, true, false)) + if (!reindex_relation(heapOid, true, 0)) @@ -1670,6 +1683,9 @@ ReindexDatabase(const char *databaseName, bool do_system, bool do_user) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_DATABASE, databaseName); @@ -4660,7 +4837,7 @@ index 292a427..3c8a36f 100644 if (!seqrel->rd_islocaltemp) PreventCommandIfReadOnly("setval()"); diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c -index c4d81bb..9516700 100644 +index 6a1804b..2453fcf 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -32,6 +32,7 @@ @@ -4916,7 +5093,7 @@ index c4d81bb..9516700 100644 /* * Nothing to do here; Phase 3 does the work */ -@@ -3145,6 +3210,7 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) +@@ -3146,6 +3211,7 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) MemoryContext oldCxt; List *dropped_attrs = NIL; ListCell *lc; @@ -4924,7 +5101,7 @@ index c4d81bb..9516700 100644 econtext = GetPerTupleExprContext(estate); -@@ -3175,6 +3241,19 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) +@@ -3176,6 +3242,19 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) } /* @@ -4944,7 +5121,7 @@ index c4d81bb..9516700 100644 * Scan through the rows, generating a new row if needed and then * checking all the constraints. */ -@@ -3191,11 +3270,16 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) +@@ -3192,11 +3271,16 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) if (newrel) { Oid tupOid = InvalidOid; @@ -4961,7 +5138,7 @@ index c4d81bb..9516700 100644 /* Set dropped attributes to null in new tuple */ foreach(lc, dropped_attrs) -@@ -3227,6 +3311,9 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) +@@ -3228,6 +3312,9 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) /* Preserve OID, if any */ if (newTupDesc->tdhasoid) HeapTupleSetOid(tuple, tupOid); @@ -4971,7 +5148,7 @@ index c4d81bb..9516700 100644 } /* Now check any constraints on the possibly-changed tuple */ -@@ -3625,7 +3712,7 @@ ATPrepAddColumn(List **wqueue, Relation rel, bool recurse, +@@ -3626,7 +3713,7 @@ ATPrepAddColumn(List **wqueue, Relation rel, bool recurse, static void ATExecAddColumn(AlteredTableInfo *tab, Relation rel, @@ -4980,7 +5157,7 @@ index c4d81bb..9516700 100644 { Oid myrelid = RelationGetRelid(rel); Relation pgclass, -@@ -3639,6 +3726,10 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, +@@ -3640,6 +3727,10 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, int32 typmod; Form_pg_type tform; Expr *defval; @@ -4991,7 +5168,7 @@ index c4d81bb..9516700 100644 attrdesc = heap_open(AttributeRelationId, RowExclusiveLock); -@@ -3667,6 +3758,13 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, +@@ -3668,6 +3759,13 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, errmsg("child table \"%s\" has different type for column \"%s\"", RelationGetRelationName(rel), colDef->colname))); @@ -5005,7 +5182,7 @@ index c4d81bb..9516700 100644 /* If it's OID, child column must actually be OID */ if (isOid && childatt->attnum != ObjectIdAttributeNumber) ereport(ERROR, -@@ -3674,6 +3772,13 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, +@@ -3675,6 +3773,13 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, errmsg("child table \"%s\" has a conflicting \"%s\" column", RelationGetRelationName(rel), colDef->colname))); @@ -5019,7 +5196,7 @@ index c4d81bb..9516700 100644 /* Bump the existing child att's inhcount */ childatt->attinhcount++; simple_heap_update(attrdesc, &tuple->t_self, tuple); -@@ -3713,6 +3818,8 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, +@@ -3714,6 +3819,8 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, /* Determine the new attribute's number */ if (isOid) newattnum = ObjectIdAttributeNumber; @@ -5028,7 +5205,7 @@ index c4d81bb..9516700 100644 else { newattnum = ((Form_pg_class) GETSTRUCT(reltup))->relnatts + 1; -@@ -3752,7 +3859,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, +@@ -3753,7 +3860,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, ReleaseSysCache(typeTuple); @@ -5037,7 +5214,7 @@ index c4d81bb..9516700 100644 heap_close(attrdesc, RowExclusiveLock); -@@ -3761,6 +3868,8 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, +@@ -3762,6 +3869,8 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, */ if (isOid) ((Form_pg_class) GETSTRUCT(reltup))->relhasoids = true; @@ -5046,7 +5223,7 @@ index c4d81bb..9516700 100644 else ((Form_pg_class) GETSTRUCT(reltup))->relnatts = newattnum; -@@ -3872,7 +3981,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, +@@ -3873,7 +3982,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, * If we are adding an OID column, we have to tell Phase 3 to rewrite the * table to fix that. */ @@ -5055,7 +5232,7 @@ index c4d81bb..9516700 100644 tab->new_changeoids = true; /* -@@ -3925,6 +4034,31 @@ ATPrepAddOids(List **wqueue, Relation rel, bool recurse, AlterTableCmd *cmd) +@@ -3926,6 +4035,31 @@ ATPrepAddOids(List **wqueue, Relation rel, bool recurse, AlterTableCmd *cmd) } /* @@ -5087,7 +5264,7 @@ index c4d81bb..9516700 100644 * ALTER TABLE ALTER COLUMN DROP NOT NULL */ static void -@@ -3936,6 +4070,9 @@ ATExecDropNotNull(Relation rel, const char *colName) +@@ -3937,6 +4071,9 @@ ATExecDropNotNull(Relation rel, const char *colName) List *indexoidlist; ListCell *indexoidscan; @@ -5097,7 +5274,7 @@ index c4d81bb..9516700 100644 /* * lookup the attribute */ -@@ -4026,6 +4163,9 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel, +@@ -4027,6 +4164,9 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel, AttrNumber attnum; Relation attr_rel; @@ -5107,7 +5284,7 @@ index c4d81bb..9516700 100644 /* * lookup the attribute */ -@@ -4076,6 +4216,9 @@ ATExecColumnDefault(Relation rel, const char *colName, +@@ -4077,6 +4217,9 @@ ATExecColumnDefault(Relation rel, const char *colName, { AttrNumber attnum; @@ -5117,7 +5294,7 @@ index c4d81bb..9516700 100644 /* * get the number of the attribute */ -@@ -4150,6 +4293,9 @@ ATExecSetStatistics(Relation rel, const char *colName, Node *newValue) +@@ -4151,6 +4294,9 @@ ATExecSetStatistics(Relation rel, const char *colName, Node *newValue) HeapTuple tuple; Form_pg_attribute attrtuple; @@ -5127,7 +5304,7 @@ index c4d81bb..9516700 100644 Assert(IsA(newValue, Integer)); newtarget = intVal(newValue); -@@ -4216,6 +4362,9 @@ ATExecSetOptions(Relation rel, const char *colName, Node *options, +@@ -4217,6 +4363,9 @@ ATExecSetOptions(Relation rel, const char *colName, Node *options, bool repl_null[Natts_pg_attribute]; bool repl_repl[Natts_pg_attribute]; @@ -5137,7 +5314,7 @@ index c4d81bb..9516700 100644 attrelation = heap_open(AttributeRelationId, RowExclusiveLock); tuple = SearchSysCacheAttName(RelationGetRelid(rel), colName); -@@ -4275,6 +4424,9 @@ ATExecSetStorage(Relation rel, const char *colName, Node *newValue) +@@ -4276,6 +4425,9 @@ ATExecSetStorage(Relation rel, const char *colName, Node *newValue) HeapTuple tuple; Form_pg_attribute attrtuple; @@ -5147,7 +5324,7 @@ index c4d81bb..9516700 100644 Assert(IsA(newValue, String)); storagemode = strVal(newValue); -@@ -4373,6 +4525,9 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, +@@ -4374,6 +4526,9 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, if (recursing) ATSimplePermissions(rel, false); @@ -5157,7 +5334,7 @@ index c4d81bb..9516700 100644 /* * get the number of the attribute */ -@@ -4398,8 +4553,10 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, +@@ -4399,8 +4554,10 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, attnum = targetatt->attnum; @@ -5170,7 +5347,7 @@ index c4d81bb..9516700 100644 ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot drop system column \"%s\"", -@@ -4515,7 +4672,8 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, +@@ -4516,7 +4673,8 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, * If we dropped the OID column, must adjust pg_class.relhasoids and tell * Phase 3 to physically get rid of the column. */ @@ -5180,7 +5357,7 @@ index c4d81bb..9516700 100644 { Relation class_rel; Form_pg_class tuple_class; -@@ -4530,7 +4688,11 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, +@@ -4531,7 +4689,11 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, RelationGetRelid(rel)); tuple_class = (Form_pg_class) GETSTRUCT(tuple); @@ -5193,7 +5370,7 @@ index c4d81bb..9516700 100644 simple_heap_update(class_rel, &tuple->t_self, tuple); /* Keep the catalog indexes up to date */ -@@ -4677,6 +4839,9 @@ ATAddCheckConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel, +@@ -4678,6 +4840,9 @@ ATAddCheckConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel, if (recursing) ATSimplePermissions(rel, false); @@ -5203,7 +5380,7 @@ index c4d81bb..9516700 100644 /* * Call AddRelationNewConstraints to do the work, making sure it works on * a copy of the Constraint so transformExpr can't modify the original. It -@@ -4883,6 +5048,9 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel, +@@ -4884,6 +5049,9 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel, checkFkeyPermissions(pkrel, pkattnum, numpks); checkFkeyPermissions(rel, fkattnum, numfks); @@ -5213,7 +5390,7 @@ index c4d81bb..9516700 100644 /* * Look up the equality operators to use in the constraint. * -@@ -5628,6 +5796,9 @@ ATExecDropConstraint(Relation rel, const char *constrName, +@@ -5629,6 +5797,9 @@ ATExecDropConstraint(Relation rel, const char *constrName, if (recursing) ATSimplePermissions(rel, false); @@ -5223,7 +5400,7 @@ index c4d81bb..9516700 100644 conrel = heap_open(ConstraintRelationId, RowExclusiveLock); /* -@@ -5965,6 +6136,9 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, +@@ -5966,6 +6137,9 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, SysScanDesc scan; HeapTuple depTup; @@ -5233,7 +5410,7 @@ index c4d81bb..9516700 100644 attrelation = heap_open(AttributeRelationId, RowExclusiveLock); /* Look up the target column */ -@@ -6578,6 +6752,8 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing) +@@ -6596,6 +6770,8 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing) aclcheck_error(aclresult, ACL_KIND_NAMESPACE, get_namespace_name(namespaceOid)); } @@ -5242,7 +5419,7 @@ index c4d81bb..9516700 100644 } memset(repl_null, false, sizeof(repl_null)); -@@ -6743,6 +6919,9 @@ ATExecClusterOn(Relation rel, const char *indexName) +@@ -6761,6 +6937,9 @@ ATExecClusterOn(Relation rel, const char *indexName) { Oid indexOid; @@ -5252,7 +5429,7 @@ index c4d81bb..9516700 100644 indexOid = get_relname_relid(indexName, rel->rd_rel->relnamespace); if (!OidIsValid(indexOid)) -@@ -6767,6 +6946,9 @@ ATExecClusterOn(Relation rel, const char *indexName) +@@ -6785,6 +6964,9 @@ ATExecClusterOn(Relation rel, const char *indexName) static void ATExecDropCluster(Relation rel) { @@ -5262,7 +5439,7 @@ index c4d81bb..9516700 100644 mark_index_clustered(rel, InvalidOid); } -@@ -6817,6 +6999,9 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset) +@@ -6835,6 +7017,9 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset) bool repl_repl[Natts_pg_class]; static char *validnsps[] = HEAP_RELOPT_NAMESPACES; @@ -5272,7 +5449,7 @@ index c4d81bb..9516700 100644 if (defList == NIL) return; /* nothing to do */ -@@ -7145,6 +7330,9 @@ static void +@@ -7163,6 +7348,9 @@ static void ATExecEnableDisableTrigger(Relation rel, char *trigname, char fires_when, bool skip_system) { @@ -5282,7 +5459,7 @@ index c4d81bb..9516700 100644 EnableDisableTrigger(rel, trigname, fires_when, skip_system); } -@@ -7157,6 +7345,9 @@ static void +@@ -7175,6 +7363,9 @@ static void ATExecEnableDisableRule(Relation rel, char *trigname, char fires_when) { @@ -5292,7 +5469,7 @@ index c4d81bb..9516700 100644 EnableDisableRule(rel, trigname, fires_when); } -@@ -7199,6 +7390,10 @@ ATExecAddInherit(Relation child_rel, RangeVar *parent) +@@ -7217,6 +7408,10 @@ ATExecAddInherit(Relation child_rel, RangeVar *parent) */ ATSimplePermissions(parent_rel, false); @@ -5303,7 +5480,7 @@ index c4d81bb..9516700 100644 /* Permanent rels cannot inherit from temporary ones */ if (parent_rel->rd_istemp && !child_rel->rd_istemp) ereport(ERROR, -@@ -7551,6 +7746,9 @@ ATExecDropInherit(Relation rel, RangeVar *parent) +@@ -7569,6 +7764,9 @@ ATExecDropInherit(Relation rel, RangeVar *parent) List *connames; bool found = false; @@ -5313,7 +5490,7 @@ index c4d81bb..9516700 100644 /* * AccessShareLock on the parent is probably enough, seeing that DROP * TABLE doesn't lock parent tables at all. We need some lock since we'll -@@ -7848,6 +8046,9 @@ AlterTableNamespace(RangeVar *relation, const char *newschema, +@@ -7866,6 +8064,9 @@ AlterTableNamespace(RangeVar *relation, const char *newschema, /* get schema OID and check its permissions */ nspOid = LookupCreationNamespace(newschema); @@ -5323,7 +5500,7 @@ index c4d81bb..9516700 100644 if (oldNspOid == nspOid) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_TABLE), -@@ -8045,6 +8246,282 @@ AlterSeqNamespaces(Relation classRel, Relation rel, +@@ -8063,6 +8264,282 @@ AlterSeqNamespaces(Relation classRel, Relation rel, relation_close(depRel, AccessShareLock); } @@ -6454,7 +6631,7 @@ index c291529..dd0b12a 100644 CheckTableNotInUse(rel, "CREATE OR REPLACE VIEW"); diff --git a/src/backend/executor/execJunk.c b/src/backend/executor/execJunk.c -index 2fa7e68..c2b926c 100644 +index da22709..cbd4932 100644 --- a/src/backend/executor/execJunk.c +++ b/src/backend/executor/execJunk.c @@ -58,7 +58,8 @@ @@ -6477,7 +6654,7 @@ index 2fa7e68..c2b926c 100644 /* * Use the given slot, or make a new slot if we weren't given one. diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c -index 0b6cbcc..fbce8e4 100644 +index 6d4a773..a8ad9a3 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -38,6 +38,7 @@ @@ -6520,7 +6697,7 @@ index 0b6cbcc..fbce8e4 100644 } } -@@ -829,6 +841,7 @@ InitPlan(QueryDesc *queryDesc, int eflags) +@@ -826,6 +838,7 @@ InitPlan(QueryDesc *queryDesc, int eflags) j = ExecInitJunkFilter(planstate->plan->targetlist, tupType->tdhasoid, @@ -6528,7 +6705,7 @@ index 0b6cbcc..fbce8e4 100644 ExecInitExtraTupleSlot(estate)); estate->es_junkFilter = j; -@@ -1065,6 +1078,37 @@ ExecContextForcesOids(PlanState *planstate, bool *hasoids) +@@ -1062,6 +1075,37 @@ ExecContextForcesOids(PlanState *planstate, bool *hasoids) return false; } @@ -6566,7 +6743,7 @@ index 0b6cbcc..fbce8e4 100644 /* ---------------------------------------------------------------- * ExecEndPlan * -@@ -2073,6 +2117,7 @@ OpenIntoRel(QueryDesc *queryDesc) +@@ -2130,6 +2174,7 @@ OpenIntoRel(QueryDesc *queryDesc) Oid intoRelationId; TupleDesc tupdesc; DR_intorel *myState; @@ -6574,7 +6751,7 @@ index 0b6cbcc..fbce8e4 100644 static char *validnsps[] = HEAP_RELOPT_NAMESPACES; Assert(into); -@@ -2144,6 +2189,14 @@ OpenIntoRel(QueryDesc *queryDesc) +@@ -2201,6 +2246,14 @@ OpenIntoRel(QueryDesc *queryDesc) get_tablespace_name(tablespaceId)); } @@ -6589,7 +6766,7 @@ index 0b6cbcc..fbce8e4 100644 /* Parse and validate any reloptions */ reloptions = transformRelOptions((Datum) 0, into->options, -@@ -2174,7 +2227,8 @@ OpenIntoRel(QueryDesc *queryDesc) +@@ -2231,7 +2284,8 @@ OpenIntoRel(QueryDesc *queryDesc) into->onCommit, reloptions, true, @@ -6599,7 +6776,7 @@ index 0b6cbcc..fbce8e4 100644 FreeTupleDesc(tupdesc); -@@ -2298,6 +2352,11 @@ intorel_receive(TupleTableSlot *slot, DestReceiver *self) +@@ -2355,6 +2409,11 @@ intorel_receive(TupleTableSlot *slot, DestReceiver *self) */ if (myState->rel->rd_rel->relhasoids) HeapTupleSetOid(tuple, InvalidOid); @@ -6823,7 +7000,7 @@ index 5886c1b..50f91f5 100644 } diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c -index ea2cfc9..7b489db 100644 +index 75fc173..99cb650 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -1153,7 +1153,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, @@ -6835,7 +7012,7 @@ index ea2cfc9..7b489db 100644 } else if (fn_typtype == TYPTYPE_COMPOSITE || rettype == RECORDOID) { -@@ -1192,7 +1192,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, +@@ -1197,7 +1197,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, } /* Set up junk filter if needed */ if (junkFilter) @@ -6844,7 +7021,7 @@ index ea2cfc9..7b489db 100644 return false; /* NOT returning whole tuple */ } } -@@ -1205,7 +1205,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, +@@ -1210,7 +1210,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, * what the caller expects will happen at runtime. */ if (junkFilter) @@ -6919,7 +7096,7 @@ index 948f580..7d9f4f4 100644 fmgr_info(cmpproc, &(clause->cmpfinfo)); diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c -index 9699381..03afb4e 100644 +index f4b2b16..62c76b5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -38,11 +38,13 @@ @@ -7049,7 +7226,7 @@ index 9699381..03afb4e 100644 /* * Reset the per-output-tuple exprcontext. This is needed because * triggers expect to use that context as workspace. It's a bit ugly -@@ -713,6 +768,14 @@ ExecModifyTable(ModifyTableState *node) +@@ -714,6 +769,14 @@ ExecModifyTable(ModifyTableState *node) if (junkfilter != NULL) { @@ -7064,7 +7241,7 @@ index 9699381..03afb4e 100644 /* * extract the 'ctid' junk attribute. */ -@@ -742,11 +805,11 @@ ExecModifyTable(ModifyTableState *node) +@@ -743,11 +806,11 @@ ExecModifyTable(ModifyTableState *node) switch (operation) { case CMD_INSERT: @@ -7078,7 +7255,7 @@ index 9699381..03afb4e 100644 break; case CMD_DELETE: slot = ExecDelete(tupleid, planSlot, -@@ -858,7 +921,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) +@@ -855,7 +918,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) * RETURNING list. We assume the rest will look the same. */ tupDesc = ExecTypeFromTL((List *) linitial(node->returningLists), @@ -7087,7 +7264,7 @@ index 9699381..03afb4e 100644 /* Set up a slot for the output of the RETURNING projection(s) */ ExecInitResultTupleSlot(estate, &mtstate->ps); -@@ -892,7 +955,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) +@@ -889,7 +952,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) * We still must construct a dummy result tuple type, because InitPlan * expects one (maybe should change that?). */ @@ -7096,7 +7273,7 @@ index 9699381..03afb4e 100644 ExecInitResultTupleSlot(estate, &mtstate->ps); ExecAssignResultType(&mtstate->ps, tupDesc); -@@ -984,6 +1047,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) +@@ -986,6 +1049,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) j = ExecInitJunkFilter(subplan->targetlist, resultRelInfo->ri_RelationDesc->rd_att->tdhasoid, @@ -7374,10 +7551,10 @@ index 464183d..67d0316 100644 PG_RETURN_INT32(0); diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c -index 6e6844b..8d58a17 100644 +index 0b2aa3d..90bb7d4 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c -@@ -1825,6 +1825,7 @@ _copyRangeTblEntry(RangeTblEntry *from) +@@ -1823,6 +1823,7 @@ _copyRangeTblEntry(RangeTblEntry *from) COPY_SCALAR_FIELD(checkAsUser); COPY_BITMAPSET_FIELD(selectedCols); COPY_BITMAPSET_FIELD(modifiedCols); @@ -7385,7 +7562,7 @@ index 6e6844b..8d58a17 100644 return newnode; } -@@ -2757,6 +2758,21 @@ _copyAlterOwnerStmt(AlterOwnerStmt *from) +@@ -2755,6 +2756,21 @@ _copyAlterOwnerStmt(AlterOwnerStmt *from) return newnode; } @@ -7407,7 +7584,7 @@ index 6e6844b..8d58a17 100644 static RuleStmt * _copyRuleStmt(RuleStmt *from) { -@@ -3971,6 +3987,9 @@ copyObject(void *from) +@@ -3972,6 +3988,9 @@ copyObject(void *from) case T_AlterOwnerStmt: retval = _copyAlterOwnerStmt(from); break; @@ -7460,10 +7637,10 @@ index 6e00584..2adfa91 100644 retval = _equalRuleStmt(a, b); break; diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c -index ae0e2ab..36eee35 100644 +index 032150e..63f6b77 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c -@@ -2137,6 +2137,7 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node) +@@ -2143,6 +2143,7 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node) WRITE_OID_FIELD(checkAsUser); WRITE_BITMAPSET_FIELD(selectedCols); WRITE_BITMAPSET_FIELD(modifiedCols); @@ -7484,7 +7661,7 @@ index f28191d..f6f31e5 100644 READ_DONE(); } diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c -index 317a7e8..5b88ad6 100644 +index 45ba902..be917ec 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -39,6 +39,7 @@ @@ -7513,7 +7690,7 @@ index 317a7e8..5b88ad6 100644 * pullup (so that all non-inherited RTEs are present) and before * inheritance expansion (so that the info is available for diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c -index 8486516..acd6bac 100644 +index 8902b5b..321bba9 100644 --- a/src/backend/optimizer/util/clauses.c +++ b/src/backend/optimizer/util/clauses.c @@ -38,6 +38,7 @@ @@ -7524,7 +7701,7 @@ index 8486516..acd6bac 100644 #include "tcop/tcopprot.h" #include "utils/acl.h" #include "utils/builtins.h" -@@ -3724,6 +3725,10 @@ inline_function(Oid funcid, Oid result_type, List *args, +@@ -3752,6 +3753,10 @@ inline_function(Oid funcid, Oid result_type, List *args, if (pg_proc_aclcheck(funcid, GetUserId(), ACL_EXECUTE) != ACLCHECK_OK) return NULL; @@ -7535,7 +7712,7 @@ index 8486516..acd6bac 100644 /* * Make a temporary memory context, so that we don't leak all the stuff * that parsing might create. -@@ -4176,7 +4181,8 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte) +@@ -4205,7 +4210,8 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte) funcform->provolatile == PROVOLATILE_VOLATILE || funcform->prosecdef || !funcform->proretset || @@ -7546,7 +7723,7 @@ index 8486516..acd6bac 100644 ReleaseSysCache(func_tuple); return NULL; diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c -index 1576613..51e197f 100644 +index 70cdb59..1a88724 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -25,6 +25,7 @@ @@ -7565,7 +7742,7 @@ index 1576613..51e197f 100644 #include "utils/rel.h" -@@ -651,7 +653,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt) +@@ -660,7 +662,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt) tle = makeTargetEntry(expr, attr_num, col->name, @@ -7575,7 +7752,7 @@ index 1576613..51e197f 100644 rte->modifiedCols = bms_add_member(rte->modifiedCols, diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y -index 50ed871..d6b13da 100644 +index 05ff082..acb1799 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -183,8 +183,8 @@ static TypeName *TableFuncTypeName(List *columns); @@ -7615,7 +7792,7 @@ index 50ed871..d6b13da 100644 | AlterSeqStmt | AlterTableStmt | AlterRoleSetStmt -@@ -1758,6 +1761,20 @@ alter_table_cmd: +@@ -1761,6 +1764,20 @@ alter_table_cmd: n->subtype = AT_DropOids; $$ = (Node *)n; } @@ -7636,7 +7813,7 @@ index 50ed871..d6b13da 100644 /* ALTER TABLE CLUSTER ON */ | CLUSTER ON name { -@@ -6027,6 +6044,102 @@ AlterOwnerStmt: ALTER AGGREGATE func_name aggr_args OWNER TO RoleId +@@ -6028,6 +6045,102 @@ AlterOwnerStmt: ALTER AGGREGATE func_name aggr_args OWNER TO RoleId } ; @@ -7980,7 +8157,7 @@ index d1e1dac..8e994da 100644 cxt.ckconstraints = NIL; cxt.fkconstraints = NIL; diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c -index 4666fd6..784723d 100644 +index 279f0f0..f91f746 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -109,6 +109,7 @@ @@ -8021,7 +8198,7 @@ index 4666fd6..784723d 100644 /* If we need to signal the autovacuum launcher, do so now */ if (avlauncher_needs_signal) { -@@ -2120,6 +2128,8 @@ SIGHUP_handler(SIGNAL_ARGS) +@@ -2125,6 +2133,8 @@ SIGHUP_handler(SIGNAL_ARGS) signal_child(SysLoggerPID, SIGHUP); if (PgStatPID != 0) signal_child(PgStatPID, SIGHUP); @@ -8030,7 +8207,7 @@ index 4666fd6..784723d 100644 /* Reload authentication config files too */ if (!load_hba()) -@@ -2180,6 +2190,9 @@ pmdie(SIGNAL_ARGS) +@@ -2185,6 +2195,9 @@ pmdie(SIGNAL_ARGS) /* and the walwriter too */ if (WalWriterPID != 0) signal_child(WalWriterPID, SIGTERM); @@ -8040,7 +8217,7 @@ index 4666fd6..784723d 100644 /* * If we're in recovery, we can't kill the startup process -@@ -2242,6 +2255,9 @@ pmdie(SIGNAL_ARGS) +@@ -2247,6 +2260,9 @@ pmdie(SIGNAL_ARGS) /* and the walwriter too */ if (WalWriterPID != 0) signal_child(WalWriterPID, SIGTERM); @@ -8050,7 +8227,7 @@ index 4666fd6..784723d 100644 pmState = PM_WAIT_BACKENDS; } -@@ -2277,6 +2293,8 @@ pmdie(SIGNAL_ARGS) +@@ -2282,6 +2298,8 @@ pmdie(SIGNAL_ARGS) signal_child(PgArchPID, SIGQUIT); if (PgStatPID != 0) signal_child(PgStatPID, SIGQUIT); @@ -8059,7 +8236,7 @@ index 4666fd6..784723d 100644 ExitPostmaster(0); break; } -@@ -2549,6 +2567,16 @@ reaper(SIGNAL_ARGS) +@@ -2554,6 +2572,16 @@ reaper(SIGNAL_ARGS) continue; } @@ -8076,7 +8253,7 @@ index 4666fd6..784723d 100644 /* * Else do standard backend child cleanup. */ -@@ -2765,6 +2793,18 @@ HandleChildCrash(int pid, int exitstatus, const char *procname) +@@ -2770,6 +2798,18 @@ HandleChildCrash(int pid, int exitstatus, const char *procname) signal_child(AutoVacPID, (SendStop ? SIGSTOP : SIGQUIT)); } @@ -8095,7 +8272,7 @@ index 4666fd6..784723d 100644 /* * Force a power-cycle of the pgarch process too. (This isn't absolutely * necessary, but it seems like a good idea for robustness, and it -@@ -2921,7 +2961,8 @@ PostmasterStateMachine(void) +@@ -2926,7 +2966,8 @@ PostmasterStateMachine(void) WalReceiverPID == 0 && (BgWriterPID == 0 || !FatalError) && WalWriterPID == 0 && @@ -10159,10 +10336,10 @@ index 0000000..9a9e8a3 +} diff --git a/src/backend/sepgsql/label.c b/src/backend/sepgsql/label.c new file mode 100644 -index 0000000..7ab355c +index 0000000..ec8244d --- /dev/null +++ b/src/backend/sepgsql/label.c -@@ -0,0 +1,656 @@ +@@ -0,0 +1,588 @@ +/* + * label.c + * SE-PostgreSQL security label management @@ -10192,6 +10369,7 @@ index 0000000..7ab355c +#include "utils/tqual.h" +#include // for workaround hack +#include ++#include + +/* + * guc parameter to turn on/off mcstrans @@ -10380,256 +10558,212 @@ index 0000000..7ab355c + return nsid.secid; +} + -+/* -+ * a workaround implementation until libselinux/refpolicy don't -+ * support db_schema or other object classes. -+ */ -+static struct { -+ uint16 tclass; -+ char *pattern; -+ char *context; -+} initial_label_catalog[] = { -+ {SEPG_CLASS_DB_DATABASE, "*", -+ "system_u:object_r:sepgsql_db_t:s0"}, -+ {SEPG_CLASS_DB_SCHEMA, "*.*", -+ "system_u:object_r:sepgsql_db_t:s0"}, -+ {SEPG_CLASS_DB_TABLE, "*.pg_catalog.*", -+ "system_u:object_r:sepgsql_sysobj_t:s0"}, -+ {SEPG_CLASS_DB_TABLE, "*.*.*", -+ "system_u:object_r:sepgsql_table_t:s0"}, -+ {SEPG_CLASS_DB_VIEW, "*.*.*", -+ "system_u:object_r:sepgsql_db_t:s0"}, -+ {SEPG_CLASS_DB_SEQUENCE, "*.*.*", -+ "system_u:object_r:sepgsql_db_t:s0"}, -+ {SEPG_CLASS_DB_PROCEDURE, "*.pg_catalog.*", -+ "system_u:object_r:sepgsql_proc_exec_t:s0"}, -+ {SEPG_CLASS_DB_PROCEDURE, "*.*.*", -+ "system_u:object_r:sepgsql_user_proc_exec_t:s0"}, -+ {SEPG_CLASS_DB_COLUMN, "*.pg_catalog.*.*", -+ "system_u:object_r:sepgsql_sysobj_t:s0"}, -+ {SEPG_CLASS_DB_COLUMN, "*.*.*.*", -+ "system_u:object_r:sepgsql_table_t:s0"}, -+ {SEPG_CLASS_DB_TUPLE, "*.pg_catalog.*", -+ "system_u:object_r:sepgsql_sysobj_t:s0"}, -+ {SEPG_CLASS_DB_TUPLE, "*.*.*", -+ "system_u:object_r:sepgsql_table_t:s0"}, -+ {SEPG_CLASS_DB_BLOB, "*.*", -+ "system_u:object_r:sepgsql_blob_t:s0"}, -+ {0, NULL, NULL}, -+}; -+ -+static char * -+lookup_init_catalog(uint16 tclass, const char *name) ++static Oid ++sepgsql_initial_labeling_lookup(struct selabel_handle *sehnd, ++ Oid relationId, HeapTuple tuple) +{ -+ int i; -+ -+ for (i = 0; initial_label_catalog[i].pattern; i++) -+ { -+ if (initial_label_catalog[i].tclass == tclass && -+ fnmatch(initial_label_catalog[i].pattern, name, 0) == 0) -+ return initial_label_catalog[i].context; -+ } -+ elog(ERROR, "no valid initial security context for %s (tclass=%d)", -+ name, tclass); -+ return NULL; /* for compiler quiet */ -+} -+ -+static char * -+lookup_init_tuple_label(Oid relOid, HeapTuple tuple) -+{ -+ Oid relNsp = get_rel_namespace(relOid); -+ char namebuf[NAMEDATALEN * 3 + 10]; -+ -+ snprintf(namebuf, sizeof(namebuf), "%s.%s.%s", -+ get_database_name(MyDatabaseId), -+ get_namespace_name(relNsp), -+ get_rel_name(relOid)); -+ -+ return lookup_init_catalog(SEPG_CLASS_DB_TUPLE, namebuf); -+} -+ -+static char * -+lookup_init_database_label(HeapTuple tuple) -+{ -+ Form_pg_database datForm = (Form_pg_database) GETSTRUCT(tuple); -+ -+ return lookup_init_catalog(SEPG_CLASS_DB_DATABASE, -+ NameStr(datForm->datname)); -+} -+ -+static char * -+lookup_init_schema_label(HeapTuple tuple) -+{ -+ Form_pg_namespace nspForm = (Form_pg_namespace) GETSTRUCT(tuple); -+ char namebuf[NAMEDATALEN * 2 + 10]; -+ -+ snprintf(namebuf, sizeof(namebuf), "%s.%s", -+ get_database_name(MyDatabaseId), -+ NameStr(nspForm->nspname)); -+ -+ return lookup_init_catalog(SEPG_CLASS_DB_SCHEMA, namebuf); -+} -+ -+static char * -+lookup_init_relation_label(HeapTuple tuple) -+{ -+ Form_pg_class classForm = (Form_pg_class) GETSTRUCT(tuple); -+ const char *relName = NameStr(classForm->relname); -+ Oid relNsp = classForm->relnamespace; -+ char *seclabel; ++ Form_pg_database datForm; ++ Form_pg_namespace nspForm; ++ Form_pg_class clsForm; ++ Form_pg_attribute attForm; ++ Form_pg_proc proForm; + char namebuf[NAMEDATALEN * 3 + 10]; ++ Oid namespaceId; ++ Oid securityId = InvalidOid; ++ int type = 0; ++ security_context_t context; + -+ switch (classForm->relkind) ++ switch (relationId) + { -+ case RELKIND_RELATION: ++ case DatabaseRelationId: ++ datForm = (Form_pg_database) GETSTRUCT(tuple); ++ snprintf(namebuf, sizeof(namebuf), "%s", ++ NameStr(datForm->datname)); ++ type = SELABEL_DB_DATABASE; ++ break; ++ ++ case NamespaceRelationId: ++ nspForm = (Form_pg_namespace) GETSTRUCT(tuple); ++ snprintf(namebuf, sizeof(namebuf), "%s.%s", ++ get_database_name(MyDatabaseId), ++ NameStr(nspForm->nspname)); ++ type = SELABEL_DB_SCHEMA; ++ break; ++ ++ case RelationRelationId: ++ clsForm = (Form_pg_class) GETSTRUCT(tuple); ++ namespaceId = clsForm->relnamespace; ++ switch (clsForm->relkind) ++ { ++ case RELKIND_RELATION: ++ snprintf(namebuf, sizeof(namebuf), "%s.%s.%s", ++ get_database_name(MyDatabaseId), ++ get_namespace_name(namespaceId), ++ NameStr(clsForm->relname)); ++ type = SELABEL_DB_TABLE; ++ break; ++ ++ case RELKIND_SEQUENCE: ++ snprintf(namebuf, sizeof(namebuf), "%s.%s.%s", ++ get_database_name(MyDatabaseId), ++ get_namespace_name(namespaceId), ++ NameStr(clsForm->relname)); ++ type = SELABEL_DB_SEQUENCE; ++ break; ++ ++ case RELKIND_VIEW: ++ snprintf(namebuf, sizeof(namebuf), "%s.%s.%s", ++ get_database_name(MyDatabaseId), ++ get_namespace_name(namespaceId), ++ NameStr(clsForm->relname)); ++ type = SELABEL_DB_VIEW; ++ break; ++ ++ case RELKIND_INDEX: { ++ HeapTuple tbltup; ++ HeapTuple indtup; ++ Oid tableId; ++ ++ indtup = SearchSysCache1(INDEXRELID, ++ ObjectIdGetDatum(HeapTupleGetOid(tuple))); ++ if (!HeapTupleIsValid(indtup)) ++ elog(ERROR, "cache lookup failed for index %u", ++ HeapTupleGetOid(tuple)); ++ ++ tableId = ((Form_pg_index) GETSTRUCT(indtup))->indrelid; ++ tbltup = SearchSysCache1(RELOID, ObjectIdGetDatum(tableId)); ++ if (!HeapTupleIsValid(tbltup)) ++ elog(ERROR, "cache lookup failed for relation %u", tableId); ++ ++ securityId = sepgsql_initial_labeling_lookup(sehnd, RelationRelationId, tbltup); ++ ++ ReleaseSysCache(tbltup); ++ ReleaseSysCache(indtup); ++ ++ return securityId; ++ } ++ case RELKIND_TOASTVALUE: { ++ HeapTuple tbltup; ++ Oid tableId; ++ ++ /* ++ * XXX - we assume all the toast relation's name is ++ * "pg_toast_%u", and the "%u" shall be replaced by OID ++ * of the relation which owns the toast relation ++ */ ++ tableId = strtoul(NameStr(clsForm->relname) + 9, NULL, 10); ++ ++ tbltup = SearchSysCache1(RELOID, ++ ObjectIdGetDatum(tableId)); ++ if (!HeapTupleIsValid(tbltup)) ++ elog(ERROR, "cache lookup failed for relation %u", tableId); ++ ++ securityId = sepgsql_initial_labeling_lookup(sehnd, RelationRelationId, tbltup); ++ ++ ReleaseSysCache(tbltup); ++ ++ return securityId; ++ } ++ case RELKIND_COMPOSITE_TYPE: { ++ HeapTuple typtup; ++ ++ typtup = SearchSysCache1(TYPEOID, ++ ObjectIdGetDatum(clsForm->reltype)); ++ if (!HeapTupleIsValid(typtup)) ++ elog(ERROR, "cache lookup failed for type %u", clsForm->reltype); ++ ++ securityId = sepgsql_initial_labeling_lookup(sehnd, TypeRelationId, typtup); ++ ++ ReleaseSysCache(typtup); ++ ++ return securityId; ++ } ++ default: ++ elog(ERROR, "unexpected relkind %c of \"%s\"", ++ clsForm->relkind, NameStr(clsForm->relname)); ++ break; ++ } ++ break; ++ ++ case AttributeRelationId: ++ attForm = (Form_pg_attribute) GETSTRUCT(tuple); ++ if (get_rel_relkind(attForm->attrelid) == RELKIND_RELATION) ++ { ++ namespaceId = get_rel_namespace(attForm->attrelid); ++ snprintf(namebuf, sizeof(namebuf), "%s.%s.%s.%s", ++ get_database_name(MyDatabaseId), ++ get_namespace_name(namespaceId), ++ get_rel_name(attForm->attrelid), ++ NameStr(attForm->attname)); ++ type = SELABEL_DB_COLUMN; ++ } ++ else ++ { ++ HeapTuple classTup; ++ ++ classTup = SearchSysCache1(RELOID, ObjectIdGetDatum(attForm->attrelid)); ++ if (!HeapTupleIsValid(classTup)) ++ elog(ERROR, "cache lookup failed for relation %u", attForm->attrelid); ++ ++ securityId = sepgsql_initial_labeling_lookup(sehnd, RelationRelationId, classTup); ++ ++ ReleaseSysCache(classTup); ++ ++ return securityId; ++ } ++ break; ++ ++ case ProcedureRelationId: ++ proForm = (Form_pg_proc) GETSTRUCT(tuple); ++ namespaceId = proForm->pronamespace; + snprintf(namebuf, sizeof(namebuf), "%s.%s.%s", + get_database_name(MyDatabaseId), -+ get_namespace_name(relNsp), relName); -+ seclabel = lookup_init_catalog(SEPG_CLASS_DB_TABLE, namebuf); ++ get_namespace_name(namespaceId), ++ NameStr(proForm->proname)); ++ type = SELABEL_DB_PROCEDURE; + break; + -+ case RELKIND_SEQUENCE: -+ snprintf(namebuf, sizeof(namebuf), "%s.%s.%s", ++ case LargeObjectMetadataRelationId: ++ snprintf(namebuf, sizeof(namebuf), "%s.%u", + get_database_name(MyDatabaseId), -+ get_namespace_name(relNsp), relName); -+ seclabel = lookup_init_catalog(SEPG_CLASS_DB_SEQUENCE, namebuf); ++ HeapTupleGetOid(tuple)); ++ type = SELABEL_DB_BLOB; + break; + -+ case RELKIND_VIEW: -+ snprintf(namebuf, sizeof(namebuf), "%s.%s.%s", -+ get_database_name(MyDatabaseId), -+ get_namespace_name(relNsp), relName); -+ seclabel = lookup_init_catalog(SEPG_CLASS_DB_VIEW, namebuf); -+ break; -+ -+ case RELKIND_INDEX: { -+ HeapTuple tbltup; -+ HeapTuple indtup; -+ Oid tblOid; -+ Oid indOid = HeapTupleGetOid(tuple); -+ -+ indtup = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indOid)); -+ if (!HeapTupleIsValid(indtup)) -+ elog(ERROR, "cache lookup failed for index %u", indOid); -+ -+ tblOid = ((Form_pg_index) GETSTRUCT(indtup))->indrelid; -+ tbltup = SearchSysCache1(RELOID, ObjectIdGetDatum(tblOid)); -+ if (!HeapTupleIsValid(tbltup)) -+ elog(ERROR, "cache lookup failed for relation %u", tblOid); -+ -+ seclabel = lookup_init_relation_label(tbltup); -+ -+ ReleaseSysCache(tbltup); -+ ReleaseSysCache(indtup); -+ -+ break; -+ } -+ case RELKIND_TOASTVALUE: { -+ HeapTuple tbltup; -+ Oid tblOid; -+ -+ /* -+ * XXX - we assume all the toast relation's name is -+ * "pg_toast_%u", and the "%u" shall be replaced by OID -+ * of the relation which owns the toast relation -+ */ -+ tblOid = strtoul(relName + 9, NULL, 10); -+ -+ tbltup = SearchSysCache1(RELOID, -+ ObjectIdGetDatum(tblOid)); -+ if (!HeapTupleIsValid(tbltup)) -+ elog(ERROR, "cache lookup failed for relation %u", tblOid); -+ -+ seclabel = lookup_init_relation_label(tbltup); -+ -+ ReleaseSysCache(tbltup); -+ -+ break; -+ } -+ case RELKIND_COMPOSITE_TYPE: { -+ Oid typOid = classForm->reltype; -+ HeapTuple typtup; -+ -+ typtup = SearchSysCache1(TYPEOID, -+ ObjectIdGetDatum(typOid)); -+ if (!HeapTupleIsValid(typtup)) -+ elog(ERROR, "cache lookup failed for type %u", typOid); -+ -+ seclabel = lookup_init_tuple_label(TypeRelationId, typtup); -+ -+ ReleaseSysCache(typtup); -+ -+ break; -+ } + default: -+ elog(ERROR, "unexpected relkind %c of \"%s\"", -+ classForm->relkind, relName); -+ seclabel = NULL; /* compiler quiet */ ++ namespaceId = get_rel_namespace(relationId); ++ snprintf(namebuf, sizeof(namebuf), "%s.%s.%s", ++ get_database_name(MyDatabaseId), ++ get_namespace_name(namespaceId), ++ get_rel_name(relationId)); ++ type = SELABEL_DB_TUPLE; + break; + } -+ return seclabel; -+} + -+static char * -+lookup_init_attribute_label(HeapTuple tuple) -+{ -+ Form_pg_attribute attForm = (Form_pg_attribute) GETSTRUCT(tuple); -+ Oid tblOid = attForm->attrelid; -+ char *seclabel; -+ char namebuf[NAMEDATALEN * 4 + 10]; -+ -+ if (get_rel_relkind(tblOid) == RELKIND_RELATION) ++ if (selabel_lookup_raw(sehnd, &context, namebuf, type) == 0) + { -+ Oid tblNsp = get_rel_namespace(tblOid); -+ -+ snprintf(namebuf, sizeof(namebuf), "%s.%s.%s.%s", -+ get_database_name(MyDatabaseId), -+ get_namespace_name(tblNsp), -+ get_rel_name(tblOid), -+ NameStr(attForm->attname)); -+ -+ seclabel = lookup_init_catalog(SEPG_CLASS_DB_COLUMN, namebuf); ++ PG_TRY(); ++ { ++ securityId = seclabelTransInput(relationId, context); ++ } ++ PG_CATCH(); ++ { ++ freecon(context); ++ PG_RE_THROW(); ++ } ++ PG_END_TRY(); ++ freecon(context); + } ++ else if (errno == ENOENT) ++ elog(WARNING, ++ "SELinux: no initial label assigned for %s (type=%d), skipping", ++ namebuf, type); + else -+ { -+ HeapTuple tbltup; ++ elog(ERROR, ++ "SELinux: could not determine initial security label for %s (type=%d): %m", ++ namebuf, type); + -+ tbltup = SearchSysCache1(RELOID, ObjectIdGetDatum(tblOid)); -+ if (!HeapTupleIsValid(tbltup)) -+ elog(ERROR, "cache lookup failed for relation %u", tblOid); -+ -+ seclabel = lookup_init_relation_label(tbltup); -+ -+ ReleaseSysCache(tbltup); -+ } -+ return seclabel; -+} -+ -+static char * -+lookup_init_procedure_label(HeapTuple tuple) -+{ -+ Form_pg_proc proForm = (Form_pg_proc) GETSTRUCT(tuple); -+ Oid proNsp = proForm->pronamespace; -+ char namebuf[NAMEDATALEN * 3 + 10]; -+ -+ snprintf(namebuf, sizeof(namebuf), "%s.%s.%s", -+ get_database_name(MyDatabaseId), -+ get_namespace_name(proNsp), -+ NameStr(proForm->proname)); -+ -+ return lookup_init_catalog(SEPG_CLASS_DB_PROCEDURE, namebuf); -+} -+ -+static char * -+lookup_init_largeobject_label(HeapTuple tuple) -+{ -+ char namebuf[NAMEDATALEN + 20]; -+ -+ snprintf(namebuf, sizeof(namebuf), "%s.%u", -+ get_database_name(MyDatabaseId), -+ HeapTupleGetOid(tuple)); -+ -+ return lookup_init_catalog(SEPG_CLASS_DB_BLOB, namebuf); ++ return securityId; +} + +void @@ -10639,15 +10773,16 @@ index 0000000..7ab355c + SysScanDesc classScan; + ScanKeyData classSkey; + HeapTuple classTup; -+ Relation rel; -+ HeapScanDesc scan; -+ HeapTuple oldtup; -+ HeapTuple newtup; ++ struct selabel_handle *sehnd; + + Assert(IsBootstrapProcessingMode()); + + StartTransactionCommand(); + ++ sehnd = selabel_open(SELABEL_CTX_DB, NULL, 0); ++ if (!sehnd) ++ elog(ERROR, "failed to open initial selinux label"); ++ + classRel = heap_open(RelationRelationId, AccessShareLock); + + ScanKeyInit(&classSkey, @@ -10660,7 +10795,11 @@ index 0000000..7ab355c + + while (HeapTupleIsValid(classTup = systable_getnext(classScan))) + { -+ Oid relOid = HeapTupleGetOid(classTup); ++ Relation rel; ++ HeapScanDesc scan; ++ HeapTuple oldtup; ++ HeapTuple newtup; ++ Oid relOid = HeapTupleGetOid(classTup); + + Assert(((Form_pg_class) GETSTRUCT(classTup))->relhassecids); + @@ -10670,52 +10809,20 @@ index 0000000..7ab355c + + while (HeapTupleIsValid(oldtup = heap_getnext(scan, ForwardScanDirection))) + { -+ char *label; -+ Oid secid; ++ Oid securityId = sepgsql_initial_labeling_lookup(sehnd, relOid, oldtup); + -+ switch (relOid) -+ { -+ case DatabaseRelationId: -+ label = lookup_init_database_label(oldtup); -+ break; -+ -+ case NamespaceRelationId: -+ label = lookup_init_schema_label(oldtup); -+ break; -+ -+ case RelationRelationId: -+ label = lookup_init_relation_label(oldtup); -+ break; -+ -+ case AttributeRelationId: -+ label = lookup_init_attribute_label(oldtup); -+ break; -+ -+ case ProcedureRelationId: -+ label = lookup_init_procedure_label(oldtup); -+ break; -+ -+ case LargeObjectMetadataRelationId: -+ label = lookup_init_largeobject_label(oldtup); -+ break; -+ -+ default: -+ label = lookup_init_tuple_label(relOid, oldtup); -+ break; -+ } + /* + * inplace-updating + */ + newtup = heap_copytuple(oldtup); + -+ secid = seclabelTransInput(relOid, label); -+ -+ HeapTupleSetSecid(newtup, secid); ++ HeapTupleSetSecid(newtup, securityId); + + heap_inplace_update(rel, newtup); + + heap_freetuple(newtup); + } ++ + heap_endscan(scan); + + heap_close(rel, RowExclusiveLock); @@ -10724,6 +10831,8 @@ index 0000000..7ab355c + + heap_close(classRel, AccessShareLock); + ++ selabel_close(sehnd); ++ + CommitTransactionCommand(); +} + @@ -15983,7 +16092,7 @@ index 4e55b16..a9f9f7e 100644 TEXTOID, -1, 0); TupleDescInitEntry(tupdesc, (AttrNumber) 2, "setting", diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample -index e1f5ab6..43f47f6 100644 +index a3880da..7537ac8 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -76,6 +76,8 @@ @@ -16082,10 +16191,10 @@ index 5a73779..67fce14 100644 const char *defn, const char *dropStmt, const char *copyStmt, diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c -index be5339e..8352c93 100644 +index 6528f4d..e482bde 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c -@@ -540,6 +540,8 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, +@@ -542,6 +542,8 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, } else { @@ -16094,7 +16203,7 @@ index be5339e..8352c93 100644 _disableTriggersIfNecessary(AH, te, ropt); /* Select owner and schema as necessary */ -@@ -575,6 +577,16 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, +@@ -577,6 +579,16 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, "ONLY " : ""), fmtId(te->tag)); } @@ -16111,7 +16220,7 @@ index be5339e..8352c93 100644 /* * If we have a copy statement, use it. As of V1.3, these -@@ -595,6 +607,9 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, +@@ -597,6 +609,9 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, AH->writingCopyData = false; @@ -16121,7 +16230,7 @@ index be5339e..8352c93 100644 /* close out the transaction started above */ if (is_parallel && te->created) CommitTransaction(AH); -@@ -712,7 +727,7 @@ ArchiveEntry(Archive *AHX, +@@ -714,7 +729,7 @@ ArchiveEntry(Archive *AHX, const char *tag, const char *namespace, const char *tablespace, @@ -16130,7 +16239,7 @@ index be5339e..8352c93 100644 const char *desc, teSection section, const char *defn, const char *dropStmt, const char *copyStmt, -@@ -744,6 +759,7 @@ ArchiveEntry(Archive *AHX, +@@ -746,6 +761,7 @@ ArchiveEntry(Archive *AHX, newToc->tablespace = tablespace ? strdup(tablespace) : NULL; newToc->owner = strdup(owner); newToc->withOids = withOids; @@ -16138,7 +16247,7 @@ index be5339e..8352c93 100644 newToc->desc = strdup(desc); newToc->defn = strdup(defn); newToc->dropStmt = strdup(dropStmt); -@@ -2046,6 +2062,7 @@ WriteToc(ArchiveHandle *AH) +@@ -2048,6 +2064,7 @@ WriteToc(ArchiveHandle *AH) WriteStr(AH, te->tablespace); WriteStr(AH, te->owner); WriteStr(AH, te->withOids ? "true" : "false"); @@ -16146,7 +16255,7 @@ index be5339e..8352c93 100644 /* Dump list of dependencies */ for (i = 0; i < te->nDeps; i++) -@@ -2157,6 +2174,16 @@ ReadToc(ArchiveHandle *AH) +@@ -2159,6 +2176,16 @@ ReadToc(ArchiveHandle *AH) else te->withOids = true; @@ -16163,7 +16272,7 @@ index be5339e..8352c93 100644 /* Read TOC entry dependencies */ if (AH->version >= K_VERS_1_5) { -@@ -2275,6 +2302,9 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt, bool include_acls) +@@ -2277,6 +2304,9 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt, bool include_acls) if ((!include_acls || ropt->aclsSkip) && _tocEntryIsACL(te)) return 0; @@ -16173,7 +16282,7 @@ index be5339e..8352c93 100644 /* Ignore DATABASE entry unless we should create it */ if (!ropt->createDB && strcmp(te->desc, "DATABASE") == 0) return 0; -@@ -2341,6 +2371,8 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt, bool include_acls) +@@ -2343,6 +2373,8 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt, bool include_acls) (strcmp(te->desc, "ACL") == 0 && strncmp(te->tag, "LARGE OBJECT ", 13) == 0) || (strcmp(te->desc, "COMMENT") == 0 && @@ -16182,7 +16291,7 @@ index be5339e..8352c93 100644 strncmp(te->tag, "LARGE OBJECT ", 13) == 0)) res = res & REQ_DATA; else -@@ -2492,6 +2524,36 @@ _doSetWithOids(ArchiveHandle *AH, const bool withOids) +@@ -2494,6 +2526,36 @@ _doSetWithOids(ArchiveHandle *AH, const bool withOids) destroyPQExpBuffer(cmd); } @@ -16219,7 +16328,7 @@ index be5339e..8352c93 100644 /* * Issue the commands to connect to the specified database. -@@ -2590,6 +2652,18 @@ _setWithOids(ArchiveHandle *AH, TocEntry *te) +@@ -2592,6 +2654,18 @@ _setWithOids(ArchiveHandle *AH, TocEntry *te) } } @@ -16238,7 +16347,7 @@ index be5339e..8352c93 100644 /* * Issue the commands to select the specified schema as the current schema -@@ -2827,9 +2901,12 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat +@@ -2829,9 +2903,12 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat _selectOutputSchema(AH, te->namespace); _selectTablespace(AH, te->tablespace); @@ -16253,7 +16362,7 @@ index be5339e..8352c93 100644 /* Emit header comment for item */ if (!AH->noTocComments) diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h -index 0a135ee..27b2ef5 100644 +index 9f826b6..a46be6b 100644 --- a/src/bin/pg_dump/pg_backup_archiver.h +++ b/src/bin/pg_dump/pg_backup_archiver.h @@ -63,7 +63,7 @@ typedef z_stream *z_streamp; @@ -18077,7 +18186,7 @@ index 6047735..ce9a994 100644 #endif /* SYSATTR_H */ diff --git a/src/include/access/tupdesc.h b/src/include/access/tupdesc.h -index e38a6e76..d5688d5 100644 +index e38a6e7..d5688d5 100644 --- a/src/include/access/tupdesc.h +++ b/src/include/access/tupdesc.h @@ -75,13 +75,14 @@ typedef struct tupleDesc @@ -18508,7 +18617,7 @@ index 4dc2d4f..e50a83f 100644 #endif /* TYPECMDS_H */ diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h -index b2424a0..609f31b 100644 +index 13b6aa5..0350a17 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -131,8 +131,8 @@ extern TupleHashEntry FindTupleHashEntry(TupleHashTable hashtable, @@ -18522,15 +18631,15 @@ index b2424a0..609f31b 100644 extern JunkFilter *ExecInitJunkFilterConversion(List *targetList, TupleDesc cleanTupType, TupleTableSlot *slot); -@@ -164,6 +164,7 @@ extern void InitResultRelInfo(ResultRelInfo *resultRelInfo, +@@ -166,6 +166,7 @@ extern void InitResultRelInfo(ResultRelInfo *resultRelInfo, int instrument_options); extern ResultRelInfo *ExecGetTriggerResultRel(EState *estate, Oid relid); extern bool ExecContextForcesOids(PlanState *planstate, bool *hasoids); +extern bool ExecContextForcesSecids(PlanState *planstate, bool *hassecid); extern void ExecConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate); - extern TupleTableSlot *EvalPlanQual(EState *estate, EPQState *epqstate, -@@ -234,8 +235,8 @@ extern void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate); + extern ExecRowMark *ExecFindRowMark(EState *estate, Index rti); +@@ -238,8 +239,8 @@ extern void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate); extern TupleTableSlot *ExecInitExtraTupleSlot(EState *estate); extern TupleTableSlot *ExecInitNullTupleSlot(EState *estate, TupleDesc tupType); @@ -18608,7 +18717,7 @@ index 54eebbc..94d0969 100644 /* ---------------------- * Create Rule Statement diff --git a/src/include/parser/kwlist.h b/src/include/parser/kwlist.h -index 5065bd6..0c67e25 100644 +index ad835d9..71595e3 100644 --- a/src/include/parser/kwlist.h +++ b/src/include/parser/kwlist.h @@ -208,6 +208,7 @@ PG_KEYWORD("isnull", ISNULL, TYPE_FUNC_NAME_KEYWORD) @@ -19323,10 +19432,10 @@ index 9faefbe..90b7c94 100644 SearchSysCacheList(cacheId, 1, key1, 0, 0, 0) #define SearchSysCacheList2(cacheId, key1, key2) \ diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c -index 25d2760..9bb9d3f 100644 +index 589d514..5370346 100644 --- a/src/pl/plpgsql/src/pl_comp.c +++ b/src/pl/plpgsql/src/pl_comp.c -@@ -1936,7 +1936,7 @@ build_row_from_vars(PLpgSQL_variable **vars, int numvars) +@@ -1965,7 +1965,7 @@ build_row_from_vars(PLpgSQL_variable **vars, int numvars) row = palloc0(sizeof(PLpgSQL_row)); row->dtype = PLPGSQL_DTYPE_ROW; diff --git a/sepostgresql.spec b/sepostgresql.spec index b79d3e7..29745e1 100644 --- a/sepostgresql.spec +++ b/sepostgresql.spec @@ -11,8 +11,8 @@ Summary: Security Enhanced PostgreSQL Name: sepostgresql -Version: 9.0.1 -Release: 20101007%{?dist} +Version: 9.0.3 +Release: 20110415%{?dist} License: PostgreSQL Group: Applications/Databases Url: http://code.google.com/p/sepgsql/ @@ -24,7 +24,7 @@ Source3: sepostgresql.logrotate Patch0: sepostgresql-fedora-prefix.patch Patch1: sepostgresql-9.0-fullset.patch BuildRequires: perl glibc-devel bison flex readline-devel zlib-devel >= 1.0.4 -BuildRequires: checkpolicy libselinux-devel >= 2.0.80 audit-libs-devel +BuildRequires: checkpolicy libselinux-devel >= 2.0.96 audit-libs-devel BuildRequires: selinux-policy >= 3.6.8 %if %{ssl} BuildRequires: openssl-devel @@ -33,7 +33,7 @@ Requires(pre): shadow-utils Requires(post): policycoreutils /sbin/chkconfig Requires(preun): /sbin/chkconfig /sbin/service Requires(postun): policycoreutils -Requires: policycoreutils >= 2.0.16 libselinux >= 2.0.80 +Requires: policycoreutils >= 2.0.16 libselinux >= 2.0.96 Requires: selinux-policy >= 3.6.8 Requires: tzdata logrotate @@ -181,6 +181,10 @@ fi %attr(700,sepgsql,sepgsql) %dir %{_localstatedir}/lib/sepgsql/backups %changelog +* Fri Apr 15 2011 KaiGai Kohei - 9.0.3-20110415 +- upgrade base version to 9.0.3 +- initial labeling logic was revised to use selabel_lookup() + * Thu Oct 7 2010 KaiGai Kohei - 9.0.1-20101007 - upgrade base version to 9.0.1 diff --git a/sources b/sources index 5a1101a..8ba5714 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -5093c321bc47af2ea9afa726605ff1ce postgresql-9.0.1.tar.gz +56386ded2d5dcd8a4ceef0da81c3d22c postgresql-9.0.3.tar.gz