Re: Number of dimensions of an array parameter - Mailing list pgsql-hackers

From Thomas Hallgren
Subject Re: Number of dimensions of an array parameter
Date
Msg-id 445FA176.8040102@tada.se
Whole thread Raw
In response to Re: Number of dimensions of an array parameter  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Thomas Hallgren <thomas@tada.se> writes:
>   
>> 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.
>>     
>
> The fact that it doesn't exactly match Java semantics does not make it
> "legacy behavior".  I don't agree that it's a bug; I think it's a
> feature, precisely because many functions can work on arrays of
> different dimensions.  Why should we change to make PL/Java happier,
> when it will move us further away from the semantics of, say, PL/R?
>
>   
Would it really? The way I see it, the choice of language is irrelevant. 
Either you support dimensions or you don't. The way PostgreSQL does it, 
you get the impression that it is supported while in fact it's not. I 
can't see how anyone would consider that a feature. If you want the 
ability to use an arbitrary number of dimensions, then you should have a 
syntax that supports that particular use-case. An int[][] cannot be 
anything but a two dimensional int array. Not in my book anyway. That 
opinion has nothing to do with Java.

> I think reasonable choices for PL/Java would be to reject
> multidimensional array arguments, or to silently ignore the
> dimensionality and treat the data as 1-D in storage order
> (as I think plperl for instance already does).
>
>   
I agree. That's the way I'll do it.

Regards,
Thomas Hallgren



pgsql-hackers by date:

Previous
From: "Magnus Hagander"
Date:
Subject: Re: Pragma linking?
Next
From: Thomas Hallgren
Date:
Subject: Re: Number of dimensions of an array parameter