[SQL] plpgsql loop question

2010-02-10 Thread Andrea Visinoni
hi, i have a table called "zones": idzone, zone_name and several tables called zonename_records (same structure), where zonename is one of the zone_name in the "zones" table. What i want to do is a function that union all of this tables dinamically based on "zones" table, this is what i've done

Re: [SQL] plpgsql loop question

2010-02-10 Thread Justin Graf
On 2/10/2010 11:29 AM, Andrea Visinoni wrote: > hi, > i have a table called "zones": idzone, zone_name > and several tables called zonename_records (same structure), where > zonename is one of the zone_name in the "zones" table. > What i want to do is a function that union all of this tables > di

Re: [SQL] 'image' table with relationships to different objects

2010-02-10 Thread Louis-David Mitterrand
On Tue, Feb 09, 2010 at 08:01:35AM -0700, Rob Sargent wrote: > You can also invert this, making all the image owner share a common base > table and then images are dependent on that base > > base (id, type) where type is an enumeration or some such > person (id, name, etc) where id is FK to base i

Re: [SQL] 'image' table with relationships to different objects

2010-02-10 Thread Justin Graf
On 2/9/2010 6:59 AM, Richard Huxton wrote: > On 09/02/10 07:49, Louis-David Mitterrand wrote: >> Hello, >> >> In my database I have different object types (person, location, event, >> etc.) all of which can have several images attached. >> >> What is the best way to manage a single 'image' table wi

Re: [SQL] plpgsql loop question

2010-02-10 Thread Adrian Klaver
On 02/10/2010 08:29 AM, Andrea Visinoni wrote: hi, i have a table called "zones": idzone, zone_name and several tables called zonename_records (same structure), where zonename is one of the zone_name in the "zones" table. What i want to do is a function that union all of this tables dinamically b