Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

endpoint: support SETOF RECORD functions #237

Open
erichanson opened this issue Jan 16, 2021 · 0 comments
Open

endpoint: support SETOF RECORD functions #237

erichanson opened this issue Jan 16, 2021 · 0 comments

Comments

@erichanson
Copy link
Member

PostgreSQL functions that return RECORD and SETOF RECORD are very handy because they can return results with variable structures, unlike most PostgreSQL functions which must always return results with the same column/columns. For example if we wanted to create a function bundle.row_at_commit(meta.row_id, commit_id), if its return type was SETOF RECORD it could any row at any particular commit. The caveat though is that when you call a function that returns SETOF RECORD, you have to also include the structure of the expected result.

We can support these with endpoint, but would need to add an additional parameter that specifies the expected table structure.. Design and implement. Generally, functions and the result sets they return need an audit. We probably want to follow a pattern similar to how we do with relations, aka methods that return row (zero or one rows as JSON), rows (zero or more rows as JSON), field (the literal value returned, as the configured mimetype). There is a whole matrix of how these would map to all the different types of PostgreSQL result types, as well as all the different datum.js types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant