Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

pgsql-hackers by date

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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group