Re: [HACKERS] plpgsql versus domains

2015-03-01 Thread Tom Lane
Andrew Gierth and...@tao11.riddles.org.uk writes: Tom == Tom Lane t...@sss.pgh.pa.us writes: Tom This is the first attempt at weaponizing the memory context Tom reset/delete feature, and I'm fairly happy with it, except for one Tom thing: I had to #include utils/memnodes.h into typcache.h

Re: [HACKERS] plpgsql versus domains

2015-02-28 Thread Tom Lane
Andres Freund and...@2ndquadrant.com writes: On 2015-02-26 13:53:18 -0500, Tom Lane wrote: Andres Freund and...@2ndquadrant.com writes: You're probably going to kill me because of the increased complexity, but how about making typecache.c smarter, more in the vein of relcache.c, and store the

Re: [HACKERS] plpgsql versus domains

2015-02-28 Thread Andrew Gierth
Tom == Tom Lane t...@sss.pgh.pa.us writes: Tom This is the first attempt at weaponizing the memory context Tom reset/delete feature, and I'm fairly happy with it, except for one Tom thing: I had to #include utils/memnodes.h into typcache.h in order Tom to preserve the intended property that

Re: [HACKERS] plpgsql versus domains

2015-02-27 Thread Robert Haas
On Thu, Feb 26, 2015 at 1:53 PM, Tom Lane t...@sss.pgh.pa.us wrote: To some extent this is a workaround for the fact that plpgsql does type conversions the way it does (ie, by I/O rather than by using the parser's cast mechanisms). We've talked about changing that, but people seem to be

Re: [HACKERS] plpgsql versus domains

2015-02-27 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Thu, Feb 26, 2015 at 1:53 PM, Tom Lane t...@sss.pgh.pa.us wrote: To some extent this is a workaround for the fact that plpgsql does type conversions the way it does (ie, by I/O rather than by using the parser's cast mechanisms). We've talked about

Re: [HACKERS] plpgsql versus domains

2015-02-27 Thread Pavel Stehule
2015-02-27 21:57 GMT+01:00 Tom Lane t...@sss.pgh.pa.us: Robert Haas robertmh...@gmail.com writes: On Thu, Feb 26, 2015 at 1:53 PM, Tom Lane t...@sss.pgh.pa.us wrote: To some extent this is a workaround for the fact that plpgsql does type conversions the way it does (ie, by I/O rather than

Re: [HACKERS] plpgsql versus domains

2015-02-26 Thread Pavel Stehule
Hi 2015-02-26 18:31 GMT+01:00 Tom Lane t...@sss.pgh.pa.us: At the behest of Salesforce, I've been looking into improving plpgsql's handling of variables of domain types, which is currently pretty awful. It's really slow, because any assignment to a domain variable goes through the slow

Re: [HACKERS] plpgsql versus domains

2015-02-26 Thread Andres Freund
On 2015-02-26 13:53:18 -0500, Tom Lane wrote: Andres Freund and...@2ndquadrant.com writes: Hm. A bit sad to open code that in plpgsql instead of making it available more generally. The actual checking wouldn't be open-coded, it would come from domain_check() (or possibly a modified

Re: [HACKERS] plpgsql versus domains

2015-02-26 Thread Andres Freund
Hi, On 2015-02-26 12:31:46 -0500, Tom Lane wrote: It's really slow, because any assignment to a domain variable goes through the slow double-I/O-conversion path in exec_cast_value, even if no actual work is needed. Hm, that's surely not nice for some types. Doing syscache lookups every time

Re: [HACKERS] plpgsql versus domains

2015-02-26 Thread Pavel Stehule
2015-02-26 19:53 GMT+01:00 Tom Lane t...@sss.pgh.pa.us: Andres Freund and...@2ndquadrant.com writes: On 2015-02-26 12:31:46 -0500, Tom Lane wrote: 2. In plpgsql, explicitly model a domain type as being its base type plus some constraints --- that is, stop depending on domain_in() to

Re: [HACKERS] plpgsql versus domains

2015-02-26 Thread Tom Lane
Andres Freund and...@2ndquadrant.com writes: On 2015-02-26 12:31:46 -0500, Tom Lane wrote: 2. In plpgsql, explicitly model a domain type as being its base type plus some constraints --- that is, stop depending on domain_in() to enforce the constraints, and do it ourselves. This would mean