diff options
author | Michael Paquier <michael@paquier.xyz> | 2024-11-07 12:11:27 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2024-11-07 12:11:27 +0900 |
commit | 70291a3c66eca599fd9f59f7f6051432b2020f4b (patch) | |
tree | 1afba01ca50f07f9e8056fd2a938a5f79b2158c2 /src/backend/access/gist/gist.c | |
parent | f638aafd1ea8505750ca9546e0e0b2e4cf31027d (diff) | |
download | postgresql-70291a3c66eca599fd9f59f7f6051432b2020f4b.tar.gz postgresql-70291a3c66eca599fd9f59f7f6051432b2020f4b.zip |
Improve handling of empty query results in BackgroundPsql::query()
A newline is not added at the end of an empty query result, causing the
banner of the hardcoded \echo to not be discarded. This would reflect
on scripts that expect an empty result by showing the "QUERY_SEPARATOR"
in the output returned back to the caller, which was confusing.
This commit changes BackgroundPsql::query() so as empty results are able
to work correctly, making the first newline before the banner optional,
bringing more flexibility.
Note that this change affects 037_invalid_database.pl, where three
queries generated an empty result, with the script relying on the data
from the hardcoded banner to exist in the expected output. These
queries are changed to use query_safe(), leading to a simpler script.
The author has also proposed a test in a different patch where empty
results would exist when using BackgroundPsql.
Author: Jacob Champion
Reviewed-by: Andrew Dunstan, Michael Paquier
Discussion: https://postgr.es/m/CAOYmi+=60deN20WDyCoHCiecgivJxr=98s7s7-C8SkXwrCfHXg@mail.gmail.com
Diffstat (limited to 'src/backend/access/gist/gist.c')
0 files changed, 0 insertions, 0 deletions