Re: Why isn't there a IF NOT EXISTS clause on constraint creation?

Поиск
Список
Период
Сортировка
От richard coleman
Тема Re: Why isn't there a IF NOT EXISTS clause on constraint creation?
Дата
Msg-id CAGA3vBstmD6NucJL47TmqaPFeX1jcgGvirYobcZPturjY2im9w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Why isn't there a IF NOT EXISTS clause on constraint creation?  (Luca Ferrari <fluca1978@gmail.com>)
Ответы Re: Why isn't there a IF NOT EXISTS clause on constraint creation?  (Luca Ferrari <fluca1978@gmail.com>)
Список pgsql-admin
Luca, 

Thanks, but I don't think you understand the scope of the matter.
The schema is just fine. When loading large amounts of data, some tables are greater than a terabyte in size, you typically don't have keys or indices until after it finishes as that slows things down.
I am not talking about two or three tables, but hundreds of tables.  It's a rather labor intensive option for want of a IF NOT EXISTS clause.
There's no panic here, just a puzzlement at why the devs would force users to have to recreate IF NOT EXITS functionality, either via PL/pgSQL anonymous blocks or custom wrapper functions, again and again and again for each user instead of offering that functionality.  It's not like it's a novel thing.  Many commands, seemingly at random, expose that functionality.

Seems like something that could be rectified once for all of PostgreSQL rather than forcing users to continually recreate this wheel.

that's all.
rik.

On Fri, Sep 1, 2023 at 7:14 AM Luca Ferrari <fluca1978@gmail.com> wrote:
On Thu, Aug 31, 2023 at 5:03 PM richard coleman
<rcoleman.ascentgl@gmail.com> wrote:
>
> Those that already have the index are skipped, those that are missing it get it created.  For the primary keys, there's no such option.

I don't see why such an option should exist for primary keys, since it
seems to me a problem of design within your schema.
At the moment, you have to manually check against primary keys, and
that should not be that hard.
In the future, a deployment tool like sqitch could help you get rid of
this kind of panic.


Luca

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

Предыдущее
От: Luca Ferrari
Дата:
Сообщение: Re: Autovacuum not running properly
Следующее
От: Geoff Winkless
Дата:
Сообщение: Re: Why isn't there a IF NOT EXISTS clause on constraint creation?