Обсуждение: PostgreSQL catalogues: how to find the primary key?

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

PostgreSQL catalogues: how to find the primary key?

От
Roland Roberts
Дата:
-----BEGIN PGP SIGNED MESSAGE-----

I've been trying to get Keystone (http://www.stonekeep.com/keystone/)
up and running.  The PHP script it uses are really oriented to MySQL,
although there is a mostly complete set of PostgreSQL functions
written for it.  One thing missing is a query to find the primary key
on a table.

What catalogues do I need to query to find this?  Is there some
documentation on the catalogues (I didn't find any, but....).

On a similar note, I've managed to figure out how to find column
widths but looking at the pg_attribute table and subtracting 4 from
the value of atttypmod for strings, including char().  However, that
was slightly non-obvious.  The "old" PHP scripts looked at the attlen
column which no longer seems to apply...am I doing the right thing
here?

roland

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
Comment: Processed by Mailcrypt 3.4, an Emacs/PGP interface

iQCVAwUBNcUV/eoW38lmvDvNAQH6bQP/SaTCxbntNKsNqW46i7kCxpNN/YOtf0z3
ghLlC4Wh9xy/lLgFh9WOjg/Q7ecdA+jL2BCRVTVlWZG0pOwIgXWBZFAyxiz5dKSG
h47jKI97RZi7C8fjXVY3H3RFnpzBtDduK0fMPoPhqXikvfcL0+LrJ9cBwVFSK4I1
6hTxhGU38hc=
=25uZ
-----END PGP SIGNATURE-----
--
Roland B. Roberts, PhD                  Custom Software Solutions
roberts@panix.com                           101 West 15th St #4NN
                                               New York, NY 10011