Re: Storing Pairs? - Mailing list pgsql-general

From Tom Lane
Subject Re: Storing Pairs?
Date
Msg-id 27113.958404053@sss.pgh.pa.us
Whole thread Raw
List pgsql-general
Charles Tassell <ctassell@isn.net> writes:
>    In a project I'm working on at the moment, I want to store multiple
> pieces of information about an item, and I'm looking for a good way to
> structure my tables.  The items will have a variable number of descriptive
> attributes (ie, size, color, logo) so I was thinking of using arrays, but I
> don't think I can get the select options to work the way I want.

No, probably not --- and even if there were an "array search" kind of
operator, we don't have any indexes that would help.  Use a variable
number of rows per entry, instead, with
    item_name    text
    op_type        int4
    op_value    int4
(or use an int4 key for the item, and store the name just once in a
different table...)

            regards, tom lane

pgsql-general by date:

Previous
From: Janovszki Levente
Date:
Subject: Re: CREATE FUNCTION problem
Next
From: Jeff Hoffmann
Date:
Subject: Re: rtree indexes aren't being used with 7.0