Обсуждение: Re: Storing Pairs?

Поиск
Список
Период
Сортировка

Re: Storing Pairs?

От
Tom Lane
Дата:
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