newbie needs help with postgres internal tables

From: William WAISSE <wwaisse(at)esprit-equipe(dot)fr>
To: pgsql-general(at)postgresql(dot)org
Subject: newbie needs help with postgres internal tables
Date: 2001-11-23 22:42:59
Message-ID: 200111231638.fANGcYU76828@smtp4.cluster.oleane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, everybody.

This is my first post on this list and I hope It's the good place for my
question.

I'm developping an Opensource projetc which aims to be a GTK
frontend for Postgresql first ( and other DB later ), whose name will be
GPF ( GPF is not a Postgresql Frontend ).

So I need to use mysef tables like pg_class, pg_attribute, pgdatabase.

By now, I need two things :

1- Find all the fields that belongs to a particular table.

It was difficult to find the good fiels but I found this query, which seems
to be good for me.

select attname
from pg_attribute a
where a.attnum>0
and
a.attrelid= ( select oid
from pg_class c
where c.relname='gpf_db') ;

( 'gpf_db' is the name of the database I'm searching all the fattributes )
( Is ther a better way to do this )

does a documentation exists concerning postgres internals, which I
havren't found, and which would say something like
"the relation between pg_class and pg_attribute is the field
oid in in pg_class which is the same as the field attrelid in pg_attribute"
"attnum in pg_attribute is >0 for 'user' fields and <0 for internal fields"
. . .

( In fact I would need a map of all the relations between all the internal
tables in postgres ;- ))

1- Find all the tables that belong to a particular database.

I have not been able to find an ID in pg_table or pg_class which
would help me finding all the tables that belong to a particular database.
the only thing I could do is selecting on the field tableowner
BUT
a user can have more than one database and all the tables of all the
databases owned by this user will have the same tableowner.

PS : sorry if my english is not always the best, I'm French ;-)

--
cordialement, William WAISSE fpr = 9CCD 7DA2 7050 8805 F471 03D1 DF76 B78C
690B 4E07
--
Computers are like air conditionners. They work better when you close windows.
--
Visitez donc mon site perso (version 0.4 du 29/05/2001) :
http://www.neofutur.net
--
Vous habitez dans l'Essonne et vous aimez les Pingouins ???
visitez donc la GAULE(=LUG91) : http://www.gaule.org
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/E/MU d- s: a- C++++ UL+++ P+ L++++ E--- W++ N o-- K- w---
O- M- V- PS+ PE-- Y++ PGP++ t+ 5 X++ R++ tv- b+++ DI- D G e++ h* r++ y+++
------END GEEK CODE BLOCK------

Responses

Browse pgsql-general by date

  From Date Subject
Next Message William WAISSE 2001-11-23 23:56:01 Re: newbie needs help with postgres internal tables
Previous Message Tom Lane 2001-11-23 20:13:12 Re: enable_nestloop