Hello,
I'm doing something which seems like it ought to be simple, so hopefully my error is something obvious.
location = /fake/ingress {
postgres_pass database;
postgres_escape $meta "{}";
postgres_escape $doc $request_body;
postgres_query POST "INSERT INTO mms_ingest (meta,doc) VALUES ($meta,$doc)";
}
And the resulting error.log message:
2019/10/08 15:22:06 [error] 23321#0: *27766 postgres: failed to receive result: PGRES_FATAL_ERROR: ERROR: null value in column "doc" violates not-null constraint
DETAIL: Failing row contains (35, 2019-10-08 15:22:06.160385+00, {}, null).
If I insert $request_body in the postgres_query directive without postgres_escape, it works, but the real data I'm receiving will have embedded quotes so I need to escape it somehow.
Any ideas what I should do?
Thanks, Josh