oguimbal / pg-mem

An in memory postgres DB instance for your unit tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ALTER TYPE public

mirkadev opened this issue Β· comments

Describe the bug

Cannot alter type with public and without it actually as well

QueryFailedError: πŸ’” 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:

        ALTER TYPE "public"."qualification_rules_name_enum" RENAME TO "qualification_rules_name_enum_old";

    πŸ’€ Syntax error at line 1 col 12:

    1  ALTER TYPE "public"."qualification_rules_name_enum" RENAME TO "qualification_rules_name_enum_old";
                  ^
    Unexpected quoted_word token: "public". I did not expect any more input. Here is the state of my parse table:

        kw_index β†’ %word ● 
        kw_sequence β†’ %word ●

To Reproduce

CREATE TYPE "qualification_rules_name_enum" AS ENUM('1', '2', '3');

CREATE TABLE "qualification_rules" ("id" SERIAL NOT NULL, "column" character varying NOT NULL, "settings" jsonb DEFAULT '[]'::jsonb, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), "taxonomyId" integer);
ALTER TABLE "qualification_rules" ALTER COLUMN "column" TYPE qualification_rules_name_enum;

-- with public

ALTER TYPE public."qualification_rules_name_enum" RENAME TO "qualification_rules_name_enum_old"

-- and without

ALTER TYPE "qualification_rules_name_enum" RENAME TO "qualification_rules_name_enum_old"

pg-mem version

 cat ./node_modules/pg-mem/package.json | grep version
  "version": "2.6.12",
  "description": "A memory version of postgres",
    "release-deno": "git add -A && git commit -m \"Build deno [autogenerated commit]\" && PACKAGE_VERSION=$(cat package.json | grep \\\"version\\\" | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag $PACKAGE_VERSION && git push --tags",

This functionality would be awesome to have :),
Related bug in the parser oguimbal/pgsql-ast-parser#95