Re: Non-atomic structures instead of arrays

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "mdklatt(at)ou(dot)edu" <mdklatt(at)ou(dot)edu>, "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Non-atomic structures instead of arrays
Date: 2001-10-19 19:14:50
Message-ID: web-151245@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Brett W. McCoy 2001-10-19 20:32:28 Re: Connect to pg via tcpip
Previous Message Tom Lane 2001-10-19 17:34:47 Re: Problem with createdb & case (7.1.3)