小编Chr*_*ong的帖子

Postgres 将字符串“now”奇怪地转换为时间戳

看起来 postgres 将字符串'now()'视为对函数的调用now()

为什么 postgres 允许这样做?

select 'now'::timestamp;
Run Code Online (Sandbox Code Playgroud)

或这个?

select 'now()'::timestamp;
Run Code Online (Sandbox Code Playgroud)

甚至这个?

select '  (  (  ))) now)('::timestamp;
Run Code Online (Sandbox Code Playgroud)

它不会对其他函数(例如clock_timestamp().

数据库小提琴

postgresql datatypes timestamp cast

4
推荐指数
1
解决办法
279
查看次数

标签 统计

cast ×1

datatypes ×1

postgresql ×1

timestamp ×1