Bulk insert replies with bogus Location header
Sending a bulk post to /foo responds with 201 Created, Location: /foo?. It's incomplete. We could either
- Construct a clever Location header like
/foo?id.in=4,5,6,7that would return just the objects inserted. It's difficult because we may be dealing with a compound primary key or a table without a primary key. - Not return a Location header for bulk requests. The user can can use
Prefer: return=representationto learn about the inserted objects and even shape the results with aselectquery param.
By now, we're not getting a wrong location header in this case anymore, but just no location header at all.
It's difficult because we may be dealing with a compound primary key or a table without a primary key.
What we would really need to solve this properly would be some kind of ROW() constructor query. This would be good in general for queries that request multiple rows for a table with compound pk.
If we could do something like this:
GET /foo?(a,b,c)=in.((1,1,1),(2,2,2),(3,3,3))
then we could do that.
GET /foo?(a,b,c)=in.((1,1,1),(2,2,2),(3,3,3))
If we do that then we might able to clear https://github.com/PostgREST/postgrest/issues/1122 too. Like:
GET /foo?select=()
Would be an empty root select.
/foo?id.in=4,5,6,7
That syntax reminds me of https://github.com/PostgREST/postgrest/issues/2066, things would have been much easier if we had adopted it since the beginning.