forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf011acd
committed
Fix ALTER TABLE ADD VIRTUAL GENERATED COLUMN when table rewrite
demo:CREATE TABLE gtest20a (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) VIRTUAL);ALTER TABLE gtest20a ADD COLUMN c float8 DEFAULT RANDOM() CHECK (b < 60);ERROR: no generation expression found for column number 2 of table "pg_temp_17306"In ATRewriteTable, the variable OIDNewHeap (if valid) correspondingpg_attrdef default expression entry was not populated. So OIDNewHeapcannot be used to call expand_generated_columns_in_expr orbuild_generation_expression. Therefore in ATRewriteTable, we can onlyuse the existing relation to expand the generated expression.Author: jian he <jian.universality@gmail.com>Reviewed-by: Srinath Reddy <srinath2133@gmail.com>Discussion:https://www.postgresql.org/message-id/flat/CACJufxEJ%3DFoajabWXjszo_yrQeKSxdZ87KJqBW373rSbajKGAA%40mail.gmail.com1 parent716a051 commitf011acd
File tree
5 files changed
+15
-1
lines changed- src
- backend/commands
- test/regress
- expected
- sql
5 files changed
+15
-1
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6137 | 6137 |
| |
6138 | 6138 |
| |
6139 | 6139 |
| |
6140 |
| - | |
| 6140 | + | |
6141 | 6141 |
| |
6142 | 6142 |
| |
6143 | 6143 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
656 | 656 |
| |
657 | 657 |
| |
658 | 658 |
| |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
659 | 663 |
| |
660 | 664 |
| |
661 | 665 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
647 | 647 |
| |
648 | 648 |
| |
649 | 649 |
| |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
650 | 654 |
| |
651 | 655 |
| |
652 | 656 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
319 | 319 |
| |
320 | 320 |
| |
321 | 321 |
| |
| 322 | + | |
| 323 | + | |
| 324 | + | |
322 | 325 |
| |
323 | 326 |
| |
324 | 327 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
319 | 319 |
| |
320 | 320 |
| |
321 | 321 |
| |
| 322 | + | |
| 323 | + | |
| 324 | + | |
322 | 325 |
| |
323 | 326 |
| |
324 | 327 |
| |
|
0 commit comments
Comments
(0)