oguimbal / pg-mem

An in memory postgres DB instance for your unit tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot SELECT when a column includes schema name

davidfiala opened this issue Β· comments

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:

  • SELECT columns
  • WHERE clause
  • JOIN clause
πŸ”¨ 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