forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit70291a3
committed
Improve handling of empty query results in BackgroundPsql::query()
A newline is not added at the end of an empty query result, causing thebanner of the hardcoded \echo to not be discarded. This would reflecton 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 ableto work correctly, making the first newline before the banner optional,bringing more flexibility.Note that this change affects 037_invalid_database.pl, where threequeries generated an empty result, with the script relying on the datafrom the hardcoded banner to exist in the expected output. Thesequeries are changed to use query_safe(), leading to a simpler script.The author has also proposed a test in a different patch where emptyresults would exist when using BackgroundPsql.Author: Jacob ChampionReviewed-by: Andrew Dunstan, Michael PaquierDiscussion:https://postgr.es/m/CAOYmi+=60deN20WDyCoHCiecgivJxr=98s7s7-C8SkXwrCfHXg@mail.gmail.com1 parentf638aaf commit70291a3
File tree
2 files changed
+9
-11
lines changed- src/test
- perl/PostgreSQL/Test
- recovery/t
2 files changed
+9
-11
lines changedLines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
236 | 236 |
| |
237 | 237 |
| |
238 | 238 |
| |
239 |
| - | |
240 |
| - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
241 | 243 |
| |
242 | 244 |
| |
243 | 245 |
| |
|
Lines changed: 5 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
96 | 96 |
| |
97 | 97 |
| |
98 | 98 |
| |
99 |
| - | |
100 |
| - | |
| 99 | + | |
| 100 | + | |
101 | 101 |
| |
102 | 102 |
| |
103 | 103 |
| |
104 |
| - | |
105 |
| - | |
| 104 | + | |
106 | 105 |
| |
107 | 106 |
| |
108 | 107 |
| |
| |||
135 | 134 |
| |
136 | 135 |
| |
137 | 136 |
| |
138 |
| - | |
139 |
| - | |
140 |
| - | |
141 |
| - | |
142 |
| - | |
| 137 | + | |
| 138 | + | |
143 | 139 |
| |
144 | 140 |
| |
145 | 141 |
| |
|
0 commit comments
Comments
(0)