Re: Rowtype column and domain subfield with DEFAULT and NOT NULL constraint - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Rowtype column and domain subfield with DEFAULT and NOT NULL constraint
Date
Msg-id 11415.1394633781@sss.pgh.pa.us
Whole thread Raw
In response to Rowtype column and domain subfield with DEFAULT and NOT NULL constraint  (Julien Tachoires <julien.tachoires@dalibo.com>)
Responses Re: Rowtype column and domain subfield with DEFAULT and NOT NULL constraint  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
Julien Tachoires <julien.tachoires@dalibo.com> writes:
> A customer has reported us a strange behaviour regarding a rowtype 
> column with a domain subfield:

Rowtypes in general do not support defaults for component fields.

> Is build_column_default() the right place to handle that case ?

It's unlikely that this is simple to change.  As an example, should
the default be inserted during a cast to the rowtype?  How about
plpgsql variable initialization?  What are you going to do about
scalar-NULL values of the rowtype (note "forbid them" is likely
to cause all sorts of collateral damage)?

But in any case, none of the examples you showed have anything to
do with build_column_default().  That would only get applied if
the INSERT's targetlist didn't mention col1 at all.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Kouhei Kaigai
Date:
Subject: pgstat wait timeout (RE: contrib/cache_scan)
Next
From: Tom Lane
Date:
Subject: Re: pgstat wait timeout (RE: contrib/cache_scan)