Cannot recreate GTT if it was droped another user
ukolovda opened this issue · 3 comments
ukolovda commented
Hi!
Nice job, but I've got ERROR: duplicate key value violates unique constraint "pg_global_temp_tables_nspname_relname_key"
PostgreSQL 12, Fedora 33, installed from standard packages.
Steps to reproduce:
Connect as user mvno_db2
:
mvno_db2=> LOAD '$libdir/plugins/pgtt';
LOAD
mvno_db2=> create global temporary table t1 ( a integer );
WARNING: GLOBAL is deprecated in temporary table creation
LINE 1: create global temporary table t1 ( a integer );
^
CREATE TABLE
Make second connection as user postgres
, connect to the same database and drop table:
=# LOAD '$libdir/plugins/pgtt';
LOAD
mvno_db2=# drop table t1;
DROP TABLE
Switch back to session of mvno_db2
and try recreate GTT:
mvno_db2=> create global temporary table t1 ( a integer );
WARNING: GLOBAL is deprecated in temporary table creation
LINE 1: create global temporary table t1 ( a integer );
^
ERROR: duplicate key value violates unique constraint "pg_global_temp_tables_nspname_relname_key"
DETAIL: Key (nspname, relname)=(pgtt_schema, t1) already exists.
CONTEXT: SQL statement "INSERT INTO pgtt_schema.pg_global_temp_tables VALUES (630344, 'pgtt_schema', 't1', 't', ' a integer ')"
ukolovda commented