Open clkao opened 11 years ago
Multiple result sets support is still a TODO.
However, you can use ngx_echo module's echo_location or echo_subrequest directives to do the combinations yourself:
Thanks @agentzh! I gave it a quick try, it seems postgres_pass can't be used with echo_location, so i have to create a wrapper route that contains two echo_location to the to routes for doing bootstrap and the actual query.
I then use postgres_output none
for the first location so only the second one is rendered. however it seems I now get a response where the body is flushed before the http headers.
@clkao echo_location should work with ngx_postgres but you need separate locations because you're doing Nginx subrequests here. For a single location, you cannot enable two Nginx module's content handlers at the same time, that is, you cannot use echo_location and proxy_pass in a single location.
It seems there's no such hook in ngx_postgres to allow custom queries to be sent upon upstream connection establishment.
I am trying out ngx_postgres with pgrest (http://github.com/clkao/pgrest). However for each connection, we need to call a postgresql function via select, something like: SELECT pgrest_boot('{...bootstrap_json}').
I also tried calling the bootstrap function along with other queries mapped from GET requests, but ngx_postgres is not handling multiple queries very well.