Обсуждение: small bug? "ERROR: exprType: Do not know how to get type for 711 node"

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

small bug? "ERROR: exprType: Do not know how to get type for 711 node"

От
Ian Barwick
Дата:
nothing show-stopping, but something I found by accident:

  test=3D# select version();
                               version=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
  ---------------------------------------------------------------------
   PostgreSQL 7.3.1 on i386-unknown-freebsd4.7, compiled by GCC 2.95.4
  (1 row)

  test=3D#  create table foo (bar int);
  CREATE TABLE
  test=3D# update foo set foo=3D1 where foo=3D1;
  ERROR:  exprType: Do not know how to get type for 711 node

Only occurs when the column name used in the WHERE clause
is the same as the table name but does not exist in the table.
I would have expected a message more like this:

  test=3D# update foo set foo=3D1 ;=20=20=20=20=20=20=20=20=20=20=20
  ERROR:  Relation "foo" has no column "foo"


Ian Barwick
barwick@gmx.net

Re: small bug? "ERROR: exprType: Do not know how to get type for 711 node"

От
Tom Lane
Дата:
Ian Barwick <barwick@gmx.net> writes:
>   test=#  create table foo (bar int);
>   CREATE TABLE
>   test=# update foo set foo=1 where foo=1;
>   ERROR:  exprType: Do not know how to get type for 711 node

Hmm, that used to behave properly in 7.2:

regression=# create table foo (bar int);
CREATE
regression=# update foo set foo=1 where foo=1;
ERROR:  Attribute 'foo' not found

Looks like we rearranged the order of operations and error checks in a
bad way.  Will look into it.

            regards, tom lane

Re: small bug? "ERROR: exprType: Do not know how to get type for 711 node"

От
Tom Lane
Дата:
Ian Barwick <barwick@gmx.net> writes:
>   test=#  create table foo (bar int);
>   CREATE TABLE
>   test=# update foo set foo=1 where foo=1;
>   ERROR:  exprType: Do not know how to get type for 711 node

Now it does

regression=# update foo set foo=1 where foo=1;
ERROR:  Relation reference "foo" cannot be used in an expression

Thanks for the report.

            regards, tom lane