oguimbal / pg-mem

An in memory postgres DB instance for your unit tests
MIT License
1.89k stars 94 forks source link

Cannot SELECT when a column includes schema name #396

Open davidfiala opened 3 months ago

davidfiala commented 3 months ago

Describe the bug

When selecting on columns and you happen to specify the schema name as part of the column, an error is reported.

Same applies to:

🔨 Not supported 🔨 : The query you ran generated an AST which parts have not been read by the query planner. This means that those parts could be ignored:
    ⇨ .columns[0].expr.table.name ("foo")
👉 pg-mem is work-in-progress, and it would seem that you've hit one of its limits.
*️⃣ Reconsituted failed SQL statement: SELECT myschema.foo .apple  FROM myschema.foo
👉 You can file an issue at https://github.com/oguimbal/pg-mem along with a way to reproduce this error (if you can), and  the stacktrace:

To Reproduce


CREATE SCHEMA myschema;
CREATE TABLE "myschema"."foo" (apple integer);
INSERT INTO "myschema"."foo" (apple) values (10);
SELECT * FROM "myschema"."foo"; -- success
SELECT "foo"."apple" FROM "myschema"."foo"; -- success
SELECT "myschema"."foo"."apple" FROM "myschema"."foo"; -- fails

ditto if you use the default public schema:

CREATE TABLE "foo" (apple integer);
INSERT INTO "foo" (apple) values (10);
SELECT * FROM "foo"; -- success
SELECT "foo"."apple" FROM "public"."foo"; -- success
SELECT "public"."foo"."apple" FROM "public"."foo"; -- fails

-- ditto for WHERE "public"."foo"."apple" =
-- or INNER JOIN .... ON "public"."foo"."apple" = ....

pg-mem version

2.8.1