Re: Number of dimensions of an array parameter

From: Thomas Hallgren <thomas(at)tada(dot)se>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Number of dimensions of an array parameter
Date: 2006-05-08 20:06:18
Message-ID: 445FA4BA.2010203@tada.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Martijn van Oosterhout wrote:
> On Mon, May 08, 2006 at 07:31:14PM +0200, Thomas Hallgren wrote:
>
>> Would it be hard to enforce a real check? The implementation could use
>> GUC settings like 'enforce_array_dimensions' and 'enforce_array_lengths'
>> that could be set to false for the legacy implementations that rely on
>> the current behavior. I know Tom added the ability to have NULL values
>> in the arrays. Perhaps now is the time to improve the type semantics as
>> well?
>>
>
> The big probem is where do you store the number of declared dimensions?
> It's not stored anywhere, so there's nowhere to check against either.
> If we can fix that first we might get to the checking part.
>
> test=# create function foo(int[][]) returns int4 as 'select 1' language sql;
> CREATE FUNCTION
> test=# \df foo
> List of functions
> Result data type | Schema | Name | Argument data types
> ------------------+--------+------+---------------------
> integer | public | foo | integer[]
> (1 row)
>
>
Let each type have it's own entry in pg_type. I.e. let the int[] and
int[][] be two distinct types (like int and int[] already are). In
addition, perhaps introduce a new syntax that denotes 'arbitrary number
of dimensions' and let that too be a distinct type.

Regards,
Thomas Hallgren

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-05-08 20:08:40 Re: performance question (something to do w/ parameterized
Previous Message Tom Lane 2006-05-08 19:58:29 Re: intarray internals