Re: CTEs and re-use

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: CTEs and re-use
Date: 2017-04-12 03:05:36
Message-ID: EBE13082-9D2F-4E9F-BA86-386B93D15FAA@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


> On Apr 11, 2017, at 8:47 PM, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> On Tuesday, April 11, 2017, Rob Sargent <robjsargent(at)gmail(dot)com> wrote:
>
> I’m really just bumping into the annoyance of manually dropping the temp table as I work this up (though real collision in production would is possible, it would be unlikely) and thought to try to rework the function without the temp table - that’s the SQL question - and presumed the specifics of the function would come in useful.
>
>
> I'm not positive what you are thinking here but the names of temporary tables are session-unique. They are not prone to concurrent use namespace collisions and not do not interfere with permanent tables either. They are placed into a temporary schema that is only visible to the current session.
>
> David J.
Of course ‘on commit drop’ works like a charm.
Thanks a ton.
rjs

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rosser Schwarz 2017-04-12 04:04:22 Re: CTEs and re-use
Previous Message Rob Sargent 2017-04-12 02:47:45 Re: CTEs and re-use