UPDATE table_name SET col_name = varchar WHERE col_name is NULL;

雨燕双飞 提交于 2021-02-05 09:29:19

问题


The following UPDATE fails :-

UPDATE table_name SET col_name = varchar WHERE col_name is NULL;

The failure message is :-

ERROR:  column "varchar" does not exist

Whereas the undermentioned one succeeds :-

UPDATE table_name SET col_name = 889977 WHERE col_name is NULL;

I have checked the pg_typeof of the column - col_name is character varying. Kindly help.


回答1:


i think you missed quote for string

UPDATE table_name SET col_name = 'varchar' WHERE col_name is NULL;


来源:https://stackoverflow.com/questions/55677689/update-table-name-set-col-name-varchar-where-col-name-is-null

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!