forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit90e0f9f
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 parentd18ec31 commit90e0f9f
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 | |
---|---|---|---|
| |||
2953 | 2953 |
| |
2954 | 2954 |
| |
2955 | 2955 |
| |
2956 |
| - | |
2957 |
| - | |
2958 |
| - | |
| 2956 | + | |
2959 | 2957 |
| |
2960 | 2958 |
| |
2961 | 2959 |
| |
2962 | 2960 |
| |
2963 |
| - | |
2964 |
| - | |
2965 |
| - | |
2966 |
| - | |
2967 |
| - | |
2968 |
| - | |
2969 |
| - | |
2970 |
| - | |
| 2961 | + | |
| 2962 | + | |
| 2963 | + | |
| 2964 | + | |
| 2965 | + | |
| 2966 | + | |
| 2967 | + | |
| 2968 | + | |
| 2969 | + | |
| 2970 | + | |
| 2971 | + | |
| 2972 | + | |
| 2973 | + | |
| 2974 | + | |
| 2975 | + | |
| 2976 | + | |
| 2977 | + | |
| 2978 | + | |
| 2979 | + | |
| 2980 | + | |
| 2981 | + | |
| 2982 | + | |
| 2983 | + | |
| 2984 | + | |
| 2985 | + | |
| 2986 | + | |
| 2987 | + | |
| 2988 | + | |
| 2989 | + | |
| 2990 | + | |
| 2991 | + | |
| 2992 | + | |
2971 | 2993 |
| |
| 2994 | + | |
2972 | 2995 |
| |
2973 | 2996 |
| |
2974 | 2997 |
| |
|
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)