Re: RfD: more powerful "any" types - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: RfD: more powerful "any" types
Date
Msg-id 1252566517.4307.12.camel@hvost1700
Whole thread Raw
In response to Re: RfD: more powerful "any" types  (Hannu Krosing <hannu@2ndQuadrant.com>)
Responses Re: RfD: more powerful "any" types
List pgsql-hackers
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 


> 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
> 
> 
> 



pgsql-hackers by date:

Previous
From: Andrew Chernow
Date:
Subject: Re: new version of PQconnectdb was:(Re: [HACKERS] Determining client_encoding from client locale)
Next
From: Itagaki Takahiro
Date:
Subject: logging hook for database audit