Re: SQL99 IGNORE

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: SQL99 IGNORE
Дата
Msg-id 1076823979.23097.8.camel@jeff
обсуждение исходный текст
Ответ на Re: SQL99 IGNORE  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Ответы Re: SQL99 IGNORE  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
> > I notice that postgres does not support IGNORE.
> >
> > I am currently migrating an app from a MySQL datastore to Postgres, and I
> > would really like to use IGNORE.
> >
> > I am curious if there is a recommended work-araound.
>
> What does it do? All I find in SQL99 Part 2 related to the word is that
> it's reserved.
>

If you insert from one table into another via a subselect, there's the
possibility that you may violate a unique contraint, simply because many
rows are being inserted at once.

The IGNORE keyword tells MySQL to simply ignore the duplicates if they
exist, not throw an error, and continue inserting the distinct, new
records.

Of course, there are much more logical ways of avoiding that problem,
like simply using a NOT IN on the subquery, or a NOT EXISTS, or maybe
even rethink the schema.

So, it surprises me that IGNORE is part of the spec, if it is. I don't
think I've ever run into a problem where something like this would fit.

Regards,
    Jeff




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

Предыдущее
От: ljb
Дата:
Сообщение: Re: Wire protocol v3 details
Следующее
От: "nednieuws | charles"
Дата:
Сообщение: Re: Freelance postgresql related jobs