From: floyds@4peakstech.com
To: Pgsql-Sql <pgsql-sql@postgresql.org>
Subject: composite type in a table
Date: Fri, 22 Aug 2003 14:32:27 -0500
Message-ID: <NDBBKEGJICMIMJHJEBCOEECPGNAA.floyds@4peakstech.com> (raw)
is there any way to use a composite type in a table?
here's an example:
say i want to create a type to hold currency:
create type currency_type as ( base_objid int, base_amt decimal,
conversion_rate decimal, converted_objid int );
i'd like to be able to define a column in a table of type currency_type:
create table currency_table ( myMoney currency_type );
unfortunately, i get:
ERROR: Attribute "mymoney" has composite type currency_type
it sure would be nice if it was as simple as this, but it isn't. what's the
easiest way to create a composite-like type that can be added to a table?
also, how does one access the internal fields of a composite type?
Regards,
Floyd Shackelford
VOICE: 334.735.9428
FAX: 702.995.6462
EMAIL: floyd@fwshackelford.com
ICQ #: 161371538
PGP Key ID: 0x2E84F2F2
PGP Fone at private.fwshackelford.com on request
Shackelford Motto: ACTA NON VERBA - Actions, not words
Alabama State Motto: AUDEMUS JURA NOSTRA DEFENDERE - We Dare Defend Our
Rights
The Philosophy of Liberty: http://www.isil.org/resources/introduction.swf
"Just because you do not take an interest in politics doesn't mean politics
won't take an interest in you."
-- Pericles (430 B.C.)
"I cannot undertake to lay my finger on that article of the Constitution
which granted a right to Congress of expending, on objects of benevolence,
the money of their constituents...."
--James Madison
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: floyds@4peakstech.com
Subject: Re: composite type in a table
In-Reply-To: <NDBBKEGJICMIMJHJEBCOEECPGNAA.floyds@4peakstech.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox