Re: relpersistence and temp table

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Amit Khandekar <amit(dot)khandekar(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: relpersistence and temp table
Date: 2011-07-01 14:32:08
Message-ID: BANLkTin9iekQkZU0vqs3UaMzer85+2jtMg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 1, 2011 at 8:06 AM, Amit Khandekar
<amit(dot)khandekar(at)enterprisedb(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2011-07-01 15:23:03 Re: must synchronous_standby_names be set?
Previous Message Erik Rijkers 2011-07-01 13:42:39 must synchronous_standby_names be set?