我的SQL查询的WHERE子句中包含以下内容:

‘2023/10/21 14:46:32.805068000’+间隔‘1秒’

这会导致出现"INVALID INPUT SYNTAX FOR TYPE INTERVAL"错误.

有没有人有建议?

推荐答案

您需要具有时间戳数据类型才能进行计算.

SELECT '2023/10/21 14:46:32.805068000'::timestamp + interval '1 second'
<头> <正文>
?Column?
2023-10-21 14:46:33.805068
SELECT 1

fiddle

Postgresql相关问答推荐

PostgreSQL数据文件是否仅在判断点期间写入磁盘?

PostgreSQL:如何 for each 唯一的客户输入/更新列中的数据,并将其递增1直到表的末尾

如何在PostgreSQL中 Select 最近30天内的开始日期?

JPA将没有时区的Postgres时间戳调整为服务器时区

在 jOOQ 中 Select 相同的命名列

如何为基于复合类型的 Postgres DOMAIN 定义 CHECK 约束

是否可以在 postgresql 中添加表元数据?

如何在 PSQL 中查找从另一个表继承的子表

如何将 DELETE 的返回值插入到 postgresql 中的 INSERT 中?

PostgreSQL 提示:You will need to rewrite or cast the expression. column "state" is of type status but expression is of type character varying

在 PostgreSQL 中表示Sparse稀疏数据

try 为 ror 应用程序设置 postgres,出现错误 - fe_sendauth:no password supplied

PostgreSQL 中跨多个表的索引

使用 SQLAlchemy 进行 PostgreSQL ILIKE 查询

PostgreSQL 9 在 Windows 上安装:Unable to write inside TEMP environment path.

psql 将默认 statement_timeout 设置为 postgres 中的用户

pg_restore 目录错误

Heroku 上的 Postgres 并将单个表转储到转储文件

将postgres中的所有记录转换为Titlecase,首字母大写

Rails Migrations:试图将列的类型从字符串更改为整数