Make it possible to registerFunction for a version of `generate_series`
marcus13371337 opened this issue · comments
Consider the following query:
SELECT * FROM generate_series(1, 5)
generate_series
-----------------
1
2
3
4
5
(5 rows)
I'm having a hard time registering a function that could handle this scenario. What I've tried:
db.public.registerFunction({
name: "generate_series",
args: [DataType.integer, DataType.integer],
returns: DataType.integer, // Should be typed to array somehow I guess?
implementation: (from: any, to: any) => {
const start = parseInt(from);
const stop = parseInt(to);
const result = [];
for (let i = start; i <= stop; i++) {
result.push(i);
}
return result;
},
});
Is this possible already? Or are there any missing functionalities in the library to get this to work?
This would be a really nice feature, I need this as well