graphile-contrib/postgraphile-plugin-connection-filter

Support for views

jmsegrev opened this issue · 4 comments

I could not have filtering for views. I had to wrap a query to the view with a function that had a custom return type for it to work.

CREATE FUNCTION public.filter_table_view()
    RETURNS TABLE (
	 id integer, 
	 code character varying(50),
	 name character varying(100),
	 description text,
	 color character varying(20),
	 created_at timestamp with time zone,
    ) AS $$
        SELECT * FROM public.table_view
$$ LANGUAGE SQL STABLE;

I was looking at the tests related code and noticed that there were no views in the sql schema used. I'm assuming that its not supported yet. I'm curious about why this is the case, what are the current limitations?

@jmsegrev This worked for me in PostGraphileOptions:

    ignoreIndexes: true,
    graphileBuildOptions : {
        connectionFilterRelations: true
    }

Apologies for the reeeeally slow response time. 😅

@jmsegrev Views should be filterable. Were you able to get it working?

@mattbretl I have moved on from the project that required this feature. I'll take your word and assume it's already supported.

@mattbretl, can I add filters on view columns that aren't relations, such as a date column? Cross-post: https://discord.com/channels/489127045289476126/498852330754801666/931723651231907900