pg metadata and doc bug

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема pg metadata and doc bug
Дата
Msg-id alpine.DEB.2.00.0811252024360.20453@localhost.localdomain
обсуждение исходный текст
Ответы Re: pg metadata and doc bug  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Dear PostgreSQL developers,

#### 1

I stumbled upon an obscure bug (or undesirable feature:-) in the schema 
metadata accessible through the information_schema, and possibly 
pg_catalog as well. As it was mixed in a bug in some in my code, it was 
hard for me to identify it.

The issue is that when one does (in pg 8.3.5)
    ALTER TABLE foo ADD CONSTRAINT xxx UNIQUE ON (...);

this results in a constraint *and* an index, but when one does only the 
corresponding:
    CREATE UNIQUE INDEX foo(...);

then the index is created but there is no constraint. So what?

The consequence arises downhill when one declares a foreign key which uses 
this index as a target. The FK constraint is accepted, but as the metadata 
contents does not include the constraint, you cannot find the relevant 
informations by joining the various information_schema relations.

I was just looking for this information, how unlucky of me:-)

See the attached file for an example. Comment out the index creation and 
uncomment the unique constraint to see the difference in the metadata
(information_schema, and possibly underlying pg_catalog).

ITSM that the fix is that a 'CREATE UNIQUE INDEX...' shoud also add the 
corresponding constraint.


#### 2

Also, there is a minor bug in the documentation, which was the another 
source of my troubles:
 information_schema.KEY_COLUMN_USAGE.position_in_unique_constraint

is tagged as "NOT IMPLEMENTED", but it looks like it is implemented.

-- 
Fabien.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Exporting PGINTERVALSTYLE prevents access to older server versions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg metadata and doc bug