DBI 的 column_info 与带引号的标识符上的 pgAdmin
我的 Postgres 数据库中有一个表,其中包含名为“type”、“desc”和“start”的列。 当我调用 $dbh->column_info 时,只有“desc”返回被引用,而在 pgAdmin 中,所有三个都被引用。 其中之一是错误的吗?
I have a table in my Postgres database with columns named "type", "desc", and "start". When I call $dbh->column_info
, only "desc" comes back quoted, whereas in pgAdmin all three of them are quoted. Is one of them wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想我已经回答了我自己的问题,但我想我应该把它放在这里,以防有人有更多的见解。 保留列表显示“desc”是唯一的实际上是保留关键字(另外两个:“我们将解析器明确已知但允许作为列名或表名的那些关键字分类为“非保留”),所以我的猜测是 pgAdminIII 很谨慎并在案例“类型”和“开始”有一天会被保留。
I think I kind of answered my own question, but I thought I'd put it on here in case anyone has more insight. The reserve list shows "desc" is the only actually reserved keyword (the other two: 'we classify as "non-reserved" those key words that are explicitly known to the parser but are allowed as column or table names'), so my guess is that pgAdminIII is being cautious and quoting in case "type" and "start" become reserved some day.