Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TJ2vP-00064K-IR for pgsql-sql@postgresql.org; Tue, 02 Oct 2012 13:54:15 +0000 Received: from smtp106.prem.mail.ac4.yahoo.com ([76.13.13.45]) by magus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TJ2vI-0002uM-Vz for pgsql-sql@postgresql.org; Tue, 02 Oct 2012 13:54:15 +0000 Received: (qmail 38012 invoked from network); 2 Oct 2012 13:54:07 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=DKIM-Signature:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:References:In-Reply-To:Subject:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Mailer:Thread-Index:Content-Language; b=ZRKrXbUH6vSGOVg3VIQVHvrYw3BdCAgJr0UgiK9RR2x2gym2KrB3CqJ+lznqkTz/ToNQGIdLATw908RFhr79/Fxei9aP7r0nXzo5qNHGwZ6M4HaOfeKFKGqF5MTWKBxkuH+UCLAw5yKRNptdgCYu9cVGKWPCy8loCCVQfokmqaE= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1349186047; bh=mL9uhAqHiG/hi2PdAvV5CldfNpwPAXC1oD4uVMwvLoQ=; h=X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:References:In-Reply-To:Subject:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Mailer:Thread-Index:Content-Language; b=pZHqLTcM86zXlDPq6l2SiU69rwnjBk6E5xX/KnpvuVfiR8Tl2eEAnAur4luCK2Xxv9WyqhkbZi1oEni00+96/HQkpvKmvb1W7vDPyXjXpXXJ2Y/fWAOK5inKwRJD/CurQgwGVxx2WwjrEn2xWs2k77MdNYyPPlCkSl1prKjpvDg= X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: eJAbQ4YVM1naBpKHPUccDkGX6EQfD4gMjFMFmzvyL2BpRfn YcQttk8vT24CMaPa55Z_G_2O.x0ug6fr5umriyPh3_fLkhcToODXXBnIbY71 tDL1SszTGkaWf_09_Lm8S5P2r_WDaClJjG1eN8el9LnZ8DqZxSpKclavZAUp MTzMzOdVAilGUKMX9wVycgcwPRNXKf0pEQsxJxWXuChWfTMkT5bvvKISpSfy ymzaUW5mg1Qgh84uVVekwr8ys4UILwP84AmGuAemdI2LLVnmzZh5jih3ZRVj mvlCBbIdKyW_Q1j_VQ2.2_TDe_i6g5Fqpz1QVo_xyxwWndgPyEm6El9WnjQJ 0UoWxrlVlUsZVg6ii10AZFXyD3LLHkwVjTFXdtjvccqxvgi.O3O90_76V4Yz DUo5EjOaLnzK1iLPoQd_ob10pgyjX42vXRIMzmLF4CgbT0QUZrcpwNwU2JMt Elodp X-Yahoo-SMTP: mpGJl6eswBD2IBufoVEg0Pa8gg-- Received: from WolfDog (polobo@24.93.23.188 with login) by smtp106.prem.mail.ac4.yahoo.com with SMTP; 02 Oct 2012 06:54:07 -0700 PDT From: "David Johnston" To: "'mephysto'" , References: <1348740741516-5725666.post@n5.nabble.com> In-Reply-To: <1348740741516-5725666.post@n5.nabble.com> Subject: Re: Help in accessing array Date: Tue, 2 Oct 2012 09:53:29 -0400 Message-ID: <00e901cda0a5$4de0d280$e9a27780$@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQMO8f1Sl8dnPp7UnpkdNrnlI8HX8pUjZdZg Content-Language: en-us X-Pg-Spam-Score: -4.1 (----) X-Archive-Number: 201210/12 X-Sequence-Number: 36883 > -----Original Message----- > From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql- > owner@postgresql.org] On Behalf Of mephysto > Sent: Thursday, September 27, 2012 6:12 AM > To: pgsql-sql@postgresql.org > Subject: [SQL] Help in accessing array > > Hi to everyone, > I have a little problem to retrieve data from multidimensional array. For > example, if I have this array > > foo[][] = {{5,3},{2,2}} > > how can I retrieve one of two internal array (for example I would to retrieve > {5,3}? > > I tried foo[1:1] but the result is {{5,3}}, not {5,3}. > > Is a method to achieve my goal? > > Thanks in advance. > > Mephysto IIRC You cannot de-dimension an array (aside from the special-case single dimension, 1 value, case). You will need to unnest the array into components, filter those components, then go from there. Each, "unnest(array)" call explodes one dimension. Consider wraping things in a function to make the code cleaner. David J.