in reply to DBD::Pg INSERT enlightenment

I agree that repson has it right, if using a relational database, take advantage of it's strengths and create a second table for the many in your one->many relationship. Then you can take advantage of foreign key restraints which can help keep some rogue code from messing with the relationships, adding descriptions to prod_id's that don't already exist in the parent table.

Another simpler option is to remove the unique restraints on Prod_id and just add multiple rows to the table. you'll get the same data back from a select on prod_id as you would using a join. the downside is space... if that is an issue, then use the two table approach.

so Postgress has an "array" type?

Replies are listed 'Best First'.
Re: DBD::Pg INSERT enlightenment
by penguinfuz (Pilgrim) on Feb 08, 2001 at 08:15 UTC

    > take advantage of it's strengths and create a second table...

    Actually, this IS the second table. 8)
    The first table consist of an inventory_id, product_id, and quantity.

    > Another simpler option is to remove the unique restraints on Prod_id and just add multiple rows to the table...

    Unfortunately I cannot add many rows to the second table as I have MANY entries to INSERT.

    > so Postgress has an "array" type?

    Yes, just create a column as *usual* but use quare-brackets to specify the dimensions of the array.

    Since the only mention of perl on this last posting came from THIS sentence, I think I'll stop.
    Thanks everyone for the ideas. 8)