Skip to content

Commit

Permalink
logictest: extent temp_table test to exercise discard + drop
Browse files Browse the repository at this point in the history
We had bugs with this in earlier releases. This is a forward-port of a test
introduced in #96102.

It never failed master, but no reason to ever let this regress.

Epic: none

Release note: None
  • Loading branch information
ajwerner committed Jan 27, 2023
1 parent b23943c commit 6619d90
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/temp_table
Original file line number Diff line number Diff line change
Expand Up @@ -356,4 +356,44 @@ to_drop.pg_temp.testuser_tmp
to_drop.pg_temp.tempuser_view
to_drop.pg_temp.root_temp

subtest create_after_discard_and_drop_database

statement ok
ALTER ROLE testuser WITH CREATEDB;

user testuser

statement ok
CREATE DATABASE to_drop

statement ok
USE to_drop

statement ok
CREATE TEMPORARY TABLE t (i INT PRIMARY KEY);

statement ok
SELECT * FROM pg_temp.t

statement ok
DISCARD TEMP

statement error pgcode 42P01 relation "pg_temp.t" does not exist
SELECT * FROM pg_temp.t

statement ok
USE defaultdb;
DROP DATABASE to_drop CASCADE;

statement ok
CREATE DATABASE to_drop

statement ok
CREATE TEMPORARY TABLE t (i INT PRIMARY KEY);

statement ok
SELECT * FROM pg_temp.t

statement ok
USE defaultdb;
DROP DATABASE to_drop CASCADE;

0 comments on commit 6619d90

Please sign in to comment.