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
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match