This is an automated email from the ASF dual-hosted git repository. chenjinbao1989 pushed a commit to branch cbdb-postgres-merge in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 672921aace1a52d5f12cc23c13f97abe1ddd99ad Author: Jinbao Chen <[email protected]> AuthorDate: Sun Jan 11 10:54:52 2026 +0800 Fix conflicts on pg_dump --- src/backend/commands/user.c | 4 +- src/bin/pg_dump/Makefile | 12 ++-- src/bin/pg_dump/common.c | 7 --- src/bin/pg_dump/dumputils.c | 50 --------------- src/bin/pg_dump/pg_backup_archiver.c | 111 +--------------------------------- src/bin/pg_dump/pg_backup_directory.c | 5 -- 6 files changed, 9 insertions(+), 180 deletions(-) diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c index 2b7b16d9d95..1012182a0f2 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -444,9 +444,9 @@ CreateRole(ParseState *pstate, CreateRoleStmt *stmt) if (dprofile) profilename = strVal(dprofile->arg); if (daccountIsLock) - account_is_lock = boolVal(daccountIsLock->arg); + account_is_lock = intVal(daccountIsLock->arg) != 0; if (denableProfile) - enable_profile = boolVal(denableProfile->arg); + enable_profile = intVal(denableProfile->arg) != 0; /* * Only the super user has the privileges of profile. diff --git a/src/bin/pg_dump/Makefile b/src/bin/pg_dump/Makefile index 42c678c9f0a..063f35cd06f 100644 --- a/src/bin/pg_dump/Makefile +++ b/src/bin/pg_dump/Makefile @@ -16,19 +16,17 @@ subdir = src/bin/pg_dump top_builddir = ../../.. include $(top_builddir)/src/Makefile.global -<<<<<<< HEAD +export GZIP_PROGRAM=$(GZIP) +export LZ4 +export ZSTD +export with_icu + # the use of tempnam in pg_backup_tar.c causes a warning when using newer versions of GCC override CPPFLAGS := -Wno-deprecated-declarations -I$(libpq_srcdir) $(CPPFLAGS) ifeq ($(PORTNAME),openbsd) override CFLAGS += -pthread endif -======= -export GZIP_PROGRAM=$(GZIP) -export LZ4 -export ZSTD -export with_icu ->>>>>>> REL_16_9 override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport) diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 2005c3d9ea2..0fa10963b31 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -168,13 +168,10 @@ getSchemaData(Archive *fout, int *numTablesPtr) /* this must be after getTables and getFuncs */ pg_log_info("reading user-defined types"); (void) getTypes(fout, &numTypes); -<<<<<<< HEAD /* this must be after getFuncs */ pg_log_info("reading type storage options"); getTypeStorageOptions(fout, &numTypeStorageOptions); -======= ->>>>>>> REL_16_9 /* this must be after getFuncs, too */ pg_log_info("reading procedural languages"); @@ -449,11 +446,7 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) if (parentidx == NULL) continue; -<<<<<<< HEAD - attachinfo = (IndexAttachInfo *) pg_malloc(sizeof(IndexAttachInfo)); -======= attachinfo = pg_malloc_object(IndexAttachInfo); ->>>>>>> REL_16_9 attachinfo->dobj.objType = DO_INDEX_ATTACH; attachinfo->dobj.catId.tableoid = 0; diff --git a/src/bin/pg_dump/dumputils.c b/src/bin/pg_dump/dumputils.c index 67d8cd02a49..a454d926e3a 100644 --- a/src/bin/pg_dump/dumputils.c +++ b/src/bin/pg_dump/dumputils.c @@ -170,59 +170,9 @@ buildACLCommands(const char *name, const char *subname, const char *nspname, */ for (i = 0; i < nrevokeitems; i++) { -<<<<<<< HEAD - Assert(nraclitems == 0); - - appendPQExpBuffer(firstsql, "%sREVOKE ALL", prefix); - if (subname) - appendPQExpBuffer(firstsql, "(%s)", subname); - appendPQExpBuffer(firstsql, " ON %s ", type); - if (nspname && *nspname) - appendPQExpBuffer(firstsql, "%s.", fmtId(nspname)); - appendPQExpBuffer(firstsql, "%s FROM PUBLIC;\n", name); - } - else - { - /* Scan individual REVOKE ACL items */ - for (i = 0; i < nraclitems; i++) - { - if (!parseAclItem(raclitems[i], type, name, subname, remoteVersion, - grantee, grantor, privs, NULL)) - { - ok = false; - break; - } - - if (privs->len > 0) - { - appendPQExpBuffer(firstsql, "%sREVOKE %s ON %s ", - prefix, privs->data, type); - if (nspname && *nspname) - appendPQExpBuffer(firstsql, "%s.", fmtId(nspname)); - appendPQExpBuffer(firstsql, "%s FROM ", name); - if (grantee->len == 0) - appendPQExpBufferStr(firstsql, "PUBLIC;\n"); - else if (strncmp(grantee->data, "group ", - strlen("group ")) == 0) - appendPQExpBuffer(firstsql, "GROUP %s;\n", - fmtId(grantee->data + strlen("group "))); - else - appendPQExpBuffer(firstsql, "%s;\n", - fmtId(grantee->data)); - } - } - } - - /* Scan individual ACL items */ - for (i = 0; i < naclitems; i++) - { - if (!parseAclItem(aclitems[i], type, name, subname, remoteVersion, - grantee, grantor, privs, privswgo)) -======= if (!parseAclItem(revokeitems[i], type, name, subname, remoteVersion, grantee, grantor, privs, NULL)) ->>>>>>> REL_16_9 { ok = false; break; diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index a2adb3b348c..db7849e288b 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -273,20 +273,9 @@ CloseArchive(Archive *AHX) AH->ClosePtr(AH); /* Close the output */ -<<<<<<< HEAD - errno = 0; /* in case gzclose() doesn't set it */ - if (AH->gzOut) - res = GZCLOSE(AH->OF); - else if (AH->OF != stdout) - res = fclose(AH->OF); - - if (res != 0) - fatal("could not close output file: %m"); -======= errno = 0; if (!EndCompressFileHandle(AH->OF)) pg_fatal("could not close output file: %m"); ->>>>>>> REL_16_9 } /* Public */ @@ -1667,21 +1656,7 @@ RestoreOutput(ArchiveHandle *AH, CompressFileHandle *savedOutput) if (!EndCompressFileHandle(AH->OF)) pg_fatal("could not close output file: %m"); -<<<<<<< HEAD - errno = 0; /* in case gzclose() doesn't set it */ - if (AH->gzOut) - res = GZCLOSE(AH->OF); - else - res = fclose(AH->OF); - - if (res != 0) - fatal("could not close output file: %m"); - - AH->gzOut = savedContext.gzOut; - AH->OF = savedContext.OF; -======= AH->OF = savedOutput; ->>>>>>> REL_16_9 } @@ -3552,12 +3527,8 @@ _selectTableAccessMethod(ArchiveHandle *AH, const char *tableam) destroyPQExpBuffer(cmd); -<<<<<<< HEAD if (AH->currTableAm) free(AH->currTableAm); -======= - free(AH->currTableAm); ->>>>>>> REL_16_9 AH->currTableAm = pg_strdup(want); } @@ -3577,13 +3548,8 @@ _getObjectDescription(PQExpBuffer buf, const TocEntry *te) if (strcmp(type, "COLLATION") == 0 || strcmp(type, "CONVERSION") == 0 || strcmp(type, "DOMAIN") == 0 || -<<<<<<< HEAD - strcmp(type, "TABLE") == 0 || strcmp(type, "EXTERNAL TABLE") == 0 || strcmp(type, "FOREIGN TABLE") == 0 || - strcmp(type, "TYPE") == 0 || -======= ->>>>>>> REL_16_9 strcmp(type, "FOREIGN TABLE") == 0 || strcmp(type, "MATERIALIZED VIEW") == 0 || strcmp(type, "SEQUENCE") == 0 || @@ -3618,23 +3584,13 @@ _getObjectDescription(PQExpBuffer buf, const TocEntry *te) * These object types require additional decoration. Fortunately, the * information needed is exactly what's in the DROP command. */ -<<<<<<< HEAD - if (strcmp(type, "AGGREGATE") == 0 || - strcmp(type, "FUNCTION") == 0 || - strcmp(type, "OPERATOR") == 0 || - strcmp(type, "OPERATOR CLASS") == 0 || - strcmp(type, "OPERATOR FAMILY") == 0 || - strcmp(type, "PROCEDURE") == 0 || - /* Cloudberry Additions */ - strcmp(type, "PROTOCOL") == 0) -======= else if (strcmp(type, "AGGREGATE") == 0 || strcmp(type, "FUNCTION") == 0 || strcmp(type, "OPERATOR") == 0 || strcmp(type, "OPERATOR CLASS") == 0 || strcmp(type, "OPERATOR FAMILY") == 0 || - strcmp(type, "PROCEDURE") == 0) ->>>>>>> REL_16_9 + strcmp(type, "PROCEDURE") == 0 || + strcmp(type, "PROTOCOL") == 0)) { /* Chop "DROP " off the front and make a modifiable copy */ char *first = pg_strdup(te->dropStmt + 5); @@ -3780,68 +3736,6 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData) te->owner && strlen(te->owner) > 0 && te->dropStmt && strlen(te->dropStmt) > 0) { -<<<<<<< HEAD - if (strcmp(te->desc, "AGGREGATE") == 0 || - strcmp(te->desc, "BLOB") == 0 || - strcmp(te->desc, "COLLATION") == 0 || - strcmp(te->desc, "CONVERSION") == 0 || - strcmp(te->desc, "DATABASE") == 0 || - strcmp(te->desc, "DOMAIN") == 0 || - strcmp(te->desc, "FUNCTION") == 0 || - strcmp(te->desc, "OPERATOR") == 0 || - strcmp(te->desc, "OPERATOR CLASS") == 0 || - strcmp(te->desc, "OPERATOR FAMILY") == 0 || - strcmp(te->desc, "PROCEDURE") == 0 || - strcmp(te->desc, "PROCEDURAL LANGUAGE") == 0 || - strcmp(te->desc, "SCHEMA") == 0 || - strcmp(te->desc, "EVENT TRIGGER") == 0 || - strcmp(te->desc, "TABLE") == 0 || - strcmp(te->desc, "EXTERNAL TABLE") == 0 || - strcmp(te->desc, "FOREIGN TABLE") == 0 || - strcmp(te->desc, "TYPE") == 0 || - strcmp(te->desc, "VIEW") == 0 || - strcmp(te->desc, "MATERIALIZED VIEW") == 0 || - strcmp(te->desc, "SEQUENCE") == 0 || - strcmp(te->desc, "FOREIGN TABLE") == 0 || - strcmp(te->desc, "TEXT SEARCH DICTIONARY") == 0 || - strcmp(te->desc, "TEXT SEARCH CONFIGURATION") == 0 || - strcmp(te->desc, "FOREIGN DATA WRAPPER") == 0 || - strcmp(te->desc, "SERVER") == 0 || - strcmp(te->desc, "PROTOCOL") == 0 || - strcmp(te->desc, "STATISTICS") == 0 || - strcmp(te->desc, "PUBLICATION") == 0 || - strcmp(te->desc, "SUBSCRIPTION") == 0) - { - PQExpBuffer temp = createPQExpBuffer(); - - appendPQExpBufferStr(temp, "ALTER "); - _getObjectDescription(temp, te); - appendPQExpBuffer(temp, " OWNER TO %s;", fmtId(te->owner)); - ahprintf(AH, "%s\n\n", temp->data); - destroyPQExpBuffer(temp); - } - else if (strcmp(te->desc, "CAST") == 0 || - strcmp(te->desc, "CHECK CONSTRAINT") == 0 || - strcmp(te->desc, "CONSTRAINT") == 0 || - strcmp(te->desc, "DATABASE PROPERTIES") == 0 || - strcmp(te->desc, "DEFAULT") == 0 || - strcmp(te->desc, "FK CONSTRAINT") == 0 || - strcmp(te->desc, "INDEX") == 0 || - strcmp(te->desc, "RULE") == 0 || - strcmp(te->desc, "TRIGGER") == 0 || - strcmp(te->desc, "ROW SECURITY") == 0 || - strcmp(te->desc, "POLICY") == 0 || - strcmp(te->desc, "USER MAPPING") == 0 || - strcmp(te->desc, "BINARY UPGRADE")) - { - /* these object types don't have separate owners */ - } - else - { - pg_log_warning("don't know how to set owner for object type \"%s\"", - te->desc); - } -======= PQExpBufferData temp; initPQExpBuffer(&temp); @@ -3854,7 +3748,6 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData) if (temp.data[0]) ahprintf(AH, "ALTER %s OWNER TO %s;\n\n", temp.data, fmtId(te->owner)); termPQExpBuffer(&temp); ->>>>>>> REL_16_9 } /* diff --git a/src/bin/pg_dump/pg_backup_directory.c b/src/bin/pg_dump/pg_backup_directory.c index 9b802509fcf..6bf3f3ad9ed 100644 --- a/src/bin/pg_dump/pg_backup_directory.c +++ b/src/bin/pg_dump/pg_backup_directory.c @@ -370,13 +370,8 @@ _EndData(ArchiveHandle *AH, TocEntry *te) lclContext *ctx = (lclContext *) AH->formatData; /* Close the file */ -<<<<<<< HEAD - if (cfclose(ctx->dataFH) != 0) - fatal("could not close data file: %m"); -======= if (!EndCompressFileHandle(ctx->dataFH)) pg_fatal("could not close data file: %m"); ->>>>>>> REL_16_9 ctx->dataFH = NULL; } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
