Repository navigation
fix: ignore omitted filter variables on function collections - #664
Open
Indian-boult wants to merge 1 commit into
Open
Indian-boult wants to merge 1 commit into
Indian-boult wants to merge 1 commit into
Conversation
Functions that return `setof <table>` accept connection args such as `filter` and `orderBy` next to their own args. read_func_call_args converted all of them to JSON, but only the function's own args are passed to the SQL call. A filter that uses an omitted variable holds a nested Absent value, so the conversion failed with "Encountered `Absent` value while transforming between GraphQL intermediate object notation and JSON". Only convert args that map to a SQL function arg. The connection builder already reads filter and orderBy and skips absent values, the same as it does for table collections.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #617
Functions that return
setof <table>are exposed as collections and take the usual connection args likefilterandorderBy. When a filter used a variable that was left out ofvariables, table collections dropped that filter but function collections failed with "EncounteredAbsentvalue while transforming between GraphQL intermediate object notation and JSON".The error came from
read_func_call_args. It converted every field arg to JSON, including the connection args, even thoughFunctionCallBuilder::to_sqlonly passes args that map to a SQL function arg. The nestedAbsentinsidefiltermadegson_to_jsonfail. Now only args that map to a function arg are converted. The connection builder still readsfilterandorderByand skips absent values the same way it does for tables.The new
issue_617test runs the query from the issue against a table and a function. An omitted variable insideorderByon a function collection hit the same error and is now ignored too, which matches tables. Function args themselves behave as before.