Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 8399A6322C7 for ; Fri, 3 Apr 2009 12:18:36 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 84451-08 for ; Fri, 3 Apr 2009 12:18:35 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.188]) by mail.postgresql.org (Postfix) with ESMTP id F2E76632223 for ; Fri, 3 Apr 2009 12:18:34 -0300 (ADT) Received: by fk-out-0910.google.com with SMTP id e30so561311fke.3 for ; Fri, 03 Apr 2009 08:18:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=PIQH1RHnqYVZ2Jocu+7LAlSCdvJq/vPy/kTZCEBttiM=; b=K5zUC8I0ExXJOF9oZPBN495OAwdfPjJK06uZEIuVGur6Kh2ww6qi2AhQDpuwdWnFkT w0jV/p72QMUuK0gCNdiqQ6K7TdlpV6L5CFGkviZ5u7w5kr0ywdyCcUUH2zN+L52dpY8L hB8Zp9QcgJqvuNjkQClLx/jnWT0zMTLMg/b6o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=u+iAzHRaGGWv/qW/F9jZjQwh7vAcajZPwd9xoJ8DosVvr/BnO9Vc/wyM2rgpOj+xWf DXYvhYnFMOmwbgGllBAV+rnrqV+sgM34aC+Rv9AguRIdzG9ME5vfFVk9zpuBL+C/2YSW v6Ex1lewFHjRb5bdti0NKNK0tOWJNG2vVOZo4= MIME-Version: 1.0 Received: by 10.103.189.15 with SMTP id r15mr626436mup.126.1238771913602; Fri, 03 Apr 2009 08:18:33 -0700 (PDT) In-Reply-To: References: Date: Fri, 3 Apr 2009 11:18:33 -0400 Message-ID: Subject: Re: plpgsql arrays From: Merlin Moncure To: Matthew Wakeling Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200904/74 X-Sequence-Number: 33441 On Fri, Apr 3, 2009 at 11:15 AM, Matthew Wakeling wro= te: > On Fri, 3 Apr 2009, Merlin Moncure wrote: >> >> select array(SELECT location FROM location, gene WHERE >> location.subjectid =3D gene.id ORDER BY objectid, intermine_start, >> intermine_end)) into genes; > > Yeah, that works nicely. > >> this will make array of location records. =A0when 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