mirror of https://github.com/citusdata/citus.git
Fix vanilla tests with domain creation (#8238)
Qualify create domain stmt after local execution, to avoid such diffs in PG vanilla tests: ```diff create domain d_fail as anyelement; -ERROR: "anyelement" is not a valid base type for a domain +ERROR: "pg_catalog.anyelement" is not a valid base type for a domain ``` These tests were newly added in PG18, however this is not new PG18 behavior, just some added tests. https://github.com/postgres/postgres/commit/0172b4c94 Fixes #8042pull/8247/head
parent
351cb2044d
commit
f1dd976a14
|
|
@ -19,6 +19,7 @@
|
||||||
#include "nodes/parsenodes.h"
|
#include "nodes/parsenodes.h"
|
||||||
#include "tcop/utility.h"
|
#include "tcop/utility.h"
|
||||||
|
|
||||||
|
#include "distributed/citus_depended_object.h"
|
||||||
#include "distributed/commands.h"
|
#include "distributed/commands.h"
|
||||||
#include "distributed/commands/utility_hook.h"
|
#include "distributed/commands/utility_hook.h"
|
||||||
#include "distributed/deparser.h"
|
#include "distributed/deparser.h"
|
||||||
|
|
@ -63,6 +64,13 @@ PostprocessCreateDistributedObjectFromCatalogStmt(Node *stmt, const char *queryS
|
||||||
return NIL;
|
return NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ops->qualify && DistOpsValidityState(stmt, ops) ==
|
||||||
|
ShouldQualifyAfterLocalCreation)
|
||||||
|
{
|
||||||
|
/* qualify the statement after local creation */
|
||||||
|
ops->qualify(stmt);
|
||||||
|
}
|
||||||
|
|
||||||
List *addresses = GetObjectAddressListFromParseTree(stmt, false, true);
|
List *addresses = GetObjectAddressListFromParseTree(stmt, false, true);
|
||||||
|
|
||||||
/* the code-path only supports a single object */
|
/* the code-path only supports a single object */
|
||||||
|
|
|
||||||
|
|
@ -370,6 +370,20 @@ DistOpsValidityState(Node *node, const DistributeObjectOps *ops)
|
||||||
{
|
{
|
||||||
if (ops && ops->operationType == DIST_OPS_CREATE)
|
if (ops && ops->operationType == DIST_OPS_CREATE)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* We should beware of qualifying the CREATE statement too early.
|
||||||
|
*/
|
||||||
|
if (nodeTag(node) == T_CreateDomainStmt)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Create Domain statements should be qualified after local creation
|
||||||
|
* because in case of an error in creation, we don't want to print
|
||||||
|
* the error with the qualified name, as that would differ with
|
||||||
|
* vanilla Postgres error output.
|
||||||
|
*/
|
||||||
|
return ShouldQualifyAfterLocalCreation;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We should not validate CREATE statements because no address exists
|
* We should not validate CREATE statements because no address exists
|
||||||
* here yet.
|
* here yet.
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@ typedef enum DistOpsValidationState
|
||||||
HasAtLeastOneValidObject,
|
HasAtLeastOneValidObject,
|
||||||
HasNoneValidObject,
|
HasNoneValidObject,
|
||||||
HasObjectWithInvalidOwnership,
|
HasObjectWithInvalidOwnership,
|
||||||
NoAddressResolutionRequired
|
NoAddressResolutionRequired,
|
||||||
|
ShouldQualifyAfterLocalCreation
|
||||||
} DistOpsValidationState;
|
} DistOpsValidationState;
|
||||||
|
|
||||||
extern void SetLocalClientMinMessagesIfRunningPGTests(int
|
extern void SetLocalClientMinMessagesIfRunningPGTests(int
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue