oguimbal / pg-mem

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

`obj_description` added to `TypeORM` table comment support - causes error #380

Open coler-j opened 5 months ago

coler-j commented 5 months ago

Describe the bug

TypeORM which is a very popular ORM for Node recently added the following obj_description function call to support table comments in https://github.com/typeorm/typeorm/pull/10613 (typeOrm v0.3.20)

https://github.com/typeorm/typeorm/blob/83567f533482d0170c35e2f99e627962b8f99a08/src/driver/postgres/PostgresQueryRunner.ts#L3291

This will cause the following error during sync

QueryFailedError: ERROR: function obj_description(regclass,text) does not exist

Since TypeORM is a popular lib, it would be good to add support for obj_description or else many people will come here with the same issue.

To Reproduce


SELECT "table_schema", "table_name", obj_description(('"' || "table_schema" || '"."' || "table_name" || '"')::regclass, 'pg_class') AS table_comment FROM "information_schema"."tables" WHERE ("table_schema" = 'public' AND "table_name" = 'my_table') 

pg-mem version

2.8.1

anton-brass commented 5 months ago

Workaround till then for me:

 this.db.public.registerFunction({
            name: "obj_description",
            args: [DataType.text, DataType.text],
            returns: DataType.text,
            implementation: () => "test",
        });