Thread: Extending PostGreSQL/PostGIS with an abstract data type.

Extending PostGreSQL/PostGIS with an abstract data type.

From
donia zheni
Date:
Dear all,

I have a question concerning "an extension of Postresql/PostGIS with a spatio-temporal Abstract data type".

PostgreSQL have many types categories : base types, composite types, domains, etc...

I would like to extend PostGIS type system with a new abstract data type.

This means that i must guaranty encapsulation of attributes : which means normally any user of a the DBMS may use the new type through it's operations and can not select over the types attributes (like geometry, line or point types)

My question is : can this abstract data type be simply a compsite type (created whith CREATE TYPE and defined with plpgSQL) or must it be a base type (thus created inevitabely with a low level langage like C with typedef )?

When i tried with a composite type, i could select over my type attributes! and it's not an abstract data type any more!

And if it's defined with "typedef", must all operations be defined also in C or can some functions be defined with plpgsql?

Thank you for you collaboration

Donia

Re: Extending PostGreSQL/PostGIS with an abstract data type.

From
Craig Ringer
Date:
donia zheni wrote:

> And if it's defined with "typedef", must all operations be defined also
> in C or can some functions be defined with plpgsql?

If you want a new data type that's only accessible using functions and
operators defined to operate on it, you must write it in C.

If you wanted to use PL/PgSQL to implement some operators, you'd have to
expose innards of the data type at the SQL level. Since you explicitly
do not want to do this, you cannot use PL/PgSQL.

--
Craig Ringer