[英]Postgres timezone_minute function with explicit type casts
I have two columns, date
and time
, both strings.我有两列,
date
和time
,都是字符串。 I can concatenate them to get a column timestamp
.我可以将它们连接起来以获得列
timestamp
。
I need to use the timezone_minute()
function † .我需要使用
timezone_minute()
function † 。 I have tried various formats for the parameter, but have repeatedly faced the error我尝试了各种格式的参数,但多次遇到错误
Query 1 ERROR: ERROR: function timezone_minute(timestamp without time zone) does not exist
LINE 1: select timezone_minute('2023-01-25T05:36:48Z'::date AT TIME ...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
For example例如
-- function timezone_minute(timestamp without time zone) does not exist
select timezone_minute('2023-01-25T05:36:48Z'::date AT TIME ZONE 'UTC');
-- function timezone_minute(timestamp with time zone) does not exist
select timezone_minute('2023-01-25T05:36:48Z'::date AT TIME ZONE 'UTC');
select timezone_minute('2023-01-25T05:36:48Z'::timestamptz);
select timezone_minute(cast('2023-01-25T05:36:48Z' as TIMESTAMP));
-- etc
How do I correctly utilise timezone_minute - the documentation is severely lacking for this particular function, unfortunately.我如何正确使用 timezone_minute - 不幸的是,这个特定的 function 严重缺乏文档。
† I don't fully control the final query, hence the need to use this function. The generated query utilises timezone_minute(), I can essentially set the argument. †我不能完全控制最终查询,因此需要使用这个 function。生成的查询使用 timezone_minute(),我基本上可以设置参数。
the documentation is severely lacking for this particular function, unfortunately.
不幸的是,严重缺乏这个特定的 function 的文档。
Yes, because it's not a function.是的,因为它不是 function。
It is an argument to the extract()
function :它是
extract()
function的参数:
select extract(timezone_minute from '2023-01-25T05:36:48Z'::timestamptz);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.