Re: PG Version 8.1 - Mailing list pgsql-admin

From John Barham
Subject Re: PG Version 8.1
Date
Msg-id 4f34febc0511220240p77b1bc7ctd7635464bfca8311@mail.gmail.com
Whole thread Raw
In response to PG Version 8.1  (Diego <diego@unimedijui.com.br>)
List pgsql-admin
On 11/22/05, Diego <diego@unimedijui.com.br> wrote:
> Hi, i use pg version 8.0 and i have this case:
>
> UPDATE tbpeople
> SET dt_update = '11/22/2005'
> WHERE tbdoctor.id_people = tbpeople.id
>
> But now, in version 8.1, this instrution give me an error:
> [ERROR:  missing FROM-clause entry for table "tbdoctor"]
>
> Who can i do now to get the same result?

Try:

UPDATE tbpeople
SET dt_update = '11/22/2005'
FROM tbdoctor
WHERE tbdoctor.id_people = tbpeople.id

or:

UPDATE tbpeople
SET dt_update = '11/22/2005'
WHERE id IN (SELECT id_people FROM tbdoctor)

Note that the FROM clause in UPDATE is a PG extension.

  John

> Thanks...
> Diego Ziquinatti

pgsql-admin by date:

Previous
From: Diego
Date:
Subject: PG Version 8.1
Next
From: Alvaro Herrera
Date:
Subject: Re: Max no of commands per transaction