Re: [HACKERS] Number of dimensions of an array parameter

2006-05-09 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian writes: > > Documentation updated to mention "dimmensions" are not enforced. > > This patch seems entirely pointless, since the point is already made > (with correct spelling even) in the very next line. Thanks, reverted. -- Bruce Momjian http://candle.pha.p

Re: [HACKERS] Number of dimensions of an array parameter

2006-05-09 Thread Tom Lane
Bruce Momjian writes: > Documentation updated to mention "dimmensions" are not enforced. This patch seems entirely pointless, since the point is already made (with correct spelling even) in the very next line. regards, tom lane ---(end of broadcas

Re: [HACKERS] Number of dimensions of an array parameter

2006-05-09 Thread Bruce Momjian
Documentation updated to mention "dimmensions" are not enforced. --- Stefan Kaltenbrunner wrote: > Thomas Hallgren wrote: > > I can create a function that takes a two dimension int array: > > > > CREATE FUNCTION twodims(in

Re: [HACKERS] Number of dimensions of an array parameter

2006-05-08 Thread Thomas Hallgren
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 implementat

Re: [HACKERS] Number of dimensions of an array parameter

2006-05-08 Thread Thomas Hallgren
Tom Lane wrote: Thomas Hallgren <[EMAIL PROTECTED]> 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 beha

Re: [HACKERS] Number of dimensions of an array parameter

2006-05-08 Thread Tom Lane
Thomas Hallgren <[EMAIL PROTECTED]> 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 fa

Re: [HACKERS] Number of dimensions of an array parameter

2006-05-08 Thread Martijn van Oosterhout
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 curr

Re: [HACKERS] Number of dimensions of an array parameter

2006-05-08 Thread Rod Taylor
> thhal=# CREATE DOMAIN twodims as int[][]; > CREATE DOMAIN While still not perfect, you can use a CHECK constraint on the domain to enforce dimension. It's not perfect because domain constraints are not enforced in all locations in versions earlier than 8.2. Adding extra explicit casts can often

Re: [HACKERS] Number of dimensions of an array parameter

2006-05-08 Thread Stefan Kaltenbrunner
Thomas Hallgren wrote: > I can create a function that takes a two dimension int array: > > CREATE FUNCTION twodims(int[][]) RETURNS void AS ... > > but there's nothing stopping me from calling this function with an > arbitrary number of dimensions on the array. > > I'd like to map a parameter l

Re: [HACKERS] Number of dimensions of an array parameter

2006-05-08 Thread Thomas Hallgren
Stefan Kaltenbrunner wrote: while it would be nice to improve that - it is actually documented quite clearly. http://www.postgresql.org/docs/current/static/arrays.html has: "However, the current implementation does not enforce the array size limits — the behavior is the same as for arrays of un

Re: [HACKERS] Number of dimensions of an array parameter

2006-05-08 Thread Tom Lane
Thomas Hallgren <[EMAIL PROTECTED]> writes: > Only allow arrays with one dimension unless the parameter is of a domain > type (domains are apparently stored with the actual number of > dimensions). No, they don't enforce dimensionality any more than ordinary array columns do. typndims and attnd

[HACKERS] Number of dimensions of an array parameter

2006-05-08 Thread Thomas Hallgren
I can create a function that takes a two dimension int array: CREATE FUNCTION twodims(int[][]) RETURNS void AS ... but there's nothing stopping me from calling this function with an arbitrary number of dimensions on the array. I'd like to map a parameter like the one above to a corresponding