postgresql 错误:类型timestamp的输入语法无效

rhfm7lfc  于 2023-06-22  发布在  PostgreSQL
关注(0)|答案(1)|浏览(1036)

当我将表从一个数据库迁移到另一个数据库表时遇到问题。我使用PostgreSQL数据库。
问题:

SQL error:

ERROR:  invalid input syntax for type timestamp: "31:57.7"
LINE 2:      VALUES ('52','GUIDO Layouts','','f','47','31:57.7','34:...

In statement:

INSERT INTO "public"."projects" ("id","name","description","public","parent_id","created_at","updated_at","identifier","lft","rgt","templated","active")
                    VALUES ('52','GUIDO Layouts','','f','47','31:57.7','34:31.5','guido-layouts','81','82','f','t')

我检查了两个表结构是否相同。这两个列(create_at)使用***timestamp不带时区***,我尝试使用now()
请帮帮我

gupuwyp2

gupuwyp21#

timestamp是一个datetime,所以你需要一个日期组件来使它与timestamp字段一起工作。您可以将其用作time,因此:
'31:57.7'::time 00:31:57.7
你有两个选择:
1.如果您想坚持使用just time,请将列类型更改为time
1.保留timestamp类型,并将值更改为timestamp(datetime)。

相关问题