mirror of https://github.com/citusdata/citus.git
Not invalidate fkey cache if citus not installed (#4521)
parent
1e377ec699
commit
7dddfa2d0b
|
@ -3596,6 +3596,15 @@ InvalidateForeignRelationGraphCacheCallback(Datum argument, Oid relationId)
|
||||||
void
|
void
|
||||||
InvalidateForeignKeyGraph(void)
|
InvalidateForeignKeyGraph(void)
|
||||||
{
|
{
|
||||||
|
if (!CitusHasBeenLoaded())
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* We should not try to invalidate foreign key graph
|
||||||
|
* if citus is not loaded.
|
||||||
|
*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CitusInvalidateRelcacheByRelid(DistColocationRelationId());
|
CitusInvalidateRelcacheByRelid(DistColocationRelationId());
|
||||||
|
|
||||||
/* bump command counter to force invalidation to take effect */
|
/* bump command counter to force invalidation to take effect */
|
||||||
|
|
|
@ -18,6 +18,36 @@ SET client_min_messages TO 'WARNING';
|
||||||
DROP FUNCTION pg_catalog.master_create_worker_shards;
|
DROP FUNCTION pg_catalog.master_create_worker_shards;
|
||||||
DROP EXTENSION citus CASCADE;
|
DROP EXTENSION citus CASCADE;
|
||||||
RESET client_min_messages;
|
RESET client_min_messages;
|
||||||
|
BEGIN;
|
||||||
|
SET client_min_messages TO ERROR;
|
||||||
|
SET search_path TO public;
|
||||||
|
CREATE EXTENSION citus;
|
||||||
|
SET citus.replicate_reference_tables_on_activate TO OFF;
|
||||||
|
SELECT 1 FROM master_add_node('localhost', :master_port, groupId => 0);
|
||||||
|
?column?
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
create table l1 (a int unique);
|
||||||
|
SELECT create_reference_table('l1');
|
||||||
|
create_reference_table
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
create schema other_schema;
|
||||||
|
create table other_schema.l3 (a int);
|
||||||
|
select create_reference_table ('other_schema.l3');
|
||||||
|
create_reference_table
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
alter table other_schema.l3 add constraint fkey foreign key (a) references l1(a);
|
||||||
|
-- show that works fine
|
||||||
|
drop schema public cascade;
|
||||||
|
ROLLBACK;
|
||||||
CREATE EXTENSION citus;
|
CREATE EXTENSION citus;
|
||||||
-- this function is dropped in Citus10, added here for tests
|
-- this function is dropped in Citus10, added here for tests
|
||||||
CREATE OR REPLACE FUNCTION pg_catalog.master_create_worker_shards(table_name text, shard_count integer,
|
CREATE OR REPLACE FUNCTION pg_catalog.master_create_worker_shards(table_name text, shard_count integer,
|
||||||
|
|
|
@ -19,6 +19,28 @@ DROP FUNCTION pg_catalog.master_create_worker_shards;
|
||||||
DROP EXTENSION citus CASCADE;
|
DROP EXTENSION citus CASCADE;
|
||||||
RESET client_min_messages;
|
RESET client_min_messages;
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
SET client_min_messages TO ERROR;
|
||||||
|
SET search_path TO public;
|
||||||
|
CREATE EXTENSION citus;
|
||||||
|
|
||||||
|
-- not wait for replicating reference tables from other test files
|
||||||
|
SET citus.replicate_reference_tables_on_activate TO OFF;
|
||||||
|
SELECT 1 FROM master_add_node('localhost', :master_port, groupId => 0);
|
||||||
|
|
||||||
|
create table l1 (a int unique);
|
||||||
|
SELECT create_reference_table('l1');
|
||||||
|
|
||||||
|
create schema other_schema;
|
||||||
|
create table other_schema.l3 (a int);
|
||||||
|
select create_reference_table ('other_schema.l3');
|
||||||
|
|
||||||
|
alter table other_schema.l3 add constraint fkey foreign key (a) references l1(a);
|
||||||
|
|
||||||
|
-- show that works fine
|
||||||
|
drop schema public cascade;
|
||||||
|
ROLLBACK;
|
||||||
|
|
||||||
CREATE EXTENSION citus;
|
CREATE EXTENSION citus;
|
||||||
-- this function is dropped in Citus10, added here for tests
|
-- this function is dropped in Citus10, added here for tests
|
||||||
CREATE OR REPLACE FUNCTION pg_catalog.master_create_worker_shards(table_name text, shard_count integer,
|
CREATE OR REPLACE FUNCTION pg_catalog.master_create_worker_shards(table_name text, shard_count integer,
|
||||||
|
|
Loading…
Reference in New Issue