PostgreSQL “Column does not exist” but it actually does

倾然丶 夕夏残阳落幕 提交于 2019-11-26 15:28:40

Try to take it into double quotes - like "Continent" in the query:

SELECT "Continent"
FROM network.countries
...

In working with SQLAlchemy environment, i have got this error with the SQL like this,

   db.session.execute(
    text('SELECT name,type,ST_Area(geom) FROM buildings WHERE type == "plaza" '))

ERROR: column "plaza" does not exist

Well, i changed == by = , Error still persists, then i interchanged the quotes, like follows. It worked. Weird!

.... 
text("SELECT name,type,ST_Area(geom) FROM buildings WHERE type = 'plaza' "))
Kaori

This problem occurs because in pgAdmin3 because the table name is not tablename instead it is "tablename". for eg. If it shows user as table name, than table name is "user".

See this:

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