Re: Missing array support

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Missing array support
Date: 2003-06-28 04:27:29
Message-ID: 3EFD1931.1090204@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Joe Conway <mail(at)joeconway(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-06-28 04:41:38 Re: Assembler error
Previous Message Tom Lane 2003-06-28 04:10:53 Re: Missing array support

Browse pgsql-patches by date

  From Date Subject
Next Message Darko Prenosil 2003-06-28 09:52:24 Re: [webmaster] .pot files are unavailable (?)
Previous Message Tom Lane 2003-06-28 04:10:53 Re: Missing array support