Re: temp table same name real table - Mailing list pgsql-general

From Michael Lewis
Subject Re: temp table same name real table
Date
Msg-id CAHOFxGrLCS9S4Ds0eaH5m_NOmEDxpNjwGz=TzB96034riy+ihA@mail.gmail.com
Whole thread Raw
In response to temp table same name real table  ("v.brusa@joinsnc.com" <v.brusa@joinsnc.com>)
Responses Re: temp table same name real table  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general


On Wed, Sep 30, 2020, 7:27 AM v.brusa@joinsnc.com <v.brusa@joinsnc.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.

pgsql-general by date:

Previous
From: Matthias Apitz
Date:
Subject: Re: Problem close curser after rollback
Next
From: Devrim Gündüz
Date:
Subject: Re: Yum repository RPM behind release