- Notifications
You must be signed in to change notification settings - Fork28
Commitf0774ab
committed
Fix interval_transform so it doesn't throw away non-no-op casts.
interval_transform() contained two separate bugs that caused it tosometimes mistakenly decide that a cast from interval to restrictedinterval is a no-op and throw it away.First, it was wrong to rely on dt.h's field type macros to have anordering consistent with the field's significance; in one case they donot. This led to mistakenly treating YEAR as less significant than MONTH,so that a cast from INTERVAL MONTH to INTERVAL YEAR was incorrectlydiscarded.Second, fls(1<<k) produces k+1 not k, so comparing its output directlyto SECOND was wrong. This led to supposing that a cast to INTERVALMINUTE was really a cast to INTERVAL SECOND and so could be discarded.To fix, get rid of the use of fls(), and make a function based onintervaltypmodout to produce a field ID code adapted to the need here.Per bug #14479 from Piotr Stefaniak. Back-patch to 9.2 where transformfunctions were introduced, because this code was born broken.Discussion:https://postgr.es/m/20161227172307.10135.7747@wrigleys.postgresql.org1 parent71f996d commitf0774ab
File tree
3 files changed
+105
-29
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+105
-29
lines changedLines changed: 82 additions & 29 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1250 | 1250 |
| |
1251 | 1251 |
| |
1252 | 1252 |
| |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
1253 | 1306 |
| |
1254 | 1307 |
| |
1255 | 1308 |
| |
| |||
1271 | 1324 |
| |
1272 | 1325 |
| |
1273 | 1326 |
| |
1274 |
| - | |
1275 | 1327 |
| |
1276 |
| - | |
1277 |
| - | |
1278 |
| - | |
1279 |
| - | |
1280 |
| - | |
1281 |
| - | |
1282 |
| - | |
1283 |
| - | |
1284 |
| - | |
1285 |
| - | |
1286 |
| - | |
1287 |
| - | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
1288 | 1332 |
| |
1289 | 1333 |
| |
1290 |
| - | |
1291 |
| - | |
1292 |
| - | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
1293 | 1347 |
| |
1294 |
| - | |
1295 |
| - | |
1296 |
| - | |
1297 |
| - | |
1298 |
| - | |
1299 |
| - | |
1300 |
| - | |
1301 |
| - | |
1302 |
| - | |
1303 |
| - | |
1304 |
| - | |
1305 |
| - | |
1306 |
| - | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
1307 | 1360 |
| |
1308 | 1361 |
| |
1309 | 1362 |
| |
|
Lines changed: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
682 | 682 |
| |
683 | 683 |
| |
684 | 684 |
| |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
685 | 703 |
| |
686 | 704 |
| |
687 | 705 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
196 | 196 |
| |
197 | 197 |
| |
198 | 198 |
| |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
199 | 204 |
| |
200 | 205 |
| |
201 | 206 |
| |
|
0 commit comments
Comments
(0)