Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostgreSQL with recursive fail with union in the final query #2050

Closed
ohadpinch opened this issue Aug 1, 2019 · 4 comments · Fixed by #3317
Closed

PostgreSQL with recursive fail with union in the final query #2050

ohadpinch opened this issue Aug 1, 2019 · 4 comments · Fixed by #3317

Comments

@ohadpinch
Copy link

with recursive CHILDREN(UUID, PARENT_UUID) as
(
	(select GROUPING.GROUP_NODE.UUID, 
	 GROUPING.GROUP_NODE.PARENT_UUID
	 
	 from GROUPING.GROUP_NODE where GROUPING.GROUP_NODE.UUID = '1')

 union 
	(select op.UUID, op.PARENT_UUID
	 	 from GROUPING.GROUP_NODE as op join CHILDREN as c on op.PARENT_UUID = c.uuid)
)
(select * from CHILDREN )
union 
(select mn.UUID, mn.PARENT_UUID
 from GROUPING.MEMBER_NODE as mn, CHILDREN as c2 
 where (mn.parent_uuid = c2.uuid))

If we remove the parentheses ( ) from the "(select * from CHILDREN )" line it will WORK!

@grandinj
Copy link
Contributor

grandinj commented Aug 1, 2019

Can we get a full standalone test case i.e. what are the table definitions

@ohadpinch
Copy link
Author

ohadpinch commented Aug 1, 2019

CREATE TABLE grouping.group_node (
uuid VARCHAR(255) NOT NULL,
name VARCHAR(255) NOT NULL,
parent_uuid VARCHAR(255),
PRIMARY KEY(uuid)
);

CREATE TABLE grouping.member_node (
uuid VARCHAR(255) NOT NULL,
parent_uuid VARCHAR(255),
PRIMARY KEY(uuid)
);

CREATE UNIQUE INDEX idx_group_node_uuid ON grouping.group_node (uuid);
CREATE INDEX idx_group_node_parent_uuid ON grouping.group_node (parent_uuid);

@katzyn
Copy link
Contributor

katzyn commented Aug 1, 2019

It looks like a duplicate of #918.

@ohadpinch
Copy link
Author

Ok,
I am not sure, but I can check when it will be resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants