Re: Implicit casts with generic arrays - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Implicit casts with generic arrays
Date
Msg-id 29012.1172602246@sss.pgh.pa.us
Whole thread Raw
In response to Implicit casts with generic arrays  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Implicit casts with generic arrays  (Peter Eisentraut <peter_e@gmx.net>)
Re: Implicit casts with generic arrays  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> I've looked into cutting back on the implicit casts to text, which 
> exposed the following little gem.

> The expressions
> 'abc' || 34
> 34 || 'abc'
> would no longer work, with the following error message:
> ERROR:  22P02: array value must start with "{" or dimension information

Hm, that's annoying.  Not that the expressions fail --- we want them to
--- but that the error message is so unhelpful.

Since ANYARRAY is already special to the type system, I don't have a
problem with inserting some special case to prevent this, but I'm not
sure what the special case should be.  Is it too klugy to say "don't
implicitly cast unknown to anyarray unless the literal's value starts
with { or ["?  We've never made casting decisions depend on the contents
of strings before, and I'm really loath to make 'em do so now.

Seems basically we'd want to not cast unknown to anyarray unless there
is some additional bit of context suggesting that that's the right thing.
But what should that extra requirement be?  Can we go as far as not
doing this cast implicitly at all?
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Simon Riggs"
Date:
Subject: Re: COMMIT NOWAIT Performance Option
Next
From: Kris Jurka
Date:
Subject: Re: 7.x horology regression test on Solaris buildfarm machines