Re: [HACKERS] Domains versus arrays versus typmods

2010-10-21 Thread Kevin Grittner
Tom Lane wrote: > you are confusing an array over a domain type with a domain over > an array type. Yes I was. Sorry. Argument withdrawn. -Kevin -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/

Re: [HACKERS] Domains versus arrays versus typmods

2010-10-21 Thread Tom Lane
"Kevin Grittner" writes: > Tom Lane wrote: >> So we will downcast myia to int[], or at least one might assume >> that's what's happening. But actually it's worse than that: the >> result of this operation is thought to be myia not int[], because >> myia itself is taken as matching ANYARRAY, and

Re: [HACKERS] Domains versus arrays versus typmods

2010-10-21 Thread Kevin Grittner
Tom Lane wrote: > regression=# select array[1,2] || 3::myi; > ERROR: operator does not exist: integer[] || myi > > In this case, one might expect myi to be automatically downcast to < int so that it could be matched up with the int array, but that's > not happening. I guess it should allow t

Re: [HACKERS] Domains versus arrays versus typmods

2010-10-21 Thread Tom Lane
Robert Haas writes: > On Wed, Oct 20, 2010 at 10:03 AM, Tom Lane wrote: >> My point is that anyplace that is relying on the surface typelem, >> without drilling down to see what the base type is, is wrong. >> So yeah, those lookups are (will be) necessary. > OK. In that case, +1 from me. I've

Re: [HACKERS] Domains versus arrays versus typmods

2010-10-20 Thread Richard Huxton
On 20/10/10 01:47, Robert Haas wrote: On Tue, Oct 19, 2010 at 6:14 PM, Tom Lane wrote: Comments? It might be reasonable to back-patch whatever we decide on into 9.0, because it is so new, but I would be reluctant to go back further unless we have some evidence that it's bothering people. It

Re: [HACKERS] Domains versus arrays versus typmods

2010-10-20 Thread Robert Haas
On Wed, Oct 20, 2010 at 10:03 AM, Tom Lane wrote: > Robert Haas writes: >> On Tue, Oct 19, 2010 at 9:17 PM, Tom Lane wrote: >>> We've already accepted the cost of doing getBaseTypeAndTypmod() in a >>> whole lot of performance-critical parsing paths, on the off chance that >>> the target datatype

Re: [HACKERS] Domains versus arrays versus typmods

2010-10-20 Thread Tom Lane
Robert Haas writes: > On Tue, Oct 19, 2010 at 9:17 PM, Tom Lane wrote: >> We've already accepted the cost of doing getBaseTypeAndTypmod() in a >> whole lot of performance-critical parsing paths, on the off chance that >> the target datatype might be a domain.  It's not apparent to me that >> arra

Re: [HACKERS] Domains versus arrays versus typmods

2010-10-19 Thread Robert Haas
On Tue, Oct 19, 2010 at 9:17 PM, Tom Lane wrote: > Robert Haas writes: >> On Tue, Oct 19, 2010 at 6:14 PM, Tom Lane wrote: >>> I think that what we ought to do about it is to stop exposing typelem >>> in domains' pg_type rows.  If you want to subscript a domain value, you >>> should have to dril

Re: [HACKERS] Domains versus arrays versus typmods

2010-10-19 Thread Tom Lane
Robert Haas writes: > On Tue, Oct 19, 2010 at 6:14 PM, Tom Lane wrote: >> I think that what we ought to do about it is to stop exposing typelem >> in domains' pg_type rows.  If you want to subscript a domain value, you >> should have to drill down to its base type with getBaseTypeAndTypmod, >> wh

Re: [HACKERS] Domains versus arrays versus typmods

2010-10-19 Thread Robert Haas
On Tue, Oct 19, 2010 at 6:14 PM, Tom Lane wrote: > In bug #5717, Richard Huxton complains that a domain declared like >        CREATE DOMAIN mynums numeric(4,2)[1]; > doesn't work properly, ie, the typmod isn't enforced in places where > it reasonably ought to be.  I dug into this a bit, and found