diff --git a/src/functions/system.ts b/src/functions/system.ts index 2508183..04fefcf 100644 --- a/src/functions/system.ts +++ b/src/functions/system.ts @@ -8,4 +8,10 @@ export const systemFunctions: FunctionDefinition[] = [ returns: Types.text(), implementation: () => 'public', }, + { + name: 'obj_description', + args: [Types.regclass, Types.text()], + returns: Types.null, + implementation: () => null + }, ] diff --git a/src/tests/simple-queries.spec.ts b/src/tests/simple-queries.spec.ts index 9a889e1..84902e9 100644 --- a/src/tests/simple-queries.spec.ts +++ b/src/tests/simple-queries.spec.ts @@ -246,6 +246,19 @@ describe('Simple queries', () => { }); + it('can select obj_description', () => { + simpleDb(); + const query = ` + SELECT obj_description( + ('"' || "table_schema" || '"."' || "table_name" || '"')::regclass, + 'pg_class' + ) AS table_comment + FROM "information_schema"."tables" + WHERE ("table_schema" = 'public' AND "table_name" = 'data')`; + expect(many(query)).toEqual([{ table_comment: null }]); + }); + + it('can select info tables', () => { simpleDb(); expect(many('select table_name from information_schema.tables')).toEqual([{ table_name: 'data' }]);