support virtual generated column not null constraint

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: support virtual generated column not null constraint
Date: 2025-02-10 13:33:41
Message-ID: CACJufxHArQysbDkWFmvK+D1TPHQWWTxWN15cMuUaTYX3xhQXgg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi.

Virtual generated columns committed,
https://git.postgresql.org/cgit/postgresql.git/commit/?id=83ea6c54025bea67bcd4949a6d58d3fc11c3e21b

This patch is for implementing not null constraints on virtual
generated columns.

NOT NULL constraints on virtual generated columns mean that
if we INSERT a row into the table and the evaluation of the generated
expression results in a null value,
an ERRCODE_NOT_NULL_VIOLATION error will be reported.

main gotcha is in ExecConstraints, expand the generated expression
and convert a not null constraint to a check constraint and evaluate it.

Attachment Content-Type Size
v1-0001-support-virtual-generated-column-not-null-constra.patch text/x-patch 16.4 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhou, Zhiguo 2025-02-10 14:12:33 Re: [RFC] Lock-free XLog Reservation from WAL
Previous Message Andres Freund 2025-02-10 13:31:38 Re: RFC: Allow EXPLAIN to Output Page Fault Information