Domains and Casting - Mailing list pgsql-hackers

From Rod Taylor
Subject Domains and Casting
Date
Msg-id 01b701c21671$c654ffd0$fe01a8c0@jester
Whole thread Raw
Responses Re: Domains and Casting  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
In order to make domains spec compliant I've added the ability for the
executor to handle Constraint * types, which it applies appropriately.
coerce_type wraps domains with the appropriate Constraint Nodes as
required.  I've run into a rather simple problem however.

CREATE DOMAIN int4notnulldomain int4 NOT NULL;
SELECT cast(cast(NULL as int4) as int4notnulldomain);  -- constraint
applied properly

SELECT cast(NULL as int4notnulldomain); -- constraint missed.


This appears to be due to makeTypeCast() in gram.y which bypasses
creating a TypeCast node for simple A_Const.

Removing the top part of the if (always creating a TypeCast node)
causes some rather extensive failures in the regression tests,
specifically with 'int4'::regproc type constructs.

Any advice?
--
Rod



pgsql-hackers by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Massive regression failures
Next
From: David Ford
Date:
Subject: Re: PostGres Doubt