Обсуждение: Prog to generate table structure ...

Поиск
Список
Период
Сортировка

Prog to generate table structure ...

От
Marzullo Laurent
Дата:
Hello,

is there a prog to generate  C file describing table structure
of a database.

(Something like dclgen under Ingres...)

If not, I would like to know how to get information about
type of each row of a table to write this kind of prog.
(i.e. Where is this explain ?)

--
+----------------------------------+
| Marzullo Laurent                 |
| Analyste-programmeur             |
| SEMA-GROUP Belgium S.A.          |
| Tél: (32) 2 333 52 43            |
| e-mail: Laurent.Marzullo@sema.be |
+----------------------------------+

Re: [GENERAL] Prog to generate table structure ...

От
Stuart Rison
Дата:
don't know about any facilities to generate C files describing table
structure.

As to obtaining that information, I would say it is all in system catalog
tables (i.e. the tables that start with pg_ and which can be listed with
\dS in psql).

These are the tables that are queried when you use such psql commands as
\dt, \di or \d *.

There is information on these tables (along with an ER diagram ) in the PG
manuals.

try http://www.postgresql.org/docs/postgres/extend15617.htm

also, in my verison of PG (v.6.4.0) there is a file in the source code that
gives good examples of queries exploiting system catalogues.

It can be found at <postgresql-src-dir>/src/tutorial/syscat.source.

I don't know where/if that file exists in PG 6.5.* but I would guess in a
similar place.

let me know if you can't find it and I'll send you a copy if you want.

bonne chance,

S.

At 12:45 pm +0200 31/8/99, Marzullo Laurent wrote:
>Hello,
>
>is there a prog to generate  C file describing table structure
>of a database.
>
>(Something like dclgen under Ingres...)
>
>If not, I would like to know how to get information about
>type of each row of a table to write this kind of prog.
>(i.e. Where is this explain ?)
>
>--
>+----------------------------------+
>| Marzullo Laurent                 |
>| Analyste-programmeur             |
>| SEMA-GROUP Belgium S.A.          |
>| Tél: (32) 2 333 52 43            |
>| e-mail: Laurent.Marzullo@sema.be |
>+----------------------------------+
>
>************

+--------------------------+--------------------------------------+
| Stuart C. G. Rison       | Ludwig Institute for Cancer Research |
+--------------------------+ 91 Riding House Street               |
| N.B. new phone code!!    | London, W1P 8BT                      |
| Tel. +44 (0)207 878 4041 | UNITED KINGDOM                       |
| Fax. +44 (0)207 878 4040 | stuart@ludwig.ucl.ac.uk              |
+--------------------------+--------------------------------------+

Re: [GENERAL] Prog to generate table structure ...

От
Chris Bitmead
Дата:
You need to look at the system tables. Like pg_class and the other pg_*
tables.

pg_dump will output CREATE statements to re-create the database. I'm not
sure
that's what you want though.

Marzullo Laurent wrote:
>
> Hello,
>
> is there a prog to generate  C file describing table structure
> of a database.
>
> (Something like dclgen under Ingres...)
>
> If not, I would like to know how to get information about
> type of each row of a table to write this kind of prog.
> (i.e. Where is this explain ?)
>
> --
> +----------------------------------+
> | Marzullo Laurent                 |
> | Analyste-programmeur             |
> | SEMA-GROUP Belgium S.A.          |
> | Tél: (32) 2 333 52 43            |
> | e-mail: Laurent.Marzullo@sema.be |
> +----------------------------------+
>
> ************