Re: Rowtype column and domain subfield with DEFAULT and NOT NULL constraint

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Julien Tachoires <julien(dot)tachoires(at)dalibo(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Rowtype column and domain subfield with DEFAULT and NOT NULL constraint
Date: 2014-03-12 14:16:21
Message-ID: 11415.1394633781@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Julien Tachoires <julien(dot)tachoires(at)dalibo(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Dhundhara 2014-03-12 14:35:35 GSoC 2014
Previous Message Kouhei Kaigai 2014-03-12 13:54:32 pgstat wait timeout (RE: contrib/cache_scan)