PostgreSQL 对列的复杂更新操作
PostgreSQL complex update operation on column
我正在尝试更新具有 place_id 的每一行(fk),但是数据库说 select 的结果不止一行。当然它确实不止一行,因为我正在尝试更新列,而不仅仅是一条记录。
update Event set placeListingName =
(select substr(coalesce(epc.shortTitle, epc.title),1,100)
from Event e join e.place p join p.publicContent epc
where e.place is not null)
where place is not null
方括号中的表达式(select ... 其中 e.place 不为空)运行良好并且 returns 字符串列表
如果有人感兴趣:
update Event e set e.placeListingName =
(select substr(coalesce(epc.shortTitle, epc.title),1,100)
from Event ev join ev.place p join p.publicContent epc
where ev.id = e.id)
where e.place is not null
我正在尝试更新具有 place_id 的每一行(fk),但是数据库说 select 的结果不止一行。当然它确实不止一行,因为我正在尝试更新列,而不仅仅是一条记录。
update Event set placeListingName =
(select substr(coalesce(epc.shortTitle, epc.title),1,100)
from Event e join e.place p join p.publicContent epc
where e.place is not null)
where place is not null
方括号中的表达式(select ... 其中 e.place 不为空)运行良好并且 returns 字符串列表
如果有人感兴趣:
update Event e set e.placeListingName =
(select substr(coalesce(epc.shortTitle, epc.title),1,100)
from Event ev join ev.place p join p.publicContent epc
where ev.id = e.id)
where e.place is not null