-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Regression when arrow filtering a composite column in a function that returns TABLE or SETOF composite_type #2929
Labels
Comments
2 tasks
steve-chavez
changed the title
Regression when filtering a composite column in a function that returns TABLE or SETOF composite_type
Regression when arrow filtering a composite column in a function that returns TABLE or SETOF composite_type
Sep 8, 2023
Looks it's caused by #2859 -- old version query
WITH pgrst_source AS (SELECT "pgrst_call".* FROM "test"."returns_type"() pgrst_call)
SELECT
null::bigint AS total_result_set,
pg_catalog.count(_postgrest_t) AS page_total,
coalesce(json_agg(_postgrest_t), '[]') AS body,
nullif(current_setting('response.headers', true), '') AS response_headers,
nullif(current_setting('response.status', true), '') AS response_status
FROM (SELECT "record".* FROM "pgrst_source" AS "record" WHERE to_jsonb("record"."val")->>$1 = $2 ) _postgrest_t;
-- new version query
ERROR: operator does not exist: type_x ->> unknown at character 446
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
STATEMENT:
WITH pgrst_source AS (SELECT "pgrst_call".* FROM "test"."returns_type"() pgrst_call)
SELECT
null::bigint AS total_result_set,
pg_catalog.count(_postgrest_t) AS page_total,
coalesce(json_agg(_postgrest_t), '[]') AS body,
nullif(current_setting('response.headers', true), '') AS response_headers,
nullif(current_setting('response.status', true), '') AS response_status
FROM (SELECT "record".* FROM "pgrst_source" AS "record" WHERE "record"."val"->>$1 = $2 ) _postgrest_t; The |
This does work on a table though: create table table_c (
id int
, val type_x
); $ curl "http://localhost:3000/table_c?val->>id=eq.1"
[] Looks like the main issue is that for RPC, the type of the filter is not searched here: postgrest/src/PostgREST/Plan.hs Lines 260 to 263 in 290d906
It was mentioned that RPC was not supported here #2523 (comment) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
Description of issue
If the function
RETURNS TABLE
that has a composite type or aSETOF <composite_type>
directly, then filtering on that type will return an error. Version11.1.0
handles the filter correctly while11.2.0
does not. (Based on this issue: supabase/postgrest-js#475)Steps to reproduce:
Then this request will err in v11.2.0:
While in v11.1.0, it works:
The text was updated successfully, but these errors were encountered: