Re: [HACKERS] Domains and type coercion

2002-03-21 Thread Tom Lane
Thomas Lockhart [EMAIL PROTECTED] writes: We could treat exact and binary-compatible matches alike (doesn't seem good), or put a special case into the operator selection rules to reduce domains to their basetypes before making the exact match test. There could also be an explicit heuristic

Re: [HACKERS] Domains and type coercion

2002-03-21 Thread Fernando Nasser
Tom Lane wrote: If we take the hard SQL99 line that domains *are* the base type plus constraints, then we could reduce domains to base types before we start the entire matching process, and this issue would go away. This would prevent declaring any specialized operators or functions for a

Re: [HACKERS] Domains and type coercion

2002-03-20 Thread Tom Lane
I wrote: I am thinking that a non-broken approach would involve (1) treating a domain as binary-compatible with its base type, and therefore with all other domains on the same base type, and (2) allowing a coercion function that produces the base type to be used to produce the domain type.

Re: [HACKERS] Domains and type coercion

2002-03-20 Thread Fernando Nasser
Tom Lane wrote: (...) or put a special case into the operator selection rules to reduce domains to their basetypes before making the exact match test. By definition, which I believe should be read as A domain is a set of permissible values (of a data type). What I am trying to say is

Re: [HACKERS] Domains and type coercion

2002-03-20 Thread Fernando Nasser
Tom Lane wrote: Any thoughts? As we are talking about CAST, if one CASTs to a domain, SQL99 says we have to check the constraints and issue a integrity constraint violation if appropriate (6.22, GR 21). -- Fernando Nasser Red Hat - Toronto E-Mail: [EMAIL

[HACKERS] Domains and type coercion

2002-03-19 Thread Tom Lane
The DOMAIN patch is completely broken when it comes to type coercion behavior. For one thing, it doesn't know that any operators or functions on a domain's base type can be used with a domain: domain=# create domain zip as char(2); CREATE domain=# create table foo (f1 zip); CREATE domain=#

Re: [HACKERS] Domains and type coercion

2002-03-19 Thread Rod Taylor
I am thinking that a non-broken approach would involve (1) treating a domain as binary-compatible with its base type, and therefore with all other domains on the same base type, and (2) allowing a coercion function that produces the base type to be used to produce the domain type. (The