Re: relpersistence and temp table - Mailing list pgsql-hackers

From Robert Haas
Subject Re: relpersistence and temp table
Date
Msg-id BANLkTin9iekQkZU0vqs3UaMzer85+2jtMg@mail.gmail.com
Whole thread Raw
In response to relpersistence and temp table  (Amit Khandekar <amit.khandekar@enterprisedb.com>)
Responses Re: relpersistence and temp table
List pgsql-hackers
On Fri, Jul 1, 2011 at 8:06 AM, Amit Khandekar
<amit.khandekar@enterprisedb.com> wrote:
> 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?

That's a bug.  Thanks for the report.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: "Erik Rijkers"
Date:
Subject: must synchronous_standby_names be set?
Next
From: Simon Riggs
Date:
Subject: Re: must synchronous_standby_names be set?