PostgreSQL - ERROR:column“date”不能转换为类型日期 [英] PostgreSQL - ERROR: column "date" cannot be cast to type date
本文介绍了PostgreSQL - ERROR:column“date”不能转换为类型日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将PostgreSQL数据库中的特定列从character_varying类型转换为类型date。
phpPgAdmin给我以下错误:
I want to cast a specific column in my PostgreSQL database from character_varying type to type date. phpPgAdmin gives me the following error:
错误:列date不能转换为
类型date
ERROR: column "date" cannot be cast to type date
在语句:ALTER TABLE
public。tablenameALTER COLUMN
dateTYPE date
In Statement: ALTER TABLE "public"."tablename" ALTER COLUMN "date" TYPE date
我该怎么办?
感谢
What should I do ? Thanks
推荐答案
您可能需要先将其转换为文字:
You might need to convert it to text first:
alter table "foo" alter column "date" type date using ("date"::text::date);
这篇关于PostgreSQL - ERROR:column“date”不能转换为类型日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文