From: | Eus <eus(at)member(dot)fsf(dot)org> |
---|---|
To: | Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> |
Cc: | Postgresql General Mailing List <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Can I use a query with UPDATE on its SET? |
Date: | 2009-02-26 10:15:49 |
Message-ID: | 293630.86295.qm@web37607.mail.mud.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi Ho!
--- On Thu, 2/26/09, Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2009-02-26 10:30:00 | Re: Format string for ISO-8601 date and time |
Previous Message | Grzegorz Jaśkiewicz | 2009-02-26 10:02:14 | Re: funny view/temp table problem with query |