Beginner's questions about creating a custom data type in PostgreSQL...
От | Redefined Horizons |
---|---|
Тема | Beginner's questions about creating a custom data type in PostgreSQL... |
Дата | |
Msg-id | e24752a10607241349q70104acoc341494d3d5082bb@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Beginner's questions about creating a custom data type in PostgreSQL...
|
Список | 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
В списке pgsql-general по дате отправления: