Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql 在postgres的ltree type列中插入Uuid_Postgresql - Fatal编程技术网

Postgresql 在postgres的ltree type列中插入Uuid

Postgresql 在postgres的ltree type列中插入Uuid,postgresql,Postgresql,我有一张下表 CREATE TABLE ProductCode_Timeline ( "Uuid" uuid, "Descriptions" text, "Hierarchy" ltree, ) 在上表的“层次结构”列中,我想添加uuid作为路径引用。 像这样的东西 INSERT INTO ProductCode_Timeline (Uuid, Descriptions, Hierarchy) VALUES ( '3a037b24-a7d8-11e6-894d-a4d

我有一张下表

CREATE TABLE ProductCode_Timeline
(
    "Uuid" uuid,
    "Descriptions" text,
    "Hierarchy" ltree,

)
在上表的“层次结构”列中,我想添加
uuid
作为路径引用。 像这样的东西

INSERT INTO ProductCode_Timeline (Uuid, Descriptions, Hierarchy) VALUES ( '3a037b24-a7d8-11e6-894d-a4db30217df5', "Test", '');

INSERT INTO ProductCode_Timeline (Uuid, Descriptions, Hierarchy) VALUES ( '4a037b24-a7d8-11e6-894d-a4db30217df5', "Test1", '3a037b24-a7d8-11e6-894d-a4db30217df5');

INSERT INTO ProductCode_Timeline (Uuid, Descriptions, Hierarchy) VALUES ( '5a037b24-a7d8-11e6-894d-a4db30217df5', "Test2", '3a037b24-a7d8-11e6-894d-a4db30217df5.4a037b24-a7d8-11e6-894d-a4db30217df5');
尝试在层次结构路径中添加
uuid
时,我遇到了错误的语法错误(如上面的示例所示)

如何在层次结构路径中添加Uuid?在研究生中如何处理这种情况


提前感谢。

标签是一系列字母数字字符和下划线(例如,在C语言环境中,允许使用字符A-Za-z0-9)。标签长度必须小于256字节。谢谢你,波兹。我已将uuid中的-替换为u,它正在正确插入。但现在我尝试使用where子句获取它,它类似于where层次结构,我认为您可能会在
“Research”
模式下安装
ltree
模块,并且在查询时,该模式不在
搜索路径中。使用f.ex将其放入
搜索路径
<代码>将搜索路径设置为“MyOtherSchema”、“Research”
或使用显式模式语法:
层次结构运算符(“Research”)。附带说明:为什么不为层次结构使用
父id
?PostgreSQL支持。感谢pozs的评论。它确实帮助我解决了问题。标签是字母数字字符和下划线的序列(例如,在C语言环境中,允许使用字符A-Za-z0-9).标签的长度必须小于256字节。感谢pozs。我已将uuid中的-替换为uu,它正在正确插入。但现在我尝试使用where子句获取它,它类似于where层次结构,我认为您可能会在
的“研究”下安装
ltree
模块
schema,在查询时,该schema不在
search\u路径中
。使用f.ex将其放入
search\u路径中。
将search\u路径设置为“MyOtherSchema”、“Research”;
或使用显式架构语法:
层次运算符(“Research”)。另请注意:为什么不在层次结构中使用
parent\u id
?PostgreSQL支持。感谢pozs的评论。它确实帮助我解决了问题。