Search Postgresql Archives

Re: Can I use a query with UPDATE on its SET?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ho!

--- On Thu, 2/26/09, Craig Ringer <craig@xxxxxxxxxxxxxxxxxxxxx> wrote:

> Eus wrote:
> > 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);
> 
> UPDATE table SET fieldname = (SELECT ..) WHERE primary_key
> = (SELECT...)

Is it possible to eliminate the use of `fieldname' completely?
So, I just need to type `UPDATE table SET (SELECT ...) WHERE primary_key'.

I think this should be possible because if the subquery in the SET clause returns the same number of columns with the same types of those of the destination table, PostgreSQL should be able to just update the values at once.

Thanks.

> --
> Craig Ringer

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


      

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux