Re: [SQL] CTEs and re-use

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: [SQL] CTEs and re-use
Дата
Msg-id CAKFQuwaaCewCWEL0ojyzjgS7db09hATgT77SZquoF1CzPSC3bg@mail.gmail.com
обсуждение исходный текст
Ответ на [SQL] CTEs and re-use  (Rob Sargent <robjsargent@gmail.com>)
Список pgsql-sql
On Tue, Apr 11, 2017 at 5:41 PM, Rob Sargent <robjsargent@gmail.com> wrote:
The gripe is that the function puts the results of the CTE/select into a temp table for the follow-on query.  That mean I have a name collision and have to drop the temp table.
​[...]​

What am I missing here in building the fence and losing the neighbours?

​Best guess:​

​​CREATE TEMP TABLE ... ON COMMIT DROP AS

or

DROP TABLE IF EXISTS​ ..

You show a lot of detail in the function but its not useful.  Given the stated problem your queries or "SELECT '1'::text" both will exhibit the same behavior.  What you don't show or describe, however, is how and when the function is called.

​David J.

В списке pgsql-sql по дате отправления:

Предыдущее
От: Rob Sargent
Дата:
Сообщение: [SQL] CTEs and re-use
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: [SQL] CTEs and re-use