pgsql: psql: Clean up more aggressively state of \bind[_named], \parse
От | Michael Paquier |
---|---|
Тема | pgsql: psql: Clean up more aggressively state of \bind[_named], \parse |
Дата | |
Msg-id | E1srAow-001kLE-7L@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
psql: Clean up more aggressively state of \bind[_named], \parse and \close This fixes a couple of issues with the psql meta-commands mentioned above when called repeatedly: - The statement name is reset for each call. If a command errors out, its send_mode would still be set, causing an incorrect path to be taken when processing a query. For \bind_named, this could trigger an assertion failure as a statement name is always expected for this meta-command. This issue has been introduced by d55322b0da60. - The memory allocated for bind parameters can be leaked. This is a bug enlarged by d55322b0da60 that exists since 5b66de3433e2, as it is also possible to leak memory with \bind in v16 and v17. This requires a fix that will be done on the affected branches separately. This issue is taken care of here for HEAD. This patch tightens the cleanup of the state used for the extended protocol meta-commands (bind parameters, send mode, statement name) by doing it before running each meta-command on top of doing it once a query has been processed, avoiding any leaks and the inconsistencies when mixing calls, by refactoring the cleanup in a single routine used in all the code paths where this step is required. Reported-by: Alexander Lakhin Author: Anthonin Bonnefoy Discussion: https://postgr.es/m/2e5b89af-a351-ff0a-000c-037ac28314ab@gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/87eeadaea1439693f6108ff599d750842ca6f338 Modified Files -------------- src/bin/psql/command.c | 12 ++++---- src/bin/psql/common.c | 59 ++++++++++++++++++++++++-------------- src/bin/psql/common.h | 1 + src/test/regress/expected/psql.out | 9 ++++++ src/test/regress/sql/psql.sql | 5 ++++ 5 files changed, 59 insertions(+), 27 deletions(-)
В списке pgsql-committers по дате отправления: