8000 fix: return `interval` as string · f-elix/postgres-meta@288baa2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 288baa2

Browse files
committed
fix: return interval as string
1 parent f39902d commit 288baa2

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/lib/db.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pg.types.setTypeParser(pg.types.builtins.INT8, (x) => {
1212
}
1313
})
1414
pg.types.setTypeParser(pg.types.builtins.DATE, (x) => x)
15+
pg.types.setTypeParser(pg.types.builtins.INTERVAL, (x) => x)
1516
pg.types.setTypeParser(pg.types.builtins.TIMESTAMP, (x) => x)
1617
pg.types.setTypeParser(pg.types.builtins.TIMESTAMPTZ, (x) => x)
1718
pg.types.setTypeParser(1115, parseArray) // _timestamp

test/server/query.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,3 +539,21 @@ test('very big number', async () => {
539539
]
540540
`)
541541
})
542+
543+
// issue: https://github.com/supabase/supabase/issues/27626
544+
test('return interval as string', async () => {
545+
const res = await app.inject({
546+
method: 'POST',
547+
path: '/query',
548+
payload: {
549+
query: `SELECT '1 day 1 hour 45 minutes'::interval`,
550+
},
551+
})
552+
expect(res.json()).toMatchInlineSnapshot(`
553+
[
554+
{
555+
"interval": "1 day 01:45:00",
556+
},
557+
]
558+
`)
559+
})

0 commit comments

Comments
 (0)
0