在jsonb中存储时间戳时,我意识到将current\u timestamp和now()放入jsonb时使用的格式不同于我直接使用它们时使用的格式.这是怎么回事?虽然两者都是ISO8601格式,但我更希望它们都使用相同的格式.为什么会有两种不同的违约?
select version(); select now(); select current_timestamp; select jsonb_build_object('timestamptz', current_timestamp); select jsonb_build_object('timestamptz', now());
| version | | :----------------------------------------------------------------------------------------------------- | | PostgreSQL 12.9 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4), 64-bit | | now | | :---------------------------- | | 2022-07-14 14:13:42.696612+01 | | current_timestamp | | :---------------------------- | | 2022-07-14 14:13:42.696612+01 | | jsonb_build_object | | :-------------------------------------------------- | | {"timestamptz": "2022-07-14T14:13:42.696612+01:00"} | | jsonb_build_object | | :-------------------------------------------------- | | {"timestamptz": "2022-07-14T14:13:42.696612+01:00"} |
db<>fiddle 100