-
-
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
Returning mimetypes via aggregates only works for select=* #3160
Comments
As a solution, we could apply the cast only when |
It's a bit messy but seems it could work.
I'm wondering if we should support different arguments at all. If we have: CREATE OR REPLACE FUNCTION twkb(anyelement) RETURNS "application/vnd.twkb" AS $$
select twkb_agg(x);
$$ LANGUAGE SQL IMMUTABLE; Then the user can do a So how about dropping specific aggregates? It'd be breaking but it would solve |
So if user does I believe only allowing |
No, this will not be possible without the cast we have right now. Otherwise the type passed into the function will be just some anonymous record type - and not the type of the endpoint. I think casting in presence of |
…are used Previously using a generic mimetype handler failed when any kind of select= was given, because we tried to cast the select-result to the original table type. With this change, this cast is only applied when select=* is given implicitly or explicitly. This is the only case where this makes sense, because this guarantees that correct columns are selected in the correct order for this cast to succeed. Resolves PostgREST#3160
…are used Previously using a generic mimetype handler failed when any kind of select= was given, because we tried to cast the select-result to the original table type. With this change, this cast is only applied when select=* is given implicitly or explicitly. This is the only case where this makes sense, because this guarantees that correct columns are selected in the correct order for this cast to succeed. Resolves PostgREST#3160
…are used Previously using a generic mimetype handler failed when any kind of select= was given, because we tried to cast the select-result to the original table type. With this change, this cast is only applied when select=* is given implicitly or explicitly. This is the only case where this makes sense, because this guarantees that correct columns are selected in the correct order for this cast to succeed. Resolves PostgREST#3160
…are used Previously using a generic mimetype handler failed when any kind of select= was given, because we tried to cast the select-result to the original table type. With this change, this cast is only applied when select=* is given implicitly or explicitly. This is the only case where this makes sense, because this guarantees that correct columns are selected in the correct order for this cast to succeed. Resolves PostgREST#3160
…are used Previously using a generic mimetype handler failed when any kind of select= was given, because we tried to cast the select-result to the original table type. With this change, this cast is only applied when select=* is given implicitly or explicitly. This is the only case where this makes sense, because this guarantees that correct columns are selected in the correct order for this cast to succeed. Resolves PostgREST#3160
…are used Previously using a generic mimetype handler failed when any kind of select= was given, because we tried to cast the select-result to the original table type. With this change, this cast is only applied when select=* is given implicitly or explicitly. This is the only case where this makes sense, because this guarantees that correct columns are selected in the correct order for this cast to succeed. Resolves PostgREST#3160
…are used Previously using a generic mimetype handler failed when any kind of select= was given, because we tried to cast the select-result to the original table type. With this change, this cast is only applied when select=* is given implicitly or explicitly. This is the only case where this makes sense, because this guarantees that correct columns are selected in the correct order for this cast to succeed. Resolves PostgREST#3160
…are used Previously using a generic mimetype handler failed when any kind of select= was given, because we tried to cast the select-result to the original table type. With this change, this cast is only applied when select=* is given implicitly or explicitly. This is the only case where this makes sense, because this guarantees that correct columns are selected in the correct order for this cast to succeed. Resolves #3160
Using the query from #2826 (comment) as an example:
The cast to
::"test"."lines"
makes it impossible to use anything else thanselect=*
.I see why the cast is implemented: This allows the aggregate function to be matched on the argument type for different endpoints. But it does not allow selecting only a subset of columns or computed columns.
In my case, I just tried to implement a generic CSV handler like this:
But this quickly fails, because I want to select different columns, or just in a different order - and then the cast fails.
The text was updated successfully, but these errors were encountered: