Re: Number of dimensions of an array parameter

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

Tom Lane wrote:
> Thomas Hallgren <thomas(at)tada(dot)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

In response to

Browse pgsql-hackers by date

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