mirror of
https://github.com/postgres/postgres.git
synced 2025-06-22 02:52:08 +03:00
Add support for not-null constraints on virtual generated columns
This was left out of the original patch for virtual generated columns
(commit 83ea6c5402
).
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
This commit is contained in:
@ -1118,10 +1118,12 @@ DefineIndex(Oid tableId,
|
||||
|
||||
if (TupleDescAttr(RelationGetDescr(rel), attno - 1)->attgenerated == ATTRIBUTE_GENERATED_VIRTUAL)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
stmt->isconstraint ?
|
||||
errmsg("unique constraints on virtual generated columns are not supported") :
|
||||
errmsg("indexes on virtual generated columns are not supported")));
|
||||
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
stmt->primary ?
|
||||
errmsg("primary keys on virtual generated columns are not supported") :
|
||||
stmt->isconstraint ?
|
||||
errmsg("unique constraints on virtual generated columns are not supported") :
|
||||
errmsg("indexes on virtual generated columns are not supported"));
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user