missing FROM-clause entry

Lists: pgsql-general
From: "Brandon Metcalf" <bmetcalf(at)nortel(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: missing FROM-clause entry
Date: 2006-10-23 22:35:53
Message-ID: Pine.LNX.4.58L.0610231732310.1695@cash.us.nortel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Just upgraded to 8.1.5 and the following UPDATE causes the "missing
FROM-clause entry" error:

UPDATE model_timemap
SET map = updatemap( CASE WHEN replica = 32188 THEN 328787 WHEN replica = 32191 THEN 5739 ELSE -1 END, 1161642129, map)
WHERE replica.replica_id = model_timemap.replica AND replica.proxy = 32189

From what I've read, this typically results from referring to a table
instead of it's alias, but I don't see how that applies here.

--
Brandon


From: "Thomas H(dot)" <me(at)alternize(dot)com>
To: "Brandon Metcalf" <bmetcalf(at)nortel(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: missing FROM-clause entry
Date: 2006-10-23 22:40:18
Message-ID: 042001c6f6f4$3802ab70$0201a8c0@iwing
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

you didn't reference the table "replica"... this should work:
UPDATE model_timemap
SET map = updatemap( CASE WHEN replica = 32188 THEN 328787 WHEN replica =
32191 THEN 5739 ELSE -1 END, 1161642129, map)

FROM replica

WHERE replica.replica_id = model_timemap.replica AND replica.proxy = 32189

----- Original Message -----
From: "Brandon Metcalf" <bmetcalf(at)nortel(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Sent: Tuesday, October 24, 2006 12:35 AM
Subject: [GENERAL] missing FROM-clause entry

> Just upgraded to 8.1.5 and the following UPDATE causes the "missing
> FROM-clause entry" error:
>
> UPDATE model_timemap
> SET map = updatemap( CASE WHEN replica = 32188 THEN 328787 WHEN
> replica = 32191 THEN 5739 ELSE -1 END, 1161642129, map)
> WHERE replica.replica_id = model_timemap.replica AND replica.proxy =
> 32189
>
> From what I've read, this typically results from referring to a table
> instead of it's alias, but I don't see how that applies here.
>
> --
> Brandon
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org/
>


From: "Brandon Metcalf" <bmetcalf(at)nortel(dot)com>
To: "Thomas H(dot)" <me(at)alternize(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: missing FROM-clause entry
Date: 2006-10-23 22:43:37
Message-ID: Pine.LNX.4.58L.0610231743150.1695@cash.us.nortel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

m == me(at)alternize(dot)com writes:

m> you didn't reference the table "replica"... this should work:
m> UPDATE model_timemap
m> SET map = updatemap( CASE WHEN replica = 32188 THEN 328787 WHEN replica =
m> 32191 THEN 5739 ELSE -1 END, 1161642129, map)

m> FROM replica

m> WHERE replica.replica_id = model_timemap.replica AND replica.proxy = 32189

Ah. Thanks.

--
Brandon