我正在尝试使用临时表更新表。
Schema | Name | Type | Owner
------------+----------------------+----------+----------
pg_temp_11 | tmp_x | table | postgres
public | entities | table | postgres
但是我收到了这个错误:
UPDATE entities SET "Name" = "tmp_x.Name" FROM tmp_x WHERE "entities.Ent_ID" = "tmp_x.Ent_ID";
ERROR: column "tmp_x.Name" does not exist -- the column Name exists
LINE 1: UPDATE entities SET "Name" = "tmp_x.Name" FROM tmp_x WHERE "...
有什么问题?表格列周围的引号?
答案 0 :(得分:5)
您使用双引号包围多个单独的对象。如果您使用的是对象分隔符(双引号),则需要在每个项目上,而不是整个组合:
UPDATE entities SET "Name" = "tmp_x"."Name" FROM tmp_x WHERE "entities"."Ent_ID" = "tmp_x"."Ent_ID";