Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Dimitri Fontaine Newsgroups: comp.databases.postgresql Subject: Re: Help with 2 table arrays Date: Wed, 21 May 2014 15:58:03 +0200 Organization: A noiseless patient Spider Lines: 19 Message-ID: References: <9c29ec52-a5cc-416a-a25a-699a4de140e9@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="6feae392e994322f1944011ca4c6e3fc"; logging-data="10126"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/yq+68k9lzV04p2VkAb6sb" User-Agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.4.50 (darwin) Cancel-Lock: sha1:I3YsBkDj1HYrF83wV4zQwTHS84Y= sha1:EW6/flz6Cd9UShqxjwONWvD9dwo= Xref: csiph.com comp.databases.postgresql:574 Tod writes: > I have two tables, with one containing items in an array. I want to display > the items in the array which correspond to the other table. Using an array as storage is a form of denormalisation of the schema. Did you try with a normalized schema first? What was the problem you did encounter with using a normalized schema? > So for the menu id 16, I want to show the names of the dishes 20, 25, 26, > etc ... in the output. See the unnest function, then join on its result. http://www.postgresql.org/docs/9.3/interactive/functions-array.html Regards, -- Dimitri Fontaine PostgreSQL DBA, Architecte