Re: mysql replace in postgreSQL?

From: David Fetter <david(at)fetter(dot)org>
To: blackwater dev <blackwaterdev(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: mysql replace in postgreSQL?
Date: 2005-10-30 14:29:41
Message-ID: 20051030142941.GA1744@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Oct 28, 2005 at 09:57:03PM -0400, blackwater dev wrote:
> In MySQL, I can use the replace statement which either updates the
> data there or inserts it. Is there a comporable syntax to use in
> postgreSQL?

Not really, but here's an example which doesn't have the brokenness of
MySQL's REPLACE INTO and doesn't have the race conditions that some
others' proposals have.

http://developer.postgresql.org/docs/postgres/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING

Of course, it's not as nice and flexible as the SQL standard MERGE,
but until that day comes, you can use that example.

HTH :)

Cheers,
D
--
David Fetter david(at)fetter(dot)org http://fetter.org/
phone: +1 510 893 6100 mobile: +1 415 235 3778

Remember to vote!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John Sidney-Woollett 2005-10-30 14:44:42 Re: Please HELP - URGENT - transaction wraparound error
Previous Message Martijn van Oosterhout 2005-10-30 13:56:31 Re: Please HELP - URGENT - transaction wraparound error