Re: SQL99 IGNORE - Mailing list pgsql-general

From Jeff Davis
Subject Re: SQL99 IGNORE
Date
Msg-id 1076823979.23097.8.camel@jeff
Whole thread Raw
In response to Re: SQL99 IGNORE  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Responses Re: SQL99 IGNORE
List 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 by date:

Previous
From: ljb
Date:
Subject: Re: Wire protocol v3 details
Next
From: "nednieuws | charles"
Date:
Subject: Re: Freelance postgresql related jobs