0
我有PostgreSQL的ltree扩展9.6.5语法错误在查询9.6.5
我有一个名为具有以下DDL类别表(我简化了一点)一个问题:
CREATE TABLE dictionary.category
(
id serial not null constraint category_pkey primary key,
name text not null,
parent_id integer constraint category_parent_id_fkey references dictionary.category
);
创作ltree延长后:
CREATE EXTENSION ltree;
我试图做一些查询例如:
SELECT id, text2ltree(name) FROM dictionary.category;
或
SELECT id, name::ltree FROM dictionary.category;
或逃避列名
SELECT id, text2ltree("name") FROM dictionary.category;
,这让我:
ERROR: syntax error at position 12
所有的时间
但是当我尝试:
SELECT id, text2ltree('a.b.v') FROM dictionary.category;
或
SELECT id, text2ltree(id::text) FROM dictionary.category
它给了我正确的结果。
我想这与名称是保留关键字有关。但为什么逃避不起作用?此外,我特此重命名一个列像abcd它无论如何给我语法错误。
谢谢大家提前!