Re: RfD: more powerful "any" types

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Hannu Krosing <hannu(at)krosing(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RfD: more powerful "any" types
Date: 2009-09-10 20:08:50
Message-ID: 162867790909101308o6661e26bk7e375326556423e4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2009/9/10 Hannu Krosing <hannu(at)krosing(dot)net>:
> On Thu, 2009-09-10 at 21:30 +0200, Pavel Stehule wrote:
>> 2009/9/10 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>> > Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>> >> 2009/9/10 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>> >>> 1. Allow the existing "any" pseudotype as an input argument type for PLs.
>> >>> (AFAICS this is simple and painless; about the only question is whether
>> >>> we want to keep using the name "any", which because of conflicting with
>> >>> a reserved word would always need the double quotes.)
>> >
>> >> I thing so this is possible - I see only one critical point - you
>> >> cannot validate source in validation time.
>> >
>> > How's it any different from anyelement?
>>
>> true, if I remember well, there is substitution from anyelement to int?
>>
>> maybe from this perspective can be good to separate polymorphic types
>> to some kinds:
>>
>> any - really unknown type - there is possible only check on null or
>> not null (and maybe some basic operations).
>> anytext - any value (substituted to text) in validation time
>> anynumeric - any value (substitued to integer) in validation time.
>
> I think that way madness lies.
>
> then we should have anyXXX types for almost any subsets of types
>
> anytime , anygeom, anypointpair, anymorethantwopaintgeom, etc...

true :(
>
> better have a (possibility of) validation at compile time and
> validation/error-throwing at runtime - the latter is needed anyway.
>

I have very bad experience with late validation - like plpgsql did. It
could to throw some exception too late (in production) - so this is
some way, where we have to be carefully. It easy to write dynamic
system - but this system should be dangerous in production. When I
started with PostgreSQL I disliked hard typing system, now I love it -
lot of things are predictable.

> Unless we are going to implement CHECK constraints for function
> arguments and then use constraint exclusion for selecting the correct
> function ;)
>
>> regards
>> Pavel Stehule
>>
>> >
>> >                        regards, tom lane
>> >
>>
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2009-09-10 20:15:48 Re: RfD: more powerful "any" types
Previous Message David E. Wheeler 2009-09-10 20:07:29 Re: RfD: more powerful "any" types