I have two tables:
"TABLE1"
"Id" integer,
"unit" varchar(255)
...
"TABLE2"
"Id" integer,
"Description" varchar(250)
...
TABLE1 is a descendant of TABLE2 - in Postgres parlance, it "inherits" from TABLE2.
TABLE2 has rows with a matching "Id" for every row in TABLE1. It also has many other descendants and there are many more rows in TABLE2 than in TABLE1.
For reasons not pertinent here, I need to copy the text from TABLE1."unit" into TABLE2."Description" for all rows where the Id column is the same.
The following query succeeds, but doesn't update any rows:
UPDATE ONLY public."TABLE2" as t2
SET ("Description") = (t1."unit"::regclass)
FROM "TABLE1" as t1
WHERE t1."Id" = t2."Id";
I tried the query without ONLY, but it failed with a "name" error.
Can someone please tell me what I'm doing wrong?