Skip to content

Commit 050d370

Browse files
committed
Fix for ace9973867c to work in MPP
1 parent d6d611b commit 050d370

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

contrib/citext/expected/create_index_acl.out

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
-- DefineIndex() uses the table owner userid where necessary.)
88
-- Don't override tablespaces; this version lacks allow_in_place_tablespaces.
99
BEGIN;
10+
SET allow_segment_DML TO true;
1011
CREATE ROLE regress_minimal;
12+
NOTICE: resource queue required -- using default resource queue "pg_default"
1113
CREATE SCHEMA s;
1214
CREATE EXTENSION citext SCHEMA s;
1315
-- Revoke all conceivably-relevant ACLs within the extension. The system
@@ -42,7 +44,7 @@ REVOKE ALL ON FUNCTION s.index_row_if FROM PUBLIC;
4244
GRANT EXECUTE ON FUNCTION s.index_row_if TO regress_minimal;
4345
-- Non-extension, non-function objects.
4446
CREATE COLLATION s.coll (LOCALE="C");
45-
CREATE TABLE s.x (y s.citext);
47+
CREATE TABLE s.x (y s.citext) DISTRIBUTED REPLICATED;
4648
ALTER TABLE s.x OWNER TO regress_minimal;
4749
-- Empty-table DefineIndex()
4850
CREATE UNIQUE INDEX u0rows ON s.x USING btree

contrib/citext/sql/create_index_acl.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
-- Don't override tablespaces; this version lacks allow_in_place_tablespaces.
1010

1111
BEGIN;
12+
SET allow_segment_DML TO true;
1213
CREATE ROLE regress_minimal;
1314
CREATE SCHEMA s;
1415
CREATE EXTENSION citext SCHEMA s;
@@ -44,7 +45,7 @@ REVOKE ALL ON FUNCTION s.index_row_if FROM PUBLIC;
4445
GRANT EXECUTE ON FUNCTION s.index_row_if TO regress_minimal;
4546
-- Non-extension, non-function objects.
4647
CREATE COLLATION s.coll (LOCALE="C");
47-
CREATE TABLE s.x (y s.citext);
48+
CREATE TABLE s.x (y s.citext) DISTRIBUTED REPLICATED;
4849
ALTER TABLE s.x OWNER TO regress_minimal;
4950
-- Empty-table DefineIndex()
5051
CREATE UNIQUE INDEX u0rows ON s.x USING btree

src/backend/commands/indexcmds.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,6 +1903,10 @@ DefineIndex(Oid relationId,
19031903
}
19041904

19051905
stmt->idxname = indexRelationName;
1906+
1907+
AtEOXact_GUC(false, root_save_nestlevel);
1908+
SetUserIdAndSecContext(root_save_userid, root_save_sec_context);
1909+
19061910
if (shouldDispatch)
19071911
{
19081912
/* make sure the QE uses the same index name that we chose */
@@ -1923,15 +1927,17 @@ DefineIndex(Oid relationId,
19231927
* Indexes on partitioned tables are not themselves built, so we're
19241928
* done here.
19251929
*/
1926-
AtEOXact_GUC(false, root_save_nestlevel);
1927-
SetUserIdAndSecContext(root_save_userid, root_save_sec_context);
19281930
table_close(rel, NoLock);
19291931
if (!OidIsValid(parentIndexId))
19301932
pgstat_progress_end_command();
19311933
return address;
19321934
}
19331935

19341936
stmt->idxname = indexRelationName;
1937+
1938+
AtEOXact_GUC(false, root_save_nestlevel);
1939+
SetUserIdAndSecContext(root_save_userid, root_save_sec_context);
1940+
19351941
if (shouldDispatch)
19361942
{
19371943
int flags = DF_CANCEL_ON_ERROR | DF_WITH_SNAPSHOT;
@@ -1941,6 +1947,7 @@ DefineIndex(Oid relationId,
19411947
/* make sure the QE uses the same index name that we chose */
19421948
stmt->oldNode = InvalidOid;
19431949
Assert(stmt->relation != NULL);
1950+
19441951
CdbDispatchUtilityStatement((Node *) stmt, flags,
19451952
GetAssignedOidsForDispatch(),
19461953
NULL);
@@ -1950,9 +1957,6 @@ DefineIndex(Oid relationId,
19501957
cdb_sync_indcheckxmin_with_segments(indexRelationId);
19511958
}
19521959

1953-
AtEOXact_GUC(false, root_save_nestlevel);
1954-
SetUserIdAndSecContext(root_save_userid, root_save_sec_context);
1955-
19561960
if (!concurrent || Gp_role == GP_ROLE_EXECUTE)
19571961
{
19581962
/* Close the heap and we're done, in the non-concurrent case */

src/backend/tcop/utility.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2049,7 +2049,7 @@ ProcessUtilitySlow(ParseState *pstate,
20492049

20502050
/*
20512051
* The QD might have looked up the OID of the base table
2052-
* already, and stashed it in stmt->relid
2052+
* already, and stashed it in stmt->relationOid
20532053
*/
20542054
if (stmt->relationOid)
20552055
relid = stmt->relationOid;

0 commit comments

Comments
 (0)