【发布时间】:2022-08-11 02:17:43
【问题描述】:
我正在 postgres 中执行多值更新。但是,postgres 中的数据类型 DATE 给我带来了问题。我得到了以下代码来执行更新,但它给出了一个错误
update users as u set
id = u2.id,
appointment = u2.appointment
from (values
(1, \'2022-12-01\'),
(2, \'2022-12-01\')
) as u2(id, appointment)
where u2.id = u.id;
ERROR: column \"appointment\" is of type date but expression is of type text
LINE 3: appointment = u2.appointment
^
HINT: You will need to rewrite or cast the expression.
通常 postgres 接受这种格式的日期,我应该如何执行此更新?
标签: postgresql date types