'select pg_class from pg_class' error - Mailing list pgsql-hackers

From Alexey Raschepkin
Subject 'select pg_class from pg_class' error
Date
Msg-id 20000910000330.A5295@star
Whole thread Raw
List pgsql-hackers
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?



pgsql-hackers by date:

Previous
From: Tim Perdue
Date:
Subject: Re: Fragged State in 7.0.2
Next
From: Alexey Raschepkin
Date:
Subject: Sources from the CVS cannot be compiled