(Describe your issue here).
We're adding some raw SQL to our application because our ORM doesn't support recursive queries, and want to use pg-mem to test the code. However, it seems not to work as expected.
π Your query failed to parse.
This is most likely due to a SQL syntax error. However, you might also have hit a bug, or an unimplemented feature of pg-mem.
If this is the case, please file an issue at https://github.com/oguimbal/pg-mem along with a query that reproduces this syntax error.
π Failed query:
CREATE TABLE "tree" ("name" text NOT NULL, "parentName" text);
INSERT INTO "tree"("name", "parentName") VALUES ('a', DEFAULT);
INSERT INTO "tree"("name", "parentName") VALUES ('b', 'a');
with recursive rec as (
select "name", "parentName" 0 as level from "tree" where name = 'b' union all
select "tree"."name", "tree"."parentName", rec.level - 1 as level from "tree" join rec on rec."parentName" = "tree".name
) select * from rec;
π Syntax error at line 6 col 20:
with recursive rec as
^
Unexpected kw_as token: "as". Instead, I was expecting to see one of the following:
- A "lparen" token
To Reproduce
CREATE TABLE "tree" ("name" text NOT NULL, "parentName" text);
INSERT INTO "tree"("name", "parentName") VALUES ('a', DEFAULT);
INSERT INTO "tree"("name", "parentName") VALUES ('b', 'a');
with recursive rec as (
select "name", "parentName" 0 as level from "tree" where name = 'b' union all
select "tree"."name", "tree"."parentName", rec.level - 1 as level from "tree" join rec on rec."parentName" = "tree".name
) select * from rec
Describe the bug
(Describe your issue here). We're adding some raw SQL to our application because our ORM doesn't support recursive queries, and want to use pg-mem to test the code. However, it seems not to work as expected.
To Reproduce
pg-mem version
2.6.12