supabase/postgres-meta

Typings for functions returning setof <table>

jsbrain opened this issue · 4 comments

Feature request

Is your feature request related to a problem? Please describe.

Currently, functions returning setof <table> aren't properly typed, e.g. returns unknown.

Describe the solution you'd like

I noticed that /functions endpoint already resolves the return_type properly to <table-name> so I'm not sure if this is actually a bug or just not implemented yet. As the tables types will already be generated anyways I imagine it should be "easy" to copy them over?

I wonder if this might be intentional, but I can't think of any reason why it would be. However, I don't want to rule out the possibility that I'm missing something here, and I'm curious about your opinion.

Describe alternatives you've considered

Manually casting the type.

Awesome!

@soedirgo does the cli actually use the postgres-meta endpoint so this will automatically land in cli type generation as well or does it need additional implementation?

For --local we need to bump the version here. For --project-id we need to update the version internally - I'll loop back here once we do (prob early next week).

Update: this should be out now on the platform and on the CLI :)

Amazing, thanks for the update!