pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Gerardo Herzig <gherzig@fmed.uba.ar>
To: pgsql-sql@postgresql.org
Subject: finding UNIQUES in information_schema
Date: Thu, 16 Apr 2009 16:33:16 -0300
Message-ID: <49E787FC.8020909@fmed.uba.ar> (raw )
Hi all. Im failing while trying to obtain some metainfo from
information_schema. Acording to the docs, constraint_column_usage and
key_column_usage views contains some information about constraints and
indexes.
See:
Table "public.almatnov"
Column | Type | Modifiers
-------------+------------------------+--------------------------------
formu | integer |
alucod | integer | default 0
codcarr | character varying(3) | default ''::character varying
anifm | character varying(2) | default 20
comentarios | text | default ''::text
Indexes:
"almatnov_alucod_codcarr_idx" UNIQUE, btree (alucod, codcarr)
"almatnov_codcarr_alucod" UNIQUE, btree (alucod, codcarr)
And now:
ematerias=# SELECT * from information_schema.constraint_table_usage
where table_name='almatnov';
table_catalog | table_schema | table_name | constraint_catalog |
constraint_schema | constraint_name
---------------+--------------+------------+--------------------+-------------------+-----------------
(0 rows)
ematerias=# SELECT * from information_schema.key_column_usage where
table_name='almatnov';
constraint_catalog | constraint_schema | constraint_name |
table_catalog | table_schema | table_name | column_name |
ordinal_position | position_in_unique_constraint
--------------------+-------------------+-----------------+---------------+--------------+------------+-------------+------------------+-------------------------------
(0 rows)
1) Im a doing anything wrong?
2) It is safe to extract metainfo from pg_catalog?
Thanks!
Gerardo
view thread (4+ messages) latest in thread
Message-ID: <49E787FC.8020909@fmed.uba.ar>
Permalink: ../49E787FC.8020909@fmed.uba.ar/
Also on: postgresql.org/message-id/49E787FC.8020909@fmed.uba.ar
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: gherzig@fmed.uba.ar
Subject: Re: finding UNIQUES in information_schema
In-Reply-To: <49E787FC.8020909@fmed.uba.ar>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox