oguimbal / pg-mem

An in memory postgres DB instance for your unit tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

failed to run against the data type decimal with precision and scale

adamwan-nexplore opened this issue · comments

Describe the bug

When running with decimal as the data type. pg-mem failed to set up the schema.

To Reproduce

console.log
    query: CREATE TABLE "test_record" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying NOT NULL, "testNumber" numeric(18,2), CONSTRAINT "PK_78ddda202d30c6ccbb2b528a0ac" PRIMARY KEY ("id"))

      at Function.logInfo (platform/PlatformTools.ts:229:17)

  console.log
    query failed: CREATE TABLE "test_record" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying NOT NULL, "testNumber" numeric(18,2), CONSTRAINT "PK_78ddda202d30c6ccbb2b528a0ac" PRIMARY KEY ("id"))

      at Function.logError (platform/PlatformTools.ts:233:17)

  console.log
    error: NotSupported [Error]: 🔨 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[2].dataType.config ([18,2])
    
    👉 pg-mem is work-in-progress, and it would seem that you've hit one of its limits.
    
    *️⃣ Failed SQL statement: CREATE TABLE "test_record" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying NOT NULL, "testNumber" numeric(18,2), CONSTRAINT "PK_78ddda202d30c6ccbb2b528a0ac" PRIMARY KEY ("id"));

pg-mem version

2.6.4

hi, this should be fixed in pg-mem@2.6.7

BEWARE, HOWEVER: pg-mem does not handle decimal precision (yet), meaning that your column testNumber will behave as a regular js number, and its precision will not be truncated.