newbie needs help with postgres internal tables - Mailing list pgsql-general

From William WAISSE
Subject newbie needs help with postgres internal tables
Date
Msg-id 200111231638.fANGcYU76828@smtp4.cluster.oleane.net
Whole thread Raw
Responses Re: newbie needs help with postgres internal tables
List 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------

pgsql-general by date:

Previous
From: Antonio Fiol Bonnín
Date:
Subject: Re: Odd query behavior...
Next
From: Tom Lane
Date:
Subject: Re: Migrating from MSSql...