diff --git a/src/lib/db.ts b/src/lib/db.ts index b17a013e..464c7410 100644 --- a/src/lib/db.ts +++ b/src/lib/db.ts @@ -12,6 +12,7 @@ pg.types.setTypeParser(pg.types.builtins.INT8, (x) => { } }) pg.types.setTypeParser(pg.types.builtins.DATE, (x) => x) +pg.types.setTypeParser(pg.types.builtins.INTERVAL, (x) => x) pg.types.setTypeParser(pg.types.builtins.TIMESTAMP, (x) => x) pg.types.setTypeParser(pg.types.builtins.TIMESTAMPTZ, (x) => x) pg.types.setTypeParser(1115, parseArray) // _timestamp diff --git a/test/server/query.ts b/test/server/query.ts index 04ba102a..26b01f80 100644 --- a/test/server/query.ts +++ b/test/server/query.ts @@ -539,3 +539,21 @@ test('very big number', async () => { ] `) }) + +// issue: https://github.com/supabase/supabase/issues/27626 +test('return interval as string', async () => { + const res = await app.inject({ + method: 'POST', + path: '/query', + payload: { + query: `SELECT '1 day 1 hour 45 minutes'::interval`, + }, + }) + expect(res.json()).toMatchInlineSnapshot(` + [ + { + "interval": "1 day 01:45:00", + }, + ] + `) +})