Can I use a query with UPDATE on its SET?

From: Eus <eus(at)member(dot)fsf(dot)org>
To: Postgresql General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Can I use a query with UPDATE on its SET?
Date: 2009-02-25 09:50:58
Message-ID: 444142.23217.qm@web37602.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Ho!

Since I can do:

INSERT INTO table (SELECT a_transaction.*);

I am wondering whether I can do:

UPDATE table SET (SELECT a_transaction.*) WHERE primary_key = (SELECT a_transaction.primary_key);

instead of:

DELETE FROM table WHERE primary_key = (SELECT a_transaction.primary_key);
INSERT INTO table (SELECT a_transaction.*);

Can I? I am using PostgreSQL 8.3.5. I get the feel that I cannot do so from reading the manual.

Thank you.

Best regards,
Eus (FSF member #4445)

In this digital era, where computing technology is pervasive, your freedom depends on the software controlling those computing devices.

Join free software movement today! It is free as in freedom, not as in free beer!

Join: http://www.fsf.org/jf?referrer=4445

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Grzegorz Jaśkiewicz 2009-02-25 10:02:21 funny view/temp table problem with query
Previous Message Thom Brown 2009-02-25 09:48:13 Re: Warm standby failover mechanism