Inconsistent handling of optional filter variables for `SETOF SQL` functions gives "Encountered Absent value" error
@olirice ci sta già lavorando.
Dal 12/12/2025.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
This is a cool project, appreciate the work gone into it. I ran into a small behavior that seems inconsistent, and I wanted to share a reproducible example to clarify what I observed.
Describe the bug
SQL functions that return SETOF <table> are exposed as GraphQL collections, making it possible to use the filter argument and more. However, the handling of optional filter variables is inconsistent compared to normal table collections:
- For normal table collections, omitted filter variables are silently ignored (filter clause removed).
- For function collections, if a filter variable is not provided (omitted from the GraphQL variables JSON), pg_graphql sometimes throws:
Encountered `Absent` value while transforming between GraphQL intermediate object notation and JSON
To Reproduce
Create dummy table and function:
create table dummy_table (
id serial primary key,
category text
);
create or replace function dummy_function ()
returns setof dummy_table as $$
select t.*
from dummy_table t
$$ stable language sql;
insert into dummy_table (category) values
('CAT A'),
('CAT B'),
('CAT C');
Query the table
- Try querying the new table collection with
variables: {}. It works fine.
{
dummy_tableCollection(filter: {category: {eq: $filter_category}}) {
edges {
node {
id
category
}
}
}
}
Query the function
- Try querying the new function now with
variables: {}. It produces the "Absent" error. - Try querying with
variables: { "filter_category": "CAT A" }, it works as expected doing the expected filtering.
{
dummy_function(filter: {category: {eq: $filter_category}}) {
edges {
node {
id
category
}
}
}
}
Expected behavior
Optional filter variables in function collections should behave like table collections:
- If the variable is omitted, the filter should be ignored rather than producing an Absent error.
Versions:
- PostgreSQL: 15
- pg_graphql version: 1.5.11
- Lingua principale
- Rust
- Stelle
- 3.4k
- Fork
- 142
- Merge medio
- 5h 26m
- PR unite (30g)
- 3
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di supabase/pg_graphql
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
supabase/pg_graphql#646 ·
-
service_role treated as anon, by GraphiQLForse già presa @olirice l’ha presa 173 giorni fa. Apertatriage-required
supabase/pg_graphql#642 · 1 assegnatario ·
-
`graphql.resolve` crashes backend process on invalid `BigInt` filter value (`signal 6`, Postgres enters recovery)Forse di nuovo libera @olirice l’ha presa 175 giorni fa e non c’è nessuna pull request aperta. Apertatriage-required
supabase/pg_graphql#641 · 1 commento · 1 assegnatario ·
-
specifiedByURL field on __Type is declared in the schema but not handled by the resolverForse di nuovo libera @olirice l’ha presa 190 giorni fa e non c’è nessuna pull request aperta. Apertatriage-required
supabase/pg_graphql#629 · 1 assegnatario ·
-
Documentation lists Aggregate, but feature not released in pg_graphqlForse di nuovo libera @olirice l’ha presa 431 giorni fa e non c’è nessuna pull request aperta. Apertaquestion
supabase/pg_graphql#602 · 12 commenti · 1 reazione · 1 assegnatario ·
Tutte le issue di supabase/pg_graphql
Issue simili
-
bug priority: low ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
storytold/gridcraft#3446 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
seabeectl verify exits 0 when verification failsForse già presa @theyottaboy l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
NationalSecurityAgency/seabee#73 ·
I maintainer di solito rispondono entro 4 giorni
-
ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
neilsh/stunt-reel#220 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno