Tom Lane wrote:
Joe Conway <[EMAIL PROTECTED]> writes:
So array[] should produce '{}' of (an array) type determined by the context? OK -- seems easy enough.

Is it?  I think we'd decided that this could only reasonably be handled
by creating a datatype representing array-of-UNKNOWN.  I'm afraid to do
that because I think it might allow the parser's type resolution
algorithms to follow paths we will not like.  Perhaps it can be made to
work, but I think it will require some careful study.


But see the spec wording:
1) The declared type DT of an <empty specification> ES is ET ARRAY[0], where the element type ET is determined by the context in which ES appears. ES is effectively replaced by CAST ( ES AS DT ).
NOTE 69 – In every such context, ES is uniquely associated with some expression or site of declared type DT, which thereby becomes the declared type of ES.


I took that to mean that this sould only work in contexts where the data type is known.

Come to think of it, I guess in most cases of ARRAY[elem1,elem2,elem3] we derive the data type using the elements in the array expression, so in practice there may be few places where this would work. We should be able to come up with a data type for inserts and updates though, shouldn't we?

Joe


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

http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to