oguimbal / pg-mem

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

drop [materialized] view not supported? #345

Open vincenzoturco opened 1 year ago

vincenzoturco commented 1 year ago

Describe the bug

CREATE TABLE "user"
("id" SERIAL NOT NULL, "name" text NOT NULL, CONSTRAINT "PK_cace4a159ff9f2512dd42373760" PRIMARY KEY ("id"));

CREATE MATERIALIZED VIEW test_view AS SELECT * from "user";

-- this will fail (Unexpected word token: "view")
Drop MATERIALIZED view test_view ;
-- this will also fail (Unexpected word token: "test_view ")
Drop view test_view ;
  errors from VS Code tests:
  Unexpected word token: "test_view". I did not expect any more input. Here is the state of my parse table:

        kw_index → %word ●
        kw_trigger → %word ●
        kw_type → %word ●
        kw_sequence → %word ●
        kw_function → %word ●

      at PostgresQueryRunner.query (driver/postgres/PostgresQueryRunner.ts:299:19)
      at AlterTranslationSystem1690206158952.up (persistence/migration/changelog/1690206158952-alterTranslationSystem.ts:24:5)
      at MigrationExecutor.executePendingMigrations (migration/MigrationExecutor.ts:336:17)
      at DataSource.runMigrations (data-source/DataSource.ts:397:13)
      at Object.<anonymous> (importProgress/importProgress.service.spec.ts:93:5)

To Reproduce

CREATE TABLE "user"
("id" SERIAL NOT NULL, "name" text NOT NULL, CONSTRAINT "PK_cace4a159ff9f2512dd42373760" PRIMARY KEY ("id"));

CREATE MATERIALIZED VIEW test_view AS SELECT * from "user";

-- this will fail (Unexpected word token: "view")
Drop MATERIALIZED view test_view ;

pg-mem version

2.6.13