简体   繁体   English

带有显式类型转换的 Postgres timezone_minute function

[英]Postgres timezone_minute function with explicit type casts

I have two columns, date and time , both strings.我有两列, datetime ,都是字符串。 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.

相关问题 使用熊猫的 Postgres 查询 - 添加显式类型转换 - Postgres query with pandas - add explicit type casts SQLAlchemy + Postgres:合并时“您可能需要添加显式类型强制转换” - SQLAlchemy + Postgres: “You might need to add explicit type casts” on merge 了解SQL中的显式类型转换 - Understanding explicit type casts in SQL Postgres 错误:没有过程匹配给定的名称和参数类型。 您可能需要添加显式类型转换 - Postgres error: No procedure matches the given name and argument types. You might need to add explicit type casts 没有函数匹配给定的名称和参数类型。 您可能需要添加显式类型转换 - Postgresql(IF 函数) - No function matches the given name and argument types. You might need to add explicit type casts - Postgresql (IF function) 您可能需要添加显式类型转换 - You might need to add explicit type casts SQLSTATE [42883]:未定义的函数,您可能需要添加显式类型强制转换 - SQLSTATE[42883]: Undefined function You might need to add explicit type casts PGSql 没有函数匹配给定的名称和参数类型。 您可能需要添加显式类型转换 - PGSql No function matches the given name and argument types. You might need to add explicit type casts 无法选择最佳候选函数。 您可能需要添加显式类型转换 - Could not choose a best candidate function. You might need to add explicit type casts plpgsql: No function 匹配给定的名称和参数类型。 您可能需要添加显式类型转换 - plpgsql: No function matches the given name and argument types. You might need to add explicit type casts
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM