Closed eulerto closed 1 year ago
I got similar issue with "could not open relation with OID" in a process which creates temporary tables during drop temp table. And this commit does not fix it.
context=context@entry=PROCESS_UTILITY_QUERY, params=params@entry=0x0, queryEnv=queryEnv@entry=0x0, completionTag=0x7ffe3bea2d00 "", dest=0x556441c05580 <spi_printtupDR>) at utility.c:1591
dest=0x556441c05580 <spi_printtupDR>, completionTag=0x7ffe3bea2d00 "") at utility.c:927
at pglogical_executor.c:287
fire_triggers=fire_triggers@entry=true, tcount=<optimized out>) at spi.c:2317
planstate=0x556443394090, estate=0x556443393e50) at execMain.c:1646
dest=dest@entry=0x556441bfcc40 <donothingDR>) at pquery.c:1672
queryEnv=0x0, dest=0x5564430af3f8, completionTag=0x7ffe3bea3cb0 "") at utility.c:518
---Type
altdest=altdest@entry=0x5564430af3f8, completionTag=completionTag@entry=0x7ffe3bea3cb0 "") at pquery.c:1328
altdest=altdest@entry=0x5564430af3f8, completionTag=0x7ffe3bea3cb0 "") at pquery.c:796
Could you provide a test case? Or explain what you mean by "creates temporary tables during drop temp table"?
Create two database connections:
1st connection
create extension pglogical;
select * from pglogical.create_node(
node_name := 'node1',
dsn := 'host=/tmp/ dbname=my_database'
);
select * from pglogical.create_replication_set(
set_name := 'test_set',
replicate_insert := true, replicate_update := true,
replicate_delete := true, replicate_truncate := true);
drop table if exists table_test;
create table table_test( value bigint primary key );
select * from pglogical.replication_set_add_table(
set_name := 'test_set', relation := 'table_test',
synchronize_data := true);
2nd connection:
create temporary table tt_test( test_value bigint );
insert into tt_test( test_value ) values ( 1 );
drop table if exists tt_test;
1st connection
drop extension pglogical;
create extension pglogical;
select * from pglogical.create_node(
node_name := 'node1',
dsn := 'host=/tmp/ dbname=my_database'
);
select * from pglogical.create_replication_set(
set_name := 'test_set',
replicate_insert := true, replicate_update := true,
replicate_delete := true, replicate_truncate := true);
drop table if exists table_test;
create table table_test( value bigint primary key );
select * from pglogical.replication_set_add_table(
set_name := 'test_set', relation := 'table_test',
synchronize_data := true);
2nd:
create temporary table tt_test( test_value bigint );
insert into tt_test( test_value ) values ( 1 );
drop table if exists tt_test; -- here got [XX000] ERROR: could not open relation with OID 140876
@eulerto probably caching of pglogical.depend is a bad idea
Workaround for those stuck on prior version with RDS: reboot server.
When you drop and create the pglogical extension after previously using a pglogical function, there could be some function call that will reference a pglogical.depend OID from the previous pglogical extension (before dropping the pglogical extension). See the test case in issue
Replace the static variable with a global variable and reset it after dropping the extension.
Fix issue #347