Drop only temporary table - Mailing list pgsql-general

From Durumdara
Subject Drop only temporary table
Date
Msg-id CAEcMXhkGbRKGOQ=24AbXebNuf2h+A_Y9nWu+16eQ4F2XGK3_7Q@mail.gmail.com
Whole thread Raw
Responses Re: Drop only temporary table
Re: Drop only temporary table
Re: Drop only temporary table
List pgsql-general
Dear PG Masters!

As I experienced I can create normal and temp table with same name.

create table x (kod integer);

CREATE TEMPORARY TABLE x (kod integer);

select tablename from pg_tables where schemaname='public'
 union all
select c.relname from pg_class c
join pg_namespace n on n.oid=c.relnamespace
where  
n.nspname like 'pg_temp%'
and c.relkind = 'r'
and pg_table_is_visible(c.oid);

---

I can see two x tables.

As I see that drop table stmt don't have "temporary" suboption to determine which to need to eliminate - the real or the temporary.

Same thing would happen with other DDL/DML stmts - what is the destination table - the real or the temporary?

"insert into x(kod) values(1)"

So what do you think about this problem?

I want to avoid to remove any real table on resource closing (= dropping of temporary table).
How to I force "drop only temporary"? Prefix, option, etc.

Thanks for your help!

dd

pgsql-general by date:

Previous
From: Jan de Visser
Date:
Subject: Re: Crypt change in 9.4.5
Next
From: Tom Lane
Date:
Subject: Re: Drop only temporary table