Re: Missing array support

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Missing array support
Дата
Msg-id 3EFD1931.1090204@joeconway.com
обсуждение исходный текст
Ответ на Re: Missing array support  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane wrote:
> Joe Conway <mail@joeconway.com> 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Missing array support
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Assembler error