On Nov 30, 2007 9:09 PM, Gregory Stark <stark@enterprisedb.com> wrote:
> I'm sorry to suggest anything at this point, but... would it be less invasive
> if instead of requiring the immediate cast you created a special case in the
> array code to allow a placeholder object for "empty array of unknown type".
> The only operation which would be allowed on it would be to cast it to some
> specific array type.
>
> That way things like
>
> UPDATE foo SET col = array[];
> INSERT INTO foo (col) VALUES (array[]);
>
> could be allowed if they could be contrived to introduce an assignment cast.
Hi Gregory.
Not sure it would be less invasive, but I do like the outcome of being
able to create an empty array pending assignment. In addition to your
examples, it might also make it possible to do things like this in
plpgsql
DECLARE
a text[] := array[];
Whereas my patch requires you to write
a text[]: =array[]::text[];
... which seems pretty stupid.
So, I like your idea a lot from a usability point of view. But I
really, really hate it from a "just spent half a week on this patch"
point of view =/
Any suggestions about how you would enforce the "only allow casts to
array types" restriction on the empty array?
Cheers
BJ