Postgres 是否有系统 table 列出 date_trunc 的精度值?

Does Postgres have a system table listing precision values for date_trunc?

在此处找到 date_truc 的有效参数列表:

https://www.postgresql.org/docs/10/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC

microseconds
milliseconds
second
minute
hour
day
week
month
quarter
year
decade
century
millennium

,是否发现他们在某处的系统 table 中监听?如果有,在哪里?

支持的标记为 hard-coded and exposed only through a lookup function,因此无法检索整个列表。

完整列表比文档建议的要长很多,例如只需几毫秒,所有这些都有效:

select
  date_trunc('ms', now()),
  date_trunc('msec', now()),
  date_trunc('msecs', now()),
  date_trunc('msecond', now()),
  date_trunc('mseconds', now()),
  date_trunc('millisecond', now()),
  date_trunc('milliseconds', now())

事实上,只存储了令牌的第一个 10 characters,所以这也有效:

select date_trunc('milliseconzzzzzzzzzzzzzzzzzzzzzzzzzz', now())