Hello and sorry for weeks of silence.
Hello Anders and Peter,
Thanks for your messages.
Please see the new patch version attached.
In my testing, I couldn't get this patch to do anything. Could you
please share your testing steps?
Sure. Provided you're in the postgres checkout and you've run make in
src/test/examples/ this should work
CREATE SCHEMA testlibpq3;
SET search_path = testlibpq3;
CREATE TABLE test1_(i int4, t text, b bytea);
INSERT INTO test1_ VALUES(0, '', '');
CREATE VIEW test1 AS SELECT 1/i i, t, b FROM test1_;
-- will log only statement
\! ./src/test/examples/testlibpq3
ALTER SYSTEM SET log_parameters_on_error TO on;
SELECT pg_reload_conf();
-- will log statement with parameters
\! ./src/test/examples/testlibpq3
I did
postgres -D data --log-parameters-on-error=on
pgbench -i bench
alter table pgbench_accounts alter column aid type smallint;
pgbench -M extended -S -T 10 bench
This will then error out on type overflows, but I don't see any
parameters being logged:
ERROR: value "62812" is out of range for type smallint
STATEMENT: SELECT abalance FROM pgbench_accounts WHERE aid = $1;
(In this case the error message contains the parameter value, so it's
not a very practical case, but it should work, it seems.)
I guess this error occurred
while binding, so the parameters probably weren't yet all bound by the time of error reporting.
That's why the error message came without parameters.
Meanwhile, I have committed a patch that refactors the ParamListInfo
initialization a bit, so you don't have to initialize hasTextValues in a
bunch of places unrelated to your core code. So please rebase your
patch on that.
Please find rebased patch attached.
I apologize for no reply before: I first thought my patch was really faulty and knew I wouldn't have time to fix it these days, but it seems to me it actually works.
Anyway, I don't suppose you manage to review it within the remaining few days, so I'll rebase it again in the beginning of the next CF.
Best regards,
Alexey