Re: plpgsql arrays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 3, 2009 at 11:15 AM, Matthew Wakeling <matthew@xxxxxxxxxxx> wrote:
> On Fri, 3 Apr 2009, Merlin Moncure wrote:
>>
>> select array(SELECT location FROM location, gene WHERE
>> location.subjectid = gene.id ORDER BY objectid, intermine_start,
>> intermine_end)) into genes;
>
> Yeah, that works nicely.
>
>> this will make array of location records.  when you access the records
>> to do the merge, make sure to use () noation:
>>
>> if (genes[x]).field > something then
>
> How is that different to genes[x].field?

ah, it isn't...in many cases where you access composite type fields,
() is required (especially in query).  it isn't here, so you can
safely leave it off.

merlin

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux