Re: Non-atomic structures instead of arrays

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Non-atomic structures instead of arrays
Дата
Msg-id web-151245@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на Non-atomic structures instead of arrays  ("Michael D. Klatt" <mdklatt@ou.edu>)
Список pgsql-novice
Michael,

> The documentation implies that you can have a non-atomic field other
> than a
> simple array, perhaps something like a C structure of different
> types.  Is
> this possible, and if so, how?

First off, you need to evaluate your reasons for wanting an non-atomic
field.  As you may know, non-atomic fields violate relational integrity
and lead to development, maintainence, and normalization problems.
Also, it is nearly impossible to index them effectively, resulting in
poor performance.

Frankly, I have yet to hear a case for a custom non-atomic field that
was not better solved by seperating the data in to several fields of
different datatypes.

That being said, the way you create a non-atomic field is by creating a
custom data type.  This is no simple task.  See:

http://www.postgresql.org/idocs/index.php?sql-createtype.html

Please note that you will have to write functions for input, display,
and transmission of this custom data type, as well as manually defining
any operators (+, ||, etc.) that you want to use with the custom data
type.

-Josh Berkus



______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco

В списке pgsql-novice по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Problem with createdb & case (7.1.3)
Следующее
От: "Brett W. McCoy"
Дата:
Сообщение: Re: Connect to pg via tcpip