postgresql - postgres error: column doesn't exist error in Postgesql 11.6
问题描述
I am trying to run an update command on postgresql 11.6 by below syntax
update "YP_SUPPLIERS" set "YP_SUPPLIERS.supplierName" = "update" where "YP_SUPPLIERS.supplierID" = da68e9d0-1100-43e2-0011-db8fbe654321;
I am getting this below error
ERROR: column "YP_SUPPLIERS.supplierID" does not exist
LINE 1: ... set "YP_SUPPLIERS.supplierName" = "update" where "YP_SUPPLI...
tired different combinations by only giving the column name , removing the quotes but nothing seems to be working.
Could any one suggest me a right way to do it.
解决方案
You need to quote each element separately, and the table does not need to be repeated for the target column. String constants need to be enclosed in single quotes ('
) in SQL. Double quotes are only for identifiers.
update "YP_SUPPLIERS"
set "supplierName" = 'update' --<< single quotes for constant values
-- ^ no table name here
where "YP_SUPPLIERS"."supplierID" = 'da68e9d0-1100-43e2-0011-db8fbe654321';
-- ^ schema and table name must be quoted separately
推荐阅读
- azure-devops - How can I send dynamic parameters to template in Azure Devops Yaml?
- tf-idf - How to know if your TF-IDF calculation is correct?
- python - Imblearn balanced_batch_generator - can't run my CNN model
- function - Why are annotations in higher-order functions unsupported?
- flutter - Can't make Stack of Widgets clickable after exporting Widget from Adobe XD
- api - React Native 错误 - TypeError: undefined is not an object (evalating 'item.key')
- mysql - How to get SQL COUNT to include results of zero?
- python - 覆盖类属性但不覆盖子类中的方法
- python - 无法在 Jupyter 中导入张量流
- c++ - 如何将 Windows ProductType 转换为名称?