Skip to content

Properly Support RETURNS TABLE (T) (returning a table with 1 field)#1164

Merged
eeeebbbbrrrr merged 1 commit intodevelopfrom
return-1-field-table
Jun 8, 2023
Merged

Properly Support RETURNS TABLE (T) (returning a table with 1 field)#1164
eeeebbbbrrrr merged 1 commit intodevelopfrom
return-1-field-table

Conversation

@eeeebbbbrrrr
Copy link
Contributor

Postgres treats a SRF that returns a 1-field table as if it is a RETURNS SETOF T, so we need to do that too.

This adds a standalone function in the srf example, and a few tests that ensure this also works when returning it wrapped in Result or Option (or both!)

Postgres treats a SRF that returns a 1-field table as if it is a
`RETURNS SETOF T`, so we need to do that too.

This adds a standalone function in the `srf` example, and a few tests
that ensure this also works when returning it wrapped in `Result` or
`Option` (or both!)
Copy link
Contributor

@thomcc thomcc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine, this code continues to be gnarly as hell, but that's how it is I suppose.

@eeeebbbbrrrr
Copy link
Contributor Author

Seems fine, this code continues to be gnarly as hell, but that's how it is I suppose.

Yeah. It's pretty much at the point where some considered design needs to happen before we start overloading it with more functionality.

@eeeebbbbrrrr eeeebbbbrrrr merged commit 5a45b3a into develop Jun 8, 2023
@eeeebbbbrrrr eeeebbbbrrrr deleted the return-1-field-table branch June 20, 2023 18:00
usamoi pushed a commit to tensorchord/pgrx that referenced this pull request Mar 6, 2025
…pgcentralfoundation#1164)

Postgres treats a SRF that returns a 1-field table as if it is a
`RETURNS SETOF T`, so we need to do that too.

This adds a standalone function in the `srf` example, and a few tests
that ensure this also works when returning it wrapped in `Result` or
`Option` (or both!)
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

Successfully merging this pull request may close these issues.

3 participants