Seems I found the problem with the 'select pg_class from pg_class'
error. In fact this error arises not only with the pg_class table but
with any select statement where one of the select attributes is the
same as the table name and doesn't exist in the table.

The problem is in the transformIdent() function. The ident is first
checked whether it is a table and the check succeeds. After that
according to the precedence the check for an attribute with the name
ident->name occurs and fails. As a result the function returns ident
with isRel set to true and that confuses the engine afterwards.

The obvious proposal to eliminate the bug is to check the precedence
first and if it is EXPR_COLUMN_FIRST not to try to check if the ident
is a relation. I'm not an experienced PostgreSQL hacker though so I
cannot predict the implications of such change (I did run the regress test
with the relation check commented out whatsoever and the results were
the same as for the unchanged engine). Perhaps someone will
have some comments on this issue?


Sun, 10 Sep 2000 00:03:30 +0800
Alexey Raschepkin <apr@direct.ru>
'select pg_class from pg_class' error