Thread: pgsql: Add support for not-null constraints on virtual generated column
Add support for not-null constraints on virtual generated columns This was left out of the original patch for virtual generated columns (commit 83ea6c54025). This just involves a bit of extra work in the executor to expand the generation expressions and run a "IS NOT NULL" test against them. There is also a bit of work to make sure that not-null constraints are checked during a table rewrite. Author: jian he <jian.universality@gmail.com> Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com> Reviewed-by: Navneet Kumar <thanit3111@gmail.com> Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org> Discussion: https://postgr.es/m/CACJufxHArQysbDkWFmvK+D1TPHQWWTxWN15cMuUaTYX3xhQXgg@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/cdc168ad4b22ea4183f966688b245cabb5935d1f Modified Files -------------- src/backend/catalog/heap.c | 10 -- src/backend/commands/indexcmds.c | 10 +- src/backend/commands/tablecmds.c | 71 ++++++-- src/backend/executor/execMain.c | 220 ++++++++++++++++++------ src/backend/parser/parse_utilcmd.c | 14 -- src/include/executor/executor.h | 4 + src/include/nodes/execnodes.h | 6 + src/test/regress/expected/generated_virtual.out | 90 ++++++++-- src/test/regress/sql/generated_virtual.sql | 54 +++++- 9 files changed, 360 insertions(+), 119 deletions(-)