Re: Methods in pgsql - Mailing list pgsql-general

From Tom Lane
Subject Re: Methods in pgsql
Date
Msg-id 2028.970262072@sss.pgh.pa.us
Whole thread Raw
In response to Methods in pgsql  ("Efrain Caro" <betsemes@hotmail.com>)
List pgsql-general
"Efrain Caro" <betsemes@hotmail.com> writes:
> I've read somewhere that PostgreSQL is an ordbms or a oodbms. After reading
> Bruce Momjian's book "PostgreSQL: Introduction and Concepts" it's apparent
> to me that the only feature that seems to be an object oriented one is table
> inheritance. I didn't see a method implementation anywhere in the
> book.

You could get some of that effect with triggers associated with
particular child tables.  SQL92 doesn't really have any notion of
computation associated with a table, as opposed to computation
associated with rows being put into or taken out of a table,
so there's not a lot of scope for true methods associated with a
table viewed as an object.  But you could use triggers to vary
what happens when you store or update rows in different tables.

Note also that there's a pretty complete abstract-data-type facility
for the data values being kept in tables.  If the objects you want
to deal with are more along the lines of items in tables instead of
tables themselves, there's plenty of room to define a collection of
datatypes that have method-ish behavior.  I'm not sure you could claim
that Postgres "supports" that, since it doesn't offer a handy notation
or anything, but it doesn't get in the way either.

            regards, tom lane

pgsql-general by date:

Previous
From: "Steve Quezadas"
Date:
Subject: Dropping a field from a table.
Next
From: Stephan Szabo
Date:
Subject: RE: sql/trigger question...arguments?