Pap*_*abs 1 database postgresql-9.1
我的 postgres 数据库的表中有字段“限制”。我运行 psql 并且我无法选择、更新、更改此字段,因为它是 postgresql 中的保留字。有没有办法管理这个领域?
serene-retreat::SILVER=> select limit from companies;
ERROR: syntax error at or near "limit"
LINE 1: select limit from companies;
Run Code Online (Sandbox Code Playgroud)
在 SQL 中保留(关键字)字需要使用双引号引起来:
select "limit"
from companies;
Run Code Online (Sandbox Code Playgroud)
请注意,这也使列区分大小写:"LIMIT"与"limit".
这一切都在手册中解释:http :
//www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS