… we should have defined rds_rough_col_type_t as a type rather than a global variable. thanks @姜大炮.
This is second part of the "write proper SQL queries" campaign. Queries that return more than one value will result in "500 Internal Server Error" response.
This is more general approach, which forces writing proper SQL queries instead of filtering results on the nginx side and allows for sending output from multiple rows to end-users. Discussed with Silly Sad.
Based on patch from Silly Sad.
Because ngx_http_upstream_finalize_request sends NGX_HTTP_LAST, having last_buf=1 in our module meant that last two chains always had last_buf=1, which resulted in duplicated last chunk sent for HTTP/1.1 requests. This pretty much killed keep-alived requests. Reported by Silly Sad, diagnosed by Maxim Dounin. Same issue was independently diagnosed and fixed in ngx_drizzle by Yichun Zhang (agentzh) few days ago.
…art from most of the ngx_log_error calls in ngx_postgres_keepalive.c because they are duplicate with the << upstream: "postgres://ip.add.re.ss:port" >> part automatically generated by the ngx_http_log_error_handler function in the nginx core.
…d "sockaddr" fields instead of passing pointers around.
…, "sockaddr", and "socklen" fields for the connection from the pool such that we can get more detailed error log messages with the "upstream: postgres://ip.add.re.ss:port" bit.
I've just tested each case and there is no such bug in ngx_postgres, each error.log entry contains correct upstream peer name. I'll re-add "pc->name = &peer->name;" in case nginx or 3rd-party modules will ever use it, but "pc->name" isn't used by ngx_postgres. This reverts commit 8126a4f.
r->upstream->peer.name in the get_peer function which caused error messages lacking upstream peer names and ports.