forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3886785
committed
Fix psql \d's query for identifying parent triggers.
The original coding (fromc33869c) failed with "more than one rowreturned by a subquery used as an expression" if there were unrelatedtriggers of the same tgname on parent partitioned tables. (That'spossible because statement-level triggers don't get inherited.) Fixby applying LIMIT 1 after sorting the candidates by inheritance level.Also, wrap the subquery in a CASE so that we don't have to execute it atall when the trigger is visibly non-inherited. Aside from saving somecycles, this avoids the need for a confusing and undocumented NULLIF().While here, tweak the format of the emitted query to look a bitnicer for "psql -E", and add some explanation of this subquery,because it badly needs it.Report and patch by Justin Pryzby (with some editing by me).Back-patch to v13 where the faulty code came in.Discussion:https://postgr.es/m/20211217154356.GJ17618@telsasoft.com1 parent4e87265 commit3886785
File tree
3 files changed
+53
-11
lines changed- src
- bin/psql
- test/regress
- expected
- sql
3 files changed
+53
-11
lines changedLines changed: 34 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3250 | 3250 |
| |
3251 | 3251 |
| |
3252 | 3252 |
| |
3253 |
| - | |
3254 |
| - | |
3255 |
| - | |
| 3253 | + | |
3256 | 3254 |
| |
3257 | 3255 |
| |
3258 | 3256 |
| |
3259 | 3257 |
| |
3260 |
| - | |
3261 |
| - | |
3262 |
| - | |
3263 |
| - | |
3264 |
| - | |
3265 |
| - | |
3266 |
| - | |
3267 |
| - | |
| 3258 | + | |
| 3259 | + | |
| 3260 | + | |
| 3261 | + | |
| 3262 | + | |
| 3263 | + | |
| 3264 | + | |
| 3265 | + | |
| 3266 | + | |
| 3267 | + | |
| 3268 | + | |
| 3269 | + | |
| 3270 | + | |
| 3271 | + | |
| 3272 | + | |
| 3273 | + | |
| 3274 | + | |
| 3275 | + | |
| 3276 | + | |
| 3277 | + | |
| 3278 | + | |
| 3279 | + | |
| 3280 | + | |
| 3281 | + | |
| 3282 | + | |
| 3283 | + | |
| 3284 | + | |
| 3285 | + | |
| 3286 | + | |
| 3287 | + | |
| 3288 | + | |
| 3289 | + | |
3268 | 3290 |
| |
| 3291 | + | |
3269 | 3292 |
| |
3270 | 3293 |
| |
3271 | 3294 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2122 | 2122 |
| |
2123 | 2123 |
| |
2124 | 2124 |
| |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
2125 | 2139 |
| |
2126 | 2140 |
| |
2127 | 2141 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1428 | 1428 |
| |
1429 | 1429 |
| |
1430 | 1430 |
| |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
1431 | 1436 |
| |
1432 | 1437 |
| |
1433 | 1438 |
| |
|
0 commit comments
Comments
(0)