I have a problem with ltree extension on Postgresql 9.6.5
I have a table called category with the following DDL (I simplified it a bit):
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
);
After creation of ltree extension:
CREATE EXTENSION ltree;
I'm trying to make some query e.g.:
SELECT id, text2ltree(name) FROM dictionary.category;
or
SELECT id, name::ltree FROM dictionary.category;
or escaping column name
SELECT id, text2ltree("name") FROM dictionary.category;
And it gives me:
ERROR: syntax error at position 12
all the time
But when I try:
SELECT id, text2ltree('a.b.v') FROM dictionary.category;
or
SELECT id, text2ltree(id::text) FROM dictionary.category
it gives me correct results.
I suppose it is related to the fact that name is a reserved keyword. But why escaping do not work? Also I trie to rename a column to something like abcd it gives me syntax error anyway.
Thanks everyone in advance!