pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Merlin Moncure <mmoncure@gmail.com>
To: Matthew Wakeling <matthew@flymine.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: plpgsql arrays
Date: Fri, 3 Apr 2009 11:18:33 -0400
Message-ID: <b42b73150904030818y448b72bdl8892e3839fd23955@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.0904031614490.21772@aragorn.flymine.org>
References: <alpine.DEB.2.00.0904031420470.21772@aragorn.flymine.org>
	<b42b73150904030802q1b3685br8db7740569e31aea@mail.gmail.com>
	<b42b73150904030809u57e0f259i7d0c428a28b0988d@mail.gmail.com>
	<alpine.DEB.2.00.0904031614490.21772@aragorn.flymine.org>

On Fri, Apr 3, 2009 at 11:15 AM, Matthew Wakeling <matthew@flymine.org> 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



view thread (32+ messages)  latest in thread

Message-ID: <b42b73150904030818y448b72bdl8892e3839fd23955@mail.gmail.com>
Permalink:  ../b42b73150904030818y448b72bdl8892e3839fd23955@mail.gmail.com/
Also on:    postgresql.org/message-id/b42b73150904030818y448b72bdl8892e3839fd23955@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: mmoncure@gmail.com, matthew@flymine.org
  Subject: Re: plpgsql arrays
  In-Reply-To: <b42b73150904030818y448b72bdl8892e3839fd23955@mail.gmail.com>
  References: <alpine.DEB.2.00.0904031420470.21772@aragorn.flymine.org> <b42b73150904030802q1b3685br8db7740569e31aea@mail.gmail.com> <b42b73150904030809u57e0f259i7d0c428a28b0988d@mail.gmail.com> <alpine.DEB.2.00.0904031614490.21772@aragorn.flymine.org> <b42b73150904030818y448b72bdl8892e3839fd23955@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox