Re: Truncate if exists

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Truncate if exists
Дата
Msg-id CA+TgmoYBwfg6HhHXZYg3h0oVSNOv5Q+ccjL2_4v4PZ9bGvb=Kg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Truncate if exists  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
Ответы Re: Truncate if exists
Список pgsql-hackers
On Mon, Oct 15, 2012 at 3:14 PM, Dimitri Fontaine
<dimitri@2ndquadrant.fr> wrote:
> What about continuing to extend on that incredibly useful WITH syntax we
> already have:
>
>    WITH target AS (
>       SELECT oid::regclass AS t
>         FROM pg_class c JOIN pg_namespace n ON c.relnamespace = n.oid
>        WHERE pg_table_is_visible(oid)
>          AND nspname = 'public' AND NOT relname ~ 'exclude-pattern'
>    )
>    TRUNCATE TABLE t FROM target;

I'm not exactly sure what that is supposed to do, but it doesn't seem
like an easy-to-use substitute for truncate-if-exists...

>> my view the goal ought to be to refine that mechanism to remove the
>> clunkiness and awkwardness, rather than to invent something completely
>> new.
>
> So, what do you think? Smells like empowered SQL this time, right?

I like the idea of making our SQL dialect capable of working with DDL
in more powerful ways; I'm not sold on the concrete proposal.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Deprecating RULES
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Deprecating RULES