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
The following commit(s) were added to refs/heads/cbdb-postgres-merge by this
push:
new a9eb3cce203 Fix some conflicts in commands
a9eb3cce203 is described below
commit a9eb3cce203f519a5ec432091618922572201c3f
Author: Jinbao Chen <[email protected]>
AuthorDate: Sat Jul 19 21:05:00 2025 +0800
Fix some conflicts in commands
---
src/backend/commands/cluster.c | 164 ++++++++++-----------------------
src/backend/commands/copy.c | 98 ++++++--------------
src/backend/commands/matview.c | 67 +-------------
src/backend/commands/publicationcmds.c | 12 +--
4 files changed, 81 insertions(+), 260 deletions(-)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index f3655c3d7e6..7a3f5d9940b 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -6,13 +6,9 @@
* There is hardly anything left of Paul Brown's original implementation...
*
*
-<<<<<<< HEAD
* Portions Copyright (c) 2006-2008, Greenplum inc
* Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
- * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
-=======
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
* Portions Copyright (c) 1994-5, Regents of the University of California
*
*
@@ -40,15 +36,12 @@
#include "catalog/index.h"
#include "catalog/namespace.h"
#include "catalog/objectaccess.h"
-<<<<<<< HEAD
#include "catalog/pg_appendonly.h"
#include "catalog/pg_attribute_encoding.h"
#include "catalog/pg_type.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_tablespace.h"
-=======
#include "catalog/partition.h"
->>>>>>> REL_16_9
#include "catalog/pg_am.h"
#include "catalog/pg_database.h"
#include "catalog/pg_inherits.h"
@@ -97,7 +90,7 @@ typedef struct
} RelToCluster;
-static void cluster_multiple_rels(List *rtcs, ClusterParams *params);
+static void cluster_multiple_rels(List *rtcs, ClusterParams *params, RangeVar
*relation);
static void rebuild_relation(Relation OldHeap, Oid indexOid, bool verbose);
static void copy_table_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
bool verbose, bool
*pSwapToastByContent,
@@ -223,41 +216,35 @@ cluster(ParseState *pstate, ClusterStmt *stmt, bool
isTopLevel)
/* close relation, keep lock till commit */
table_close(rel, NoLock);
-<<<<<<< HEAD
- /* Do the job. */
- /* GPDB_14_MERGE_FIXME: do we need the return value of
cluster_rel to dispath ? */
- cluster_rel(tableOid, indexOid, ¶ms);
-
- if (Gp_role == GP_ROLE_DISPATCH)
- {
- CdbDispatchUtilityStatement((Node *) stmt,
-
DF_CANCEL_ON_ERROR|
-
DF_WITH_SNAPSHOT|
-
DF_NEED_TWO_PHASE,
-
GetAssignedOidsForDispatch(),
-
NULL);
- }
-
- if (IS_QD_OR_SINGLENODE())
- {
- /*
- * Update view status.
- * In principle, CLUSTER command won't change the
ligical data of
- * a table, it may change the physical pages by index.
- * But for Append Agg Plan in SERVERLESS mode, we need
to fetch
- * delta tuples from base table which requires the
ability of storage
- * to distint the pages instead, since latest relative
materialized
- * view REFRESH.
- */
- SetRelativeMatviewAuxStatus(tableOid,
-
MV_DATA_STATUS_UP_REORGANIZED,
-
MV_DATA_STATUS_TRANSFER_DIRECTION_ALL);
-
- }
-=======
/* Do the job. */
cluster_rel(tableOid, indexOid, ¶ms);
+ if (Gp_role == GP_ROLE_DISPATCH)
+ {
+ CdbDispatchUtilityStatement((Node *) stmt,
+
DF_CANCEL_ON_ERROR|
+
DF_WITH_SNAPSHOT|
+
DF_NEED_TWO_PHASE,
+
GetAssignedOidsForDispatch(),
+
NULL);
+ }
+
+ if (IS_QD_OR_SINGLENODE())
+ {
+ /*
+ * Update view status.
+ * In principle, CLUSTER command won't change
the ligical data of
+ * a table, it may change the physical pages by
index.
+ * But for Append Agg Plan in SERVERLESS mode,
we need to fetch
+ * delta tuples from base table which requires
the ability of storage
+ * to distint the pages instead, since latest
relative materialized
+ * view REFRESH.
+ */
+ SetRelativeMatviewAuxStatus(tableOid,
+
MV_DATA_STATUS_UP_REORGANIZED,
+
MV_DATA_STATUS_TRANSFER_DIRECTION_ALL);
+
+ }
return;
}
}
@@ -296,7 +283,6 @@ cluster(ParseState *pstate, ClusterStmt *stmt, bool
isTopLevel)
/* close relation, releasing lock on parent table */
table_close(rel, AccessExclusiveLock);
->>>>>>> REL_16_9
}
else
{
@@ -305,7 +291,7 @@ cluster(ParseState *pstate, ClusterStmt *stmt, bool
isTopLevel)
}
/* Do the job. */
- cluster_multiple_rels(rtcs, ¶ms);
+ cluster_multiple_rels(rtcs, ¶ms, stmt->relation);
/* Start a new transaction for the cleanup work. */
StartTransactionCommand();
@@ -322,49 +308,10 @@ cluster(ParseState *pstate, ClusterStmt *stmt, bool
isTopLevel)
* return.
*/
static void
-cluster_multiple_rels(List *rtcs, ClusterParams *params)
+cluster_multiple_rels(List *rtcs, ClusterParams *params, RangeVar *relation)
{
ListCell *lc;
-<<<<<<< HEAD
- /* Ok, now that we've got them all, cluster them one by one */
- foreach(rv, rvs)
- {
- RelToCluster *rvtc = (RelToCluster *) lfirst(rv);
- bool dispatch;
- ClusterParams cluster_params = params;
-
- /* Start a new transaction for each relation. */
- StartTransactionCommand();
- /* functions in indexes may want a snapshot set */
- PushActiveSnapshot(GetTransactionSnapshot());
- /* Do the job. */
- cluster_params.options |= CLUOPT_RECHECK;
- dispatch = cluster_rel(rvtc->tableOid, rvtc->indexOid,
- &cluster_params);
-
- if (Gp_role == GP_ROLE_DISPATCH && dispatch)
- {
- stmt->relation = makeNode(RangeVar);
- stmt->relation->schemaname =
get_namespace_name(get_rel_namespace(rvtc->tableOid));
- stmt->relation->relname =
get_rel_name(rvtc->tableOid);
- /* other fields in stmt are same */
- CdbDispatchUtilityStatement((Node *) stmt,
-
DF_CANCEL_ON_ERROR|
-
DF_WITH_SNAPSHOT,
-
GetAssignedOidsForDispatch(),
-
NULL);
- }
- /* See comments above. */
- if (IS_QD_OR_SINGLENODE())
- SetRelativeMatviewAuxStatus(rvtc->tableOid,
-
MV_DATA_STATUS_UP_REORGANIZED,
-
MV_DATA_STATUS_TRANSFER_DIRECTION_ALL);
-
- PopActiveSnapshot();
- CommitTransactionCommand();
- }
-=======
/* Commit to get out of starting transaction */
PopActiveSnapshot();
CommitTransactionCommand();
@@ -373,7 +320,7 @@ cluster_multiple_rels(List *rtcs, ClusterParams *params)
foreach(lc, rtcs)
{
RelToCluster *rtc = (RelToCluster *) lfirst(lc);
->>>>>>> REL_16_9
+ bool dispatch;
/* Start a new transaction for each relation. */
StartTransactionCommand();
@@ -382,7 +329,25 @@ cluster_multiple_rels(List *rtcs, ClusterParams *params)
PushActiveSnapshot(GetTransactionSnapshot());
/* Do the job. */
- cluster_rel(rtc->tableOid, rtc->indexOid, params);
+ dispatch = cluster_rel(rtc->tableOid, rtc->indexOid, params);
+
+ if (Gp_role == GP_ROLE_DISPATCH && dispatch)
+ {
+ relation = makeNode(RangeVar);
+ relation->schemaname =
get_namespace_name(get_rel_namespace(rtc->tableOid));
+ relation->relname = get_rel_name(rtc->tableOid);
+ /* other fields in stmt are same */
+ CdbDispatchUtilityStatement((Node *) stmt,
+
DF_CANCEL_ON_ERROR|
+
DF_WITH_SNAPSHOT,
+
GetAssignedOidsForDispatch(),
+
NULL);
+ }
+ /* See comments above. */
+ if (IS_QD_OR_SINGLENODE())
+ SetRelativeMatviewAuxStatus(rvtc->tableOid,
+
MV_DATA_STATUS_UP_REORGANIZED,
+
MV_DATA_STATUS_TRANSFER_DIRECTION_ALL);
PopActiveSnapshot();
CommitTransactionCommand();
@@ -465,11 +430,7 @@ cluster_rel(Oid tableOid, Oid indexOid, ClusterParams
*params)
if (recheck)
{
/* Check that the user still owns the relation */
-<<<<<<< HEAD
- if (!pg_class_ownercheck(tableOid, save_userid))
-=======
if (!object_ownercheck(RelationRelationId, tableOid,
save_userid))
->>>>>>> REL_16_9
{
relation_close(OldHeap, AccessExclusiveLock);
goto out;
@@ -582,11 +543,8 @@ cluster_rel(Oid tableOid, Oid indexOid, ClusterParams
*params)
/* NB: rebuild_relation does table_close() on OldHeap */
-<<<<<<< HEAD
result = true;
-=======
->>>>>>> REL_16_9
out:
/* Roll back any GUC changes executed by index functions */
AtEOXact_GUC(false, save_nestlevel);
@@ -810,28 +768,20 @@ make_column_name(char *prefix, char *colname)
* duplicates the logical structure of the OldHeap; but will have the
* specified physical storage properties NewTableSpace, NewAccessMethod, and
* relpersistence.
-<<<<<<< HEAD
*
* Specify a colprefix can create a table with different colname, incase
* column conflict issue happens in REFRESH MATERIALIZED VIEW operation.
-=======
->>>>>>> REL_16_9
*
* After this, the caller should load the new heap with transferred/modified
* data, then call finish_heap_swap to complete the operation.
*/
Oid
-<<<<<<< HEAD
make_new_heap_with_colname(Oid OIDOldHeap, Oid NewTableSpace, Oid
NewAccessMethod,
char relpersistence,
LOCKMODE lockmode,
bool createAoBlockDirectory,
bool makeCdbPolicy,
char *colprefix)
-=======
-make_new_heap(Oid OIDOldHeap, Oid NewTableSpace, Oid NewAccessMethod,
- char relpersistence, LOCKMODE lockmode)
->>>>>>> REL_16_9
{
TupleDesc OldHeapDesc;
char NewHeapName[NAMEDATALEN];
@@ -1372,15 +1322,9 @@ swap_relation_files(Oid r1, Oid r2, bool
target_is_pg_class,
reltup2;
Form_pg_class relform1,
relform2;
-<<<<<<< HEAD
- Oid relfilenode1,
- relfilenode2;
- Oid swaptemp;
-=======
RelFileNumber relfilenumber1,
relfilenumber2;
RelFileNumber swaptemp;
->>>>>>> REL_16_9
char swptmpchr;
Oid relam1,
relam2;
@@ -1398,7 +1342,6 @@ swap_relation_files(Oid r1, Oid r2, bool
target_is_pg_class,
elog(ERROR, "cache lookup failed for relation %u", r2);
relform2 = (Form_pg_class) GETSTRUCT(reltup2);
-<<<<<<< HEAD
if (IsAccessMethodAO(relform1->relam) ||
IsAccessMethodAO(relform2->relam))
ATAOEntries(relform1, relform2, frozenXid, cutoffMulti);
@@ -1420,14 +1363,10 @@ swap_relation_files(Oid r1, Oid r2, bool
target_is_pg_class,
relform1 = (Form_pg_class) GETSTRUCT(reltup1);
}
- relfilenode1 = relform1->relfilenode;
- relfilenode2 = relform2->relfilenode;
-=======
relfilenumber1 = relform1->relfilenode;
relfilenumber2 = relform2->relfilenode;
relam1 = relform1->relam;
relam2 = relform2->relam;
->>>>>>> REL_16_9
if (RelFileNumberIsValid(relfilenumber1) &&
RelFileNumberIsValid(relfilenumber2))
@@ -1995,13 +1934,8 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
/*
* Reset the relrewrite for the toast. The
command-counter
-<<<<<<< HEAD
- * increment is required here as we are about to update
- * the tuple that is updated as part of
RenameRelationInternal.
-=======
* increment is required here as we are about to update
the tuple
* that is updated as part of RenameRelationInternal.
->>>>>>> REL_16_9
*/
CommandCounterIncrement();
ResetRelRewrite(newrel->rd_rel->reltoastrelid);
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index 62990639ada..aaf38e974d4 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -3,13 +3,9 @@
* copy.c
* Implements the COPY utility command
*
-<<<<<<< HEAD
* Portions Copyright (c) 2005-2008, Greenplum inc
* Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
- * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
-=======
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
* Portions Copyright (c) 1994, Regents of the University of California
*
*
@@ -161,11 +157,7 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt,
}
else
{
-<<<<<<< HEAD
if (is_from && !is_member_of_role(GetUserId(),
ROLE_PG_READ_SERVER_FILES) && rel->rd_rel->relkind != RELKIND_DIRECTORY_TABLE)
-=======
- if (is_from && !has_privs_of_role(GetUserId(),
ROLE_PG_READ_SERVER_FILES))
->>>>>>> REL_16_9
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied to
COPY from a file"),
@@ -174,11 +166,7 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt,
errhint("Anyone can COPY to
stdout or from stdin. "
"psql's \\copy
command also works for anyone.")));
-<<<<<<< HEAD
if (!is_from && !is_member_of_role(GetUserId(),
ROLE_PG_WRITE_SERVER_FILES) && rel->rd_rel->relkind != RELKIND_DIRECTORY_TABLE)
-=======
- if (!is_from && !has_privs_of_role(GetUserId(),
ROLE_PG_WRITE_SERVER_FILES))
->>>>>>> REL_16_9
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied to
COPY to a file"),
@@ -276,12 +264,8 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt,
* backwards-compatibility, we do the translation to "COPY
(SELECT
* ...)" variant automatically, just like PostgreSQL does for
RLS.
*/
-<<<<<<< HEAD
if (check_enable_rls(rte->relid, InvalidOid, false) ==
RLS_ENABLED ||
(!is_from && rel->rd_rel->relkind ==
RELKIND_PARTITIONED_TABLE))
-=======
- if (check_enable_rls(relid, InvalidOid, false) == RLS_ENABLED)
->>>>>>> REL_16_9
{
SelectStmt *select;
ColumnRef *cr;
@@ -497,7 +481,6 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt,
{
CopyToState cstate;
-<<<<<<< HEAD
/*
* GPDB_91_MERGE_FIXME: ExecutorStart() is called in
BeginCopyTo,
* but the TRY-CATCH block only starts here. If an error is
@@ -515,20 +498,12 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt,
cstate = BeginCopyToDirectoryTable(pstate,
stmt->filename, stmt->dirfilename,
rel, stmt->is_program, options);
}
-=======
- cstate = BeginCopyTo(pstate, rel, query, relid,
- stmt->filename,
stmt->is_program,
- NULL, stmt->attlist,
stmt->options);
- *processed = DoCopyTo(cstate); /* copy from database to file */
- EndCopyTo(cstate);
- }
->>>>>>> REL_16_9
else
{
cstate = BeginCopyTo(pstate, rel, query, relid,
stmt->filename, stmt->is_program,
-
stmt->attlist, options);
+ NULL,
stmt->attlist, options);
}
/*
@@ -998,21 +973,10 @@ ProcessCopyOptions(ParseState *pstate,
errmsg("COPY delimiter cannot be \"%s\"",
opts_out->delim)));
/* Check header */
-<<<<<<< HEAD
- /*
- * In PostgreSQL, HEADER is not allowed in text mode either, but in
GPDB,
- * only forbid it with BINARY.
- */
- if (opts_out->binary && opts_out->header_line)
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("COPY cannot specify HEADER in BINARY
mode")));
-=======
if (opts_out->binary && opts_out->header_line)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot specify HEADER in BINARY
mode")));
->>>>>>> REL_16_9
/* Check quote */
if (!opts_out->csv_mode && opts_out->quote != NULL)
@@ -1095,7 +1059,6 @@ ProcessCopyOptions(ParseState *pstate,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("CSV quote character must not appear in
the NULL specification")));
-<<<<<<< HEAD
if (opts_out->tags != NULL && !is_from)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
@@ -1167,6 +1130,35 @@ ProcessCopyOptions(ParseState *pstate,
errhint("Valid options are:
'LF', 'CRLF' and 'CR'.")));
}
}
+
+ if (opts_out->default_print)
+ {
+ if (!is_from)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("COPY DEFAULT
only available using COPY FROM")));
+
+ /* Don't allow the delimiter to appear in the default string. */
+ if (strchr(opts_out->default_print, opts_out->delim[0]) != NULL)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("COPY delimiter
must not appear in the DEFAULT specification")));
+
+ /* Don't allow the CSV quote char to appear in the default
string. */
+ if (opts_out->csv_mode &&
+ strchr(opts_out->default_print, opts_out->quote[0]) !=
NULL)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("CSV quote
character must not appear in the DEFAULT specification")));
+
+ /* Don't allow the NULL and DEFAULT string to be the same */
+ if (opts_out->null_print_len == opts_out->default_print_len &&
+ strncmp(opts_out->null_print, opts_out->default_print,
+ opts_out->null_print_len) == 0)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("NULL
specification and DEFAULT specification cannot be the same")));
+ }
}
void
@@ -1334,36 +1326,6 @@ CopyToQueryOnSegment(CopyToState cstate)
/* run the plan --- the dest receiver will send tuples */
ExecutorRun(cstate->queryDesc, ForwardScanDirection, 0L, true);
return 0;
-=======
- if (opts_out->default_print)
- {
- if (!is_from)
- ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("COPY DEFAULT only available
using COPY FROM")));
-
- /* Don't allow the delimiter to appear in the default string. */
- if (strchr(opts_out->default_print, opts_out->delim[0]) != NULL)
- ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("COPY delimiter must not appear
in the DEFAULT specification")));
-
- /* Don't allow the CSV quote char to appear in the default
string. */
- if (opts_out->csv_mode &&
- strchr(opts_out->default_print, opts_out->quote[0]) !=
NULL)
- ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("CSV quote character must not
appear in the DEFAULT specification")));
-
- /* Don't allow the NULL and DEFAULT string to be the same */
- if (opts_out->null_print_len == opts_out->default_print_len &&
- strncmp(opts_out->null_print, opts_out->default_print,
- opts_out->null_print_len) == 0)
- ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("NULL specification and DEFAULT
specification cannot be the same")));
- }
->>>>>>> REL_16_9
}
/*
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index 4057a3e8832..d2514e326bc 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -435,10 +435,7 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char
*queryString,
SetUserIdAndSecContext(relowner,
save_sec_context |
SECURITY_RESTRICTED_OPERATION);
save_nestlevel = NewGUCNestLevel();
-<<<<<<< HEAD
oldPopulated = RelationIsPopulated(matviewRel);
-=======
->>>>>>> REL_16_9
/* Make sure it is a materialized view. */
if (matviewRel->rd_rel->relkind != RELKIND_MATVIEW)
@@ -545,7 +542,6 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char
*queryString,
*/
SetMatViewPopulatedState(matviewRel, !stmt->skipData);
-<<<<<<< HEAD
if (IS_QD_OR_SINGLENODE())
{
/*
@@ -573,8 +569,6 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char
*queryString,
dataQuery->parentStmtType = PARENTSTMTTYPE_REFRESH_MATVIEW;
-=======
->>>>>>> REL_16_9
/* Concurrent refresh builds new data in temp tablespace, and does
diff. */
if (concurrent)
{
@@ -666,21 +660,15 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char
*queryString,
* it against access by any other process until commit (by which time it
* will be gone).
*/
-<<<<<<< HEAD
OIDNewHeap = make_new_heap_with_colname(matviewOid, tableSpace,
matviewRel->rd_rel->relam, relpersistence,
ExclusiveLock,
ao_has_index, true, "_$");
-=======
- OIDNewHeap = make_new_heap(matviewOid, tableSpace,
-
matviewRel->rd_rel->relam,
- relpersistence,
ExclusiveLock);
->>>>>>> REL_16_9
+
LockRelationOid(OIDNewHeap, AccessExclusiveLock);
dest = CreateTransientRelDestReceiver(OIDNewHeap, matviewOid,
concurrent, relpersistence,
stmt->skipData);
refreshClause = MakeRefreshClause(concurrent, stmt->skipData,
stmt->relation);
-<<<<<<< HEAD
/*
* Only in dispatcher role, we should set intoPolicy, else it should
remain NULL.
*/
@@ -688,8 +676,6 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char
*queryString,
{
dataQuery->intoPolicy = matviewRel->rd_cdbpolicy;
}
-=======
->>>>>>> REL_16_9
/* Generate the data, if wanted. */
/*
* In GPDB, we call refresh_matview_datafill() even when WITH NO DATA
was
@@ -720,7 +706,6 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char
*queryString,
refresh_by_heap_swap(matviewOid, OIDNewHeap, relpersistence);
/*
-<<<<<<< HEAD
* Inform stats collector about our activity: basically, we
truncated
* the matview and inserted some new data. (The concurrent
code path
* above doesn't need to worry about this because the inserts
and
@@ -733,12 +718,6 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char
*queryString,
* the current comment to avoid further upstream merge issues.
* The pgstat is updated in function transientrel_shutdown on
QE side.
* This related to issue:
https://github.com/greenplum-db/gpdb/issues/11375
-=======
- * Inform cumulative stats system about our activity:
basically, we
- * truncated the matview and inserted some new data. (The
concurrent
- * code path above doesn't need to worry about this because the
- * inserts and deletes it issues get counted by lower-level
code.)
->>>>>>> REL_16_9
*/
// pgstat_count_truncate(matviewRel);
// if (!stmt->skipData)
@@ -1189,12 +1168,8 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid
relowner,
"(SELECT 1 FROM %s newdata2 WHERE
newdata2.* IS NOT NULL "
"AND newdata2.*
OPERATOR(pg_catalog.*=) newdata.* "
"AND newdata2.ctid
OPERATOR(pg_catalog.<>) "
-<<<<<<< HEAD
"newdata.ctid AND
newdata2.gp_segment_id "
"OPERATOR(pg_catalog.=)
newdata.gp_segment_id)",
-=======
- "newdata.ctid)",
->>>>>>> REL_16_9
tempname, tempname, tempname);
if (SPI_execute(querybuf.data, false, 1) != SPI_OK_SELECT)
elog(ERROR, "SPI_exec failed: %s", querybuf.data);
@@ -1222,7 +1197,6 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid
relowner,
* because you cannot create temp tables in SRO context. For extra
* paranoia, add the composite type column only after switching back to
* SRO context.
-<<<<<<< HEAD
*
* Greenplum doesn't store diffs in a composite type column, instead it
* creates a similar table with the same distribution for performance
@@ -1250,23 +1224,6 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid
relowner,
appendStringInfo(&querybuf,
"ALTER TABLE %s ADD COLUMN sid
pg_catalog.int4",
diffname);
-=======
- */
- SetUserIdAndSecContext(relowner,
- save_sec_context |
SECURITY_LOCAL_USERID_CHANGE);
- resetStringInfo(&querybuf);
- appendStringInfo(&querybuf,
- "CREATE TEMP TABLE %s (tid
pg_catalog.tid)",
- diffname);
- if (SPI_exec(querybuf.data, 0) != SPI_OK_UTILITY)
- elog(ERROR, "SPI_exec failed: %s", querybuf.data);
- SetUserIdAndSecContext(relowner,
- save_sec_context |
SECURITY_RESTRICTED_OPERATION);
- resetStringInfo(&querybuf);
- appendStringInfo(&querybuf,
- "ALTER TABLE %s ADD COLUMN newdata %s",
- diffname, tempname);
->>>>>>> REL_16_9
if (SPI_exec(querybuf.data, 0) != SPI_OK_UTILITY)
elog(ERROR, "SPI_exec failed: %s", querybuf.data);
@@ -1274,15 +1231,9 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid
relowner,
resetStringInfo(&querybuf);
appendStringInfo(&querybuf,
"INSERT INTO %s "
-<<<<<<< HEAD
"SELECT newdata.*, mv.ctid AS tid,
mv.gp_segment_id as sid "
"FROM %s mv FULL JOIN %s newdata ON (",
diffname, matviewname, tempname);
-=======
- "SELECT mv.ctid AS tid, newdata.*::%s
AS newdata "
- "FROM %s mv FULL JOIN %s newdata ON (",
- diffname, tempname, matviewname,
tempname);
->>>>>>> REL_16_9
/*
* Get the list of index OIDs for the table from the relcache, and look
up
@@ -1374,11 +1325,7 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid
relowner,
appendStringInfoString(&querybuf, " AND
");
leftop = quote_qualified_identifier("newdata",
-<<<<<<< HEAD
NameStr(newattr->attname));
-=======
-
NameStr(attr->attname));
->>>>>>> REL_16_9
rightop = quote_qualified_identifier("mv",
NameStr(attr->attname));
@@ -1409,8 +1356,6 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid
relowner,
if (!foundUniqueIndex)
elog(ERROR, "could not find suitable unique index on
materialized view");
-
-
appendStringInfoString(&querybuf,
" AND newdata.*
OPERATOR(pg_catalog.*=) mv.*) "
"WHERE newdata.* IS NULL OR
mv.* IS NULL "
@@ -1439,12 +1384,8 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid
relowner,
"DELETE FROM %s mv WHERE ctid
OPERATOR(pg_catalog.=) ANY "
"(SELECT diff.tid FROM %s diff "
"WHERE diff.tid IS NOT NULL "
-<<<<<<< HEAD
"AND diff.tid OPERATOR(pg_catalog.=)
mv.ctid AND diff.sid "
"OPERATOR(pg_catalog.=)
mv.gp_segment_id)",
-=======
- "AND diff.newdata IS NULL)",
->>>>>>> REL_16_9
matviewname, diffname);
if (SPI_exec(querybuf.data, 0) != SPI_OK_DELETE)
elog(ERROR, "SPI_exec failed: %s", querybuf.data);
@@ -1461,14 +1402,8 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid
relowner,
appendStringInfo(&querybuf, " %s,",
NameStr(attr->attname));
}
appendStringInfo(&querybuf,
-<<<<<<< HEAD
" FROM %s diff WHERE tid IS NULL",
diffname);
-=======
- "INSERT INTO %s SELECT
(diff.newdata).* "
- "FROM %s diff WHERE tid IS NULL",
- matviewname, diffname);
->>>>>>> REL_16_9
if (SPI_exec(querybuf.data, 0) != SPI_OK_INSERT)
elog(ERROR, "SPI_exec failed: %s", querybuf.data);
diff --git a/src/backend/commands/publicationcmds.c
b/src/backend/commands/publicationcmds.c
index 0998ea48a34..5de6728476d 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -55,7 +55,6 @@
#include "utils/varlena.h"
-<<<<<<< HEAD
#include "catalog/heap.h"
#include "catalog/oid_dispatch.h"
#include "cdb/cdbdisp_query.h"
@@ -63,7 +62,7 @@
/* Same as MAXNUMMESSAGES in sinvaladt.c */
#define MAX_RELCACHE_INVAL_MSGS 4096
-=======
+
/*
* Information used to validate the columns in the row filter expression. See
* contain_invalid_rfcolumn_walker for details.
@@ -76,7 +75,6 @@ typedef struct rf_context
Oid relid; /* relid of the
relation */
Oid parentid; /* relid of the parent
relation */
} rf_context;
->>>>>>> REL_16_9
static List *OpenTableList(List *tables);
static void CloseTableList(List *rels);
@@ -1057,10 +1055,6 @@ AlterPublicationOptions(ParseState *pstate,
AlterPublicationStmt *stmt,
* invalidate all partitions contained in the respective
partition
* trees, not just those explicitly mentioned in the
publication.
*/
-<<<<<<< HEAD
- List *relids = GetPublicationRelations(pubform->oid,
-
PUBLICATION_PART_ALL);
-=======
if (root_relids == NIL)
relids = GetPublicationRelations(pubform->oid,
PUBLICATION_PART_ALL);
@@ -1079,7 +1073,6 @@ AlterPublicationOptions(ParseState *pstate,
AlterPublicationStmt *stmt,
schemarelids = GetAllSchemaPublicationRelations(pubform->oid,
PUBLICATION_PART_ALL);
relids = list_concat_unique_oid(relids, schemarelids);
->>>>>>> REL_16_9
InvalidatePublicationRels(relids);
}
@@ -1520,7 +1513,6 @@ RemovePublicationRelById(Oid proid)
pubrel->prrelid);
InvalidatePublicationRels(relids);
-<<<<<<< HEAD
CatalogTupleDelete(rel, &tup->t_self);
@@ -1557,8 +1549,6 @@ RemovePublicationById(Oid pubid)
*/
if (Gp_role == GP_ROLE_DISPATCH)
MetaTrackDropObject(PublicationRelationId, pubid);
-=======
->>>>>>> REL_16_9
CatalogTupleDelete(rel, &tup->t_self);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]