relpersistence and temp table

From: Amit Khandekar <amit(dot)khandekar(at)enterprisedb(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: relpersistence and temp table
Date: 2011-07-01 12:06:20
Message-ID: BANLkTimOZRwJdPV538GgePAGp=+cD9Y60g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In 9.1, if a table is created using an explicit pg_temp qualification,
the pg_class.relpersistence is marked 'p', not 't'.

postgres=# CREATE TABLE pg_temp.temptable (i int4);
CREATE TABLE

postgres=# select relpersistence from pg_class where relname = 'temptable';
relpersistence
----------------
p
(1 row)

BUt the table does go away if I exit the session:

postgres=# \q
edb-pg ~/git-pg1 $ psql
psql (9.0.1, server 9.2devel)
WARNING: psql version 9.0, server version 9.2.
Some psql features might not work.
Type "help" for help.

postgres=# select relpersistence from pg_class where relname = 'temptable';
relpersistence
----------------
(0 rows)

So in that sense, it does work as a temp table, but the relpersistence
is not 't'. So, is the "temp"ness no longer identified by
pg_class.relpersistence now?

In RelationBuildLocalRelation(), previously, namespace was used to
determine if the table should be marked temporary:

/* it is temporary if and only if it is in my temp-table namespace */
rel->rd_istemp = isTempOrToastNamespace(relnamespace);

But in Master branch, now if I look at RelationBuildLocalRelation(),
there is no such logic to mark relpersistence.

Was this intentional or is it a bug?

Regards
-Amit Khandekar

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Erik Rijkers 2011-07-01 13:42:39 must synchronous_standby_names be set?
Previous Message Mikko Partio 2011-07-01 11:00:35 Re: PANIC while doing failover (streaming replication)