Re: support virtual generated column not null constraint

2025-04-05 Thread jian he
hi. rebase, and some minor code comments change. From 0af096b3959cc6f146bbe8a54a018c0e69beff2e Mon Sep 17 00:00:00 2001 From: jian he Date: Mon, 24 Mar 2025 11:22:54 +0800 Subject: [PATCH v6 1/1] not null for virtual generated column MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Conte

Re: support virtual generated column not null constraint

2025-04-05 Thread Álvaro Herrera
On 2025-Mar-20, jian he wrote: > ATRewriteTable: > for (i = 0; i < newTupDesc->natts; i++) > { > Form_pg_attribute attr = TupleDescAttr(newTupDesc, i); > if (attr->attnotnull && !attr->attisdropped) > { > if (attr->attgenerated !=

Re: support virtual generated column not null constraint

2025-04-04 Thread Xuneng Zhou
Hi, response from ChatGPT, seems correct: "Consing up" is an informal term derived from Lisp terminology. In this context, it means dynamically creating (allocating and constructing) a new NullTest node. Instead of reusing an existing node, the code allocates a fresh node—using PostgreSQL’s memor

Re: support virtual generated column not null constraint

2025-03-31 Thread jian he
On Fri, Mar 28, 2025 at 10:06 PM Peter Eisentraut wrote: > > On 24.03.25 04:26, jian he wrote: > > rebase, and some minor code comments change. > > I have committed this. > In an earlier thread, I also posted a patch for supporting virtual generated columns over domain type. The code is somehow si

Re: support virtual generated column not null constraint

2025-03-28 Thread Peter Eisentraut
On 24.03.25 04:26, jian he wrote: rebase, and some minor code comments change. I have committed this. I did a bit more editing on the naming of various things. In terms of functionality, in ExecConstraints() notnull_virtual_attrs and virtual_notnull_check were redundant, so I simplified tha

Re: support virtual generated column not null constraint

2025-03-19 Thread jian he
On Thu, Mar 20, 2025 at 12:19 AM Álvaro Herrera wrote: > > Other comments: > > * The block in ATRewriteTable that creates a resultRelInfo for > ExecRelCheckGenVirtualNotNull needs an explanation. > I tried my best. here are the comments above the line ``if (notnull_virtual_attrs != NIL)``

Re: support virtual generated column not null constraint

2025-03-19 Thread Álvaro Herrera
On 2025-Mar-13, jian he wrote: > hi. > > new patch attached. > > 0001 for virtual generated columns not null. > minor change to fix the compiler warning. I gave a look at 0001, and I propose some fixes. 0001 is just a typo in an error message. 0002 is pgindent. Then 0003 contain some more in

Re: support virtual generated column not null constraint

2025-03-13 Thread jian he
hi. new patch attached. 0001 for virtual generated columns not null. minor change to fix the compiler warning. 0002-0004 is for domain over virtual generated columns. 0002: we need to compute the generation expression for the domain with constraints, thus rename ExecComputeStoredGenerated to Exe

Re: support virtual generated column not null constraint

2025-03-08 Thread jian he
hi. patch attached to fix the above thread mentioned issue, related tests added. also there are several compiler warnings at [0] for virtual generated column domain patch, i did some minor adjustment, let's see how it goes. [0] https://cirrus-ci.com/task/4550600270020608 From 0985d7a779287feaa1a

Re: support virtual generated column not null constraint

2025-03-07 Thread Xuneng Zhou
Hi, forget to add hackers to cc. Xuneng Zhou 于2025年3月8日周六 12:10写道: > > > Navneet Kumar 于2025年3月8日周六 02:09写道: > >> >> >>> This scenario fails >>> 1. CREATE TABLE person ( >>> id INT GENERATED BY DEFAULT AS IDENTITY, >>> first_name VARCHAR(50) NOT NULL, >>> last_name VARCHAR(50) NOT

Re: support virtual generated column not null constraint

2025-03-07 Thread Xuneng Zhou
Hi, jian he 于2025年3月6日周四 21:44写道: > On Wed, Feb 26, 2025 at 3:01 PM ego alter wrote: > > > > Hi, I’ve had a chance to review the patch. As I am still getting > familiar with executor part, questions and feedbacks could be relatively > trivial. > > > > There are two minor issues i want to discu

Re: support virtual generated column not null constraint

2025-03-07 Thread Navneet Kumar
> > This scenario fails > 1. CREATE TABLE person ( > id INT GENERATED BY DEFAULT AS IDENTITY, > first_name VARCHAR(50) NOT NULL, > last_name VARCHAR(50) NOT NULL > ); > > 2. INSERT INTO person (first_name, last_name) > VALUES ('first', 'last'); > > 3. ALTER TABLE person > ADD COLUMN ful

Re: support virtual generated column not null constraint

2025-03-07 Thread Navneet Kumar
Hi I encountered an issue when trying to add a virtual column to an existing table using the ALTER command. The operation fails even though the existing data ensures that the virtual column's value will never be NULL. However, if I define the same virtual column while creating the table and then i

Re: support virtual generated column not null constraint

2025-03-06 Thread jian he
On Wed, Feb 26, 2025 at 3:01 PM ego alter wrote: > > Hi, I’ve had a chance to review the patch. As I am still getting familiar > with executor part, questions and feedbacks could be relatively trivial. > > There are two minor issues i want to discuss: > 1. The way of caching constraint-checking

Re: support virtual generated column not null constraint

2025-02-25 Thread ego alter
Hi, I’ve had a chance to review the patch. As I am still getting familiar with executor part, questions and feedbacks could be relatively trivial. There are two minor issues i want to discuss: 1. The way of caching constraint-checking expr for virtual generated not null The existing array for cac

support virtual generated column not null constraint

2025-02-10 Thread jian he
945ee799beca62e76f128660aef658ef61a11a8a Mon Sep 17 00:00:00 2001 From: jian he Date: Mon, 10 Feb 2025 21:20:02 +0800 Subject: [PATCH v1 1/1] support virtual generated column not null constraint now we can add not null constraint on virtual generated column. not null constraint on virtual generated