quirk with update a from b

From: "Mike G(dot)" <mike(at)thegodshalls(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: quirk with update a from b
Date: 2006-03-22 20:56:06
Message-ID: 20060322205606.GA1839@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

CREATE TABLE aa
(
a_col1 text
);

CREATE TABLE bb
(
b_col1 text
);

This update works:
UPDATE bb
SET b_col1 = aa.a_col1
FROM aa
WHERE bb.b_col1 <> aa.a_col1;

This does not:
UPDATE bb
SET bb.b_col1 = aa.a_col1
FROM aa
WHERE bb.b_col1 <> aa.a_col1;

Error: column "bb" of relation "bb" does not exist.

postgres 8.1.2

Maybe in a future version the alias can be allowed? Perhaps someone wanted to avoid updating the wrong column on accident and put this in as a safety net?

Mike

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tony Caduto 2006-03-22 21:03:13 Re: question about the admin contrib module and binary
Previous Message Guy Fraser 2006-03-22 20:55:22 Re: Advantages of PostgreSQL over MySQL 5.0