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

Поиск
Список
Период
Сортировка
От Eus
Тема Re: Can I use a query with UPDATE on its SET?
Дата
Msg-id 293630.86295.qm@web37607.mail.mud.yahoo.com
обсуждение исходный текст
Ответ на Re: Can I use a query with UPDATE on its SET?  (Craig Ringer <craig@postnewspapers.com.au>)
Ответы Re: Can I use a query with UPDATE on its SET?  (Sam Mason <sam@samason.me.uk>)
Список pgsql-general
Hi Ho!

--- On Thu, 2/26/09, Craig Ringer <craig@postnewspapers.com.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
sametypes 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
computingdevices. 

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

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




В списке pgsql-general по дате отправления:

Предыдущее
От: Grzegorz Jaśkiewicz
Дата:
Сообщение: Re: funny view/temp table problem with query
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: Format string for ISO-8601 date and time