Closed cryptofuture closed 7 years ago
@cryptofuture Patches welcome :)
@cryptofuture The value of ngx_module_name
variable in your config
is wrong. Should be something like ngx_postgres_module
instead to be consistent with the definition in the C code base. Maybe we should change it to ngx_http_postgres_module
to be consistent with other nginx http C modules further. @PiotrSikora ?
Thanks, will try build tomorrow. ngx_http_postgres_module makes more sense.
Tried build today as dynamic, now undefined symbol: PQsendQuery
from ngx_http_postgres_processor.c source:
ngx_postgres_upstream_send_query(ngx_http_request_t *r, ngx_connection_t *pgxc,
ngx_postgres_upstream_peer_data_t *pgdt)
{
ngx_postgres_loc_conf_t *pglcf;
ngx_int_t pgrc;
u_char *query;
dd("entering");
pglcf = ngx_http_get_module_loc_conf(r, ngx_postgres_module);
query = ngx_pnalloc(r->pool, pgdt->query.len + 1);
if (query == NULL) {
dd("returning NGX_ERROR");
return NGX_ERROR;
}
(void) ngx_cpystrn(query, pgdt->query.data, pgdt->query.len + 1);
dd("sending query: %s", query);
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pgxc->log, 0,
"postgres: sending query: \"%s\"", query);
if (pglcf->output_binary) {
pgrc = PQsendQueryParams(pgdt->pgconn, (const char *) query,
0, NULL, NULL, NULL, NULL, /* binary */ 1);
} else {
pgrc = PQsendQuery(pgdt->pgconn, (const char *) query);
}
if (pgrc == 0) {
dd("sending query failed");
ngx_log_error(NGX_LOG_ERR, pgxc->log, 0,
"postgres: sending query failed: %s",
PQerrorMessage(pgdt->pgconn));
dd("returning NGX_ERROR");
return NGX_ERROR;
}
/* set result timeout */
ngx_add_timer(pgxc->read, r->upstream->conf->read_timeout);
dd("query sent successfully");
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pgxc->log, 0,
"postgres: query sent successfully");
pgxc->log->action = "waiting for result from PostgreSQL database";
pgdt->state = state_db_get_result;
dd("returning NGX_DONE");
return NGX_DONE;
}
BTW moved all ngx_postgres reference to ngx_http_postgres locally (a lot changes), was hope I made some error, but ether way undefined symbol: PQsendQuery
on module loading.
@cryptofuture You failed to link libpq against your own ngx_http_postgres_module.so, I guess.
Covered in #54
I wanted to convert module myself, but I can miss something (config with too many sections). Currently this is only one non dynamic module I currently use.