Re: SQL99 IGNORE

From: Jeff Davis <jdavis-pgsql(at)empires(dot)org>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: SQL99 IGNORE
Date: 2004-02-15 05:46:20
Message-ID: 1076823979.23097.8.camel@jeff
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message nednieuws | charles 2004-02-15 08:48:13 Re: Freelance postgresql related jobs
Previous Message ljb 2004-02-15 01:57:51 Re: Wire protocol v3 details