Skip to content

Query filter for array of composite type #2875

Answered by wolfgangwalther
skuby2 asked this question in Q&A
Discussion options

You must be logged in to vote

While the computed relationship way would work as well, it's rather complicated. However, using a computed column, this can be done easily:

CREATE FUNCTION alias(table_person) RETURNS text[]
IMMUTABLE
LANGUAGE SQL AS $$
  SELECT array_agg(alias) FROM unnest($1.aliases);
$$;

and then

GET /table_person?alias=cs.{some alias to find}

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@wolfgangwalther
Comment options

@wolfgangwalther
Comment options

@wolfgangwalther
Comment options

Answer selected by wolfgangwalther
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants