zero-length delimited identifier at or near """"的解決辦法(zero-length delimited...)


當程序中向postgresql或postgis中插入或者更新數據時,出現如下的錯誤:
org.postgresql.util.PSQLException: ERROR: zero-length delimited identifier at or near """"

...zero-length delimited

 

報錯原因是:在一些數據庫中,雙引號“”可以用來標示字符串String,但是在Postgres數據庫中,雙引號只能用來引用標示符(Double quotes are used only to quote an "identifier", i.e., the name of a table, column, view, etc. ),例如用來引用表名、列名等。所以,當你的語句里用雙引號來標引String時,Postgre解析器以為你在引用一個標示符“identifier”(表名或者列名),但是卻發現雙引號里面沒有對應的“標示符”,因此會報這個錯誤。


解決辦法:在Postgres查詢時,對於String你只能用單引號或者&來標識。In a Postgres query, you should always use single quotes or "dollar quotes" (see http://www.postgresql.org/docs/8.1/interactive/sql-syntax.html#SQL-SYNTAX-DOLLAR-QUOTING) for string literals.

 

 

參考:https://blog.csdn.net/gis1226/article/details/8894312


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM