From: Peter Eisentraut on
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

That's because the best matches are now respectively

anyarray || anyelement
anyelement || anyarray

Now either this is just too bad and users of a system with reduced casts
to text will have to live with this odd error message, or coercing any
old unknown constant to anyarray isn't such a good idea.

Comments?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

From: Tom Lane on
Peter Eisentraut <peter_e(a)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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

From: Peter Eisentraut on
Am Dienstag, 27. Februar 2007 19:50 schrieb Tom Lane:
> 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?

We could say that unknown is not taken as anyarray input if the entire
function/operator argument list consists of anyelement or anyarray. But that
might be even harder to comprehend. With the ARRAY[...] syntax available,
converting unknown to anyarray might be altogether unnecessary.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

 | 
Pages: 1
Prev: pg_proc without oid?
Next: xlogViewer / xlogdump