'select pg_class from pg_class' error

From: Alexey Raschepkin <apr(at)direct(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: 'select pg_class from pg_class' error
Date: 2000-09-09 16:03:30
Message-ID: 20000910000330.A5295@star
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2000-09-09 17:43:59 Where to stick function setuid
Previous Message Valter Mazzola 2000-09-09 15:34:52 Scalability, Clustering