Support for persistant objects in PostgreSQL?

Started by Suresh Triover 21 years ago6 messages
#1Suresh Tri
trisuresh@yahoo.co.in

Hi,

Can you have persistant objects in PostgreSQL? In
Oracle you can have create Object types. e.g
create type ADDRESS as object
(street_name VARCHAR2(30),
house_no NUMBER);
In Oracle you can even have references to these
objects from other tables.

Is persistant objects and references to these objects
supported in PostgreSQL? If so can anyone point me to
the documentation for these?

Thanks,
Suresh

___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com

#2Jeff
threshar@torgo.978.org
In reply to: Suresh Tri (#1)
Re: Support for persistant objects in PostgreSQL?

On Aug 2, 2004, at 2:08 AM, Suresh Tri wrote:

Hi,

Can you have persistant objects in PostgreSQL? In
Oracle you can have create Object types. e.g
create type ADDRESS as object
(street_name VARCHAR2(30),
house_no NUMBER);
In Oracle you can even have references to these
objects from other tables.

create type ADDRESS as (
street_name varchar(30),
house_no int
);

should be about the same.

You can write stored proc's to return setof address if you want.
Not sure if there are other things that make oracle objects special.

There is even support for creating your own truely unique type where
you need to write your inputter, outputter and comparison functions.
That can allow you to natively support some proprietary data format you
may have.

--
Jeff Trout <jeff@jefftrout.com>
http://www.jefftrout.com/
http://www.stuarthamm.net/

#3Josh Berkus
josh@agliodbs.com
In reply to: Jeff (#2)
Re: Support for persistant objects in PostgreSQL?

Suresh,

Is persistant objects and references to these objects
supported in PostgreSQL? If so can anyone point me to
the documentation for these?

These structures are usually known as "Composite Types", although they have a
different, less intuitive name in the SQL99 standard which escapes me at the
moment. "Persistant Objects" is an Oracle-ism which is why you're having
trouble finding help on it.

Currently 7.4 PostgreSQL 7.4 supports the creation of such types and use of
them in Functions and queries. However, using them as a table column will
not be supported until the next PostgreSQL version, coming soon.

I don't reccomend using them at any time, though ...

--
Josh Berkus
Aglio Database Solutions
San Francisco

#4Merlin Moncure
merlin.moncure@rcsonline.com
In reply to: Josh Berkus (#3)
Re: Support for persistant objects in PostgreSQL?

Josh Berkus wrote:

I don't reccomend using them at any time, though ...

Just curious: why not?

Merlin

#5Marc G. Fournier
scrappy@postgresql.org
In reply to: Josh Berkus (#3)
Re: Support for persistant objects in PostgreSQL?

On Mon, 2 Aug 2004, Josh Berkus wrote:

Suresh,

Is persistant objects and references to these objects
supported in PostgreSQL? If so can anyone point me to
the documentation for these?

These structures are usually known as "Composite Types", although they have a
different, less intuitive name in the SQL99 standard which escapes me at the
moment. "Persistant Objects" is an Oracle-ism which is why you're having
trouble finding help on it.

Currently 7.4 PostgreSQL 7.4 supports the creation of such types and use of
them in Functions and queries. However, using them as a table column will
not be supported until the next PostgreSQL version, coming soon.

Is this much different (and how?) then using inheritance? CREATE TABLE vs
CREATE TYPE ... but looking at the example he provided, that was my first
thought ...

----
Marc G. Fournier Hub.Org Networking Services (http://www.hub.org)
Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664

#6Josh Berkus
josh@agliodbs.com
In reply to: Merlin Moncure (#4)
Re: Support for persistant objects in PostgreSQL?

Merlin,

Just curious: why not?

Because it's non-atomic data, which violates normalization and makes
maintenance and data cleaning a royal pain. Also, you'd still need to write
your own operators to be able to do comparisons.

--
-Josh Berkus
Aglio Database Solutions
San Francisco