forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5189398
committed
Handle unqualified SEQUENCE NAME options properly in parse_utilcmd.c.
generateSerialExtraStmts() was sloppy about handling the case whereSEQUENCE NAME is given with a not-schema-qualified name. It was generatinga CreateSeqStmt with an unqualified sequence name, and an AlterSeqStmtwhose "owned_by" DefElem contained a T_String Value with a null stringpointer in the schema-name position. The generated nextval() argument wasalso underqualified. This accidentally failed to fail at runtime, but onlyso long as the current default creation namespace at runtime is the rightnamespace. That's bogus; the parse-time transformation is supposed to beinserting the right schema name in all cases, so as to avoid any possibleskew in that selection. I'm not sure this could fail in pg_dump's usage,but it's still wrong; we have had real bugs in this area before adoptingthe policy that parse_utilcmd.c should generate only fully-qualifiedauxiliary commands. A slightly lesser problem, which is what led me tonotice this in the first place, is that pprint() dumped core on theAlterSeqStmt because of the bogus T_String.Noted while poking into the open problem with ALTER SEQUENCE breakingpg_upgrade.1 parent4f7a95b commit5189398
1 file changed
+22
-2
lines changedLines changed: 22 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
345 | 345 |
| |
346 | 346 |
| |
347 | 347 |
| |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
348 | 357 |
| |
349 | 358 |
| |
350 | 359 |
| |
| |||
373 | 382 |
| |
374 | 383 |
| |
375 | 384 |
| |
376 |
| - | |
377 | 385 |
| |
378 | 386 |
| |
379 | 387 |
| |
| |||
393 | 401 |
| |
394 | 402 |
| |
395 | 403 |
| |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
396 | 413 |
| |
| 414 | + | |
397 | 415 |
| |
398 | 416 |
| |
399 | 417 |
| |
| |||
433 | 451 |
| |
434 | 452 |
| |
435 | 453 |
| |
436 |
| - | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
437 | 457 |
| |
438 | 458 |
| |
439 | 459 |
| |
|
0 commit comments
Comments
(0)