Beginner's questions about creating a custom data type in PostgreSQL...

From: "Redefined Horizons" <redefined(dot)horizons(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Beginner's questions about creating a custom data type in PostgreSQL...
Date: 2006-07-24 20:49:50
Message-ID: e24752a10607241349q70104acoc341494d3d5082bb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've got a few questions about creating custom data types for PostgreSQL.

I'm not sure how to phrase the questions without an example, so here goes:

I'd like to create a custom data type representing a Medieval Knight.
(This isn't what I really want to do, it's just an example.)

One of the "properties" of this Medieval Knight data type that you can
access through custom functions is "Combat Skill", which represents a
Knights fighting ability.

The Knight's fighting ability depends on two things. His horse, and
his sword. The custom functions that work with the Medieval Knight
data type know how to manipulate the properties of Horses and Swords
as well.

My Medieval Knight datatype "contains" a horse and sword. In the C
programming language implementation of my datatype I would like to
represent Swords and Horses with seperate structs, rather than
throwing everything together into a single Medieval Knight struct.

Is it possible to define the Sword and Horse structs in the same DLL
that I define my Knight struct in, but not have Swords and Horses
available as custom data types themselves?

I want to have 3 separate structs for programming simplicity, but I
want to embody them in a single custom data type and set of custom
functions for PostgreSQL.

Is this possible?

Thanks,

Scott Huey

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-07-24 20:54:24 Re: gmake Errors: pg_backup_archiver.c: undefined reference to `lo_create'
Previous Message Tom Lane 2006-07-24 19:19:22 Re: gmake Errors: pg_backup_archiver.c: undefined reference to `lo_create'