Re: temp table same name real table

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: v(dot)brusa(at)joinsnc(dot)com
Cc: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: temp table same name real table
Date: 2020-09-30 14:34:48
Message-ID: CAHOFxGrLCS9S4Ds0eaH5m_NOmEDxpNjwGz=TzB96034riy+ihA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Sep 30, 2020, 7:27 AM v(dot)brusa(at)joinsnc(dot)com <v(dot)brusa(at)joinsnc(dot)com>
wrote:

>
> Hi all,
> I have this strange behavior when I use temp table with same name of a
> permanent table in a function.
>

IMO, you are asking for strange behavior when you overload a table name.

I expect that one of the people who work down deep down in the code will
say it is a caching thing that saves system table lookups. It also may be
required to ensure consistent behavior when you use the same table name
(non specified schema) then you should always get the same table.

Still, it might be simple to use exceptions and try to read the pg_temp
table and if it does not exist, try the public schema.

Or, just schema qualify the fetch call with a string that is computed for
which schema you want to use.

>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Devrim Gündüz 2020-09-30 14:39:51 Re: Yum repository RPM behind release
Previous Message Matthias Apitz 2020-09-30 14:14:59 Re: Problem close curser after rollback