Обсуждение: pg_class not updated correctly?

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

pg_class not updated correctly?

От
"Darrin Ladd"
Дата:
Howdy,

I am creating my first *real* tables in Postgres and noticed something that
concerned me.  It appears that the pg_class table is not being updated
correctly to reflect the constraints on the table.  Here is my example...

I created a table code:

CREATE TABLE code (
code_type_no int,
code_no      int,
code_desc    varchar,
CONSTRAINT pk_code
   PRIMARY KEY (code_type_no, code_no),
CONSTRAINT fk_code_codetype_code_type_no
   FOREIGN KEY (code_type_no)
   REFERENCES code_type (code_type_no)
);

As you can see it has a primary key and a foreign key.  But when looking at
the pg_class table:
pg_class.relname = code
         reltriggers = 2  yes
         relukeys    = 0  maybe as long as primary shouldn't be
                          displayed here as unique
         relfkeys    = 0  NO!
         relhaspkey  = f  NO!

This is not the only table that I have created, all of them have at least a
primary key, and none of them are showing a number > 0 for ukeys or anything
but an f for haspkey.

Am I reading this table incorrectly, or is there something wrong with the
way Postgres is updating this table?

Thanks!
Darrin
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


Re: pg_class not updated correctly?

От
Tom Lane
Дата:
"Darrin Ladd" <darrin_ladd@hotmail.com> writes:
>          reltriggers = 2  yes
>          relukeys    = 0  maybe as long as primary shouldn't be
>                           displayed here as unique
>          relfkeys    = 0  NO!
>          relhaspkey  = f  NO!

AFAICS, relukeys, relfkeys, and relhaspkey are not actually used or
maintained by the system.  Not sure why they were put into pg_class.

            regards, tom lane