Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] Object-oriented stuff and postgres

From: Chris Bitmead <chris(dot)bitmead(at)bigfoot(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Object-oriented stuff and postgres
Date: 1999-04-21 13:25:35
Message-ID: 371DD1CF.CD5D4A65@bigfoot.com (view raw or flat)
Thread:
Lists: pgsql-general
Umm. I need to know the type of the _object_, not the types of the
attributes contained therein.


José Soares wrote:
> 
> --retrieve column information...
> 
>         SELECT a.attnum, a.attname, t.typname, a.attlen,
>         a.atttypmod, a.attnotnull, a.atthasdef
>         FROM pg_class c, pg_attribute a, pg_type t
>         WHERE c.relname = 'comuni'
>             and a.attnum > 0
>             and a.attrelid = c.oid
>             and a.atttypid = t.oid
>           ORDER BY attnum ;
> attnum|attname       |typname|attlen|atttypmod|attnotnull|atthasdef
> ------+--------------+-------+------+---------+----------+---------
>      1|istat         |bpchar |    -1|       10|t         |f
>      2|nome          |bpchar |    -1|       54|t         |f
>      3|provincia     |bpchar |    -1|        6|f         |f
>      4|codice_fiscale|bpchar |    -1|        8|f         |f
>      5|cap           |bpchar |    -1|        9|f         |f
>      6|regione       |bpchar |    -1|        7|f         |f
>      7|distretto     |bpchar |    -1|        8|f         |f
> (7 rows)
> 
> 
> José
> 
> Chris Bitmead ha scritto:
> 
> > What's the best way to do this in postgres? (basicly finding the
> > type of
> > objects).
> >
> > I want to run a web site with different types of content - question
> > and
> > answers, stories etc. I propose an object hierarchy...
> > webobject (title, body)
> >    question inherits webobject
> >    story (image) inherits (webobject).
> >
> > The idea being you could have a search screen that searches
> > questions
> > AND stories with the one SELECT query.
> >
> > But then each result would have a link to examine the body of the
> > search
> > result. But different types of objects would have different URLs to
> > display that content.
> >
> > So basicly I need to know the type of objects returned.
> >
> > I am loath to store the object type inside the object because it is
> > wasteful. PG obviously already knows the type of objects, the
> > question
> > is how to get at that info.

-- 
Chris Bitmead
http://www.bigfoot.com/~chris.bitmead
mailto:chris(dot)bitmead(at)bigfoot(dot)com

In response to

pgsql-general by date

Next:From: Louis Zirkel IIIDate: 1999-04-21 21:32:24
Subject: FAQ
Previous:From: José SoaresDate: 1999-04-21 12:42:03
Subject: Re: [GENERAL] Object-oriented stuff and postgres

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group