From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Hannu Krosing <hannu(at)krosing(dot)net> |
Cc: | Dimitri Fontaine <dfontaine(at)hi-media(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: RfD: more powerful "any" types |
Date: | 2009-09-10 10:46:41 |
Message-ID: | 162867790909100346v2ee3845ic364420bc72cf8c8@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 08:44 +0300, Hannu Krosing wrote:
>
>> maybe just let users say what they mean, so first time we have "any" and
>> if we need more then we say "same_as(...)"
>
> Acutually we could be even more SQL-y and have a more verbose syntax for
> pseudotypes by extending the grammar
>
> CREATE FUNCTION foo(
> a ANY TYPE,
> b SAME TYPE AS a,
> c ANY TYPE
> OUT d ARRAY OF SAME TYPE AS c
> ) ....
>
> TYPE could probably be optional
>
We could define anything, but we have to implement function searching
algorithm, that understand this new feature, and that is compatible
with current behave. Syntax is some simple, but the core is in
namespace.c.
regards
Pavel
>
>> so your example becomes
>>
>>
>> CREATE FUNCTION foo(a any, b same_type_as(a), c any)
>> RETURNS same_type_as(c)[]
>> AS $$
>> ...
>> $$;
>>
>> or the same using positional arguments
>>
>> CREATE FUNCTION foo(a any, b same_type_as(1), c any)
>> RETURNS same_type_as(3)[]
>> AS $$
>> ...
>> $$;
>>
>> this then gets transformed at parse time to whatever internal
>> representation of type sameness we use.
>>
>> --
>> Hannu Krosing http://www.2ndQuadrant.com
>> PostgreSQL Scalability and Availability
>> Services, Consulting and Training
>>
>>
>>
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2009-09-10 11:08:55 | Re: Ragged CSV import |
Previous Message | Peter Eisentraut | 2009-09-10 10:43:38 | Re: RfD: more powerful "any" types |