Re: [HACKERS] Function call problems with BETWEEN

Поиск
Список
Период
Сортировка
От Thomas G. Lockhart
Тема Re: [HACKERS] Function call problems with BETWEEN
Дата
Msg-id 350616B5.ADB2725F@alumni.caltech.edu
обсуждение исходный текст
Ответ на Function call problems with BETWEEN  ("Thomas G. Lockhart" <lockhart@alumni.caltech.edu>)
Список pgsql-hackers
> I think I've tracked down a problem I see using the BETWEEN operator:
>
> postgres=> select 1 where float8(1) between 0.0 and 2.0;
> ERROR:  transformExpr: does not know how to transform node 105
>
> I'm pretty sure that the problem stems from the fact that in gram.y the
> BETWEEN clause is expanded into the AND clauses as in the second
> example, _but_ the parse tree for the function call is reused! So,
> transformExpr() is run twice on the same part of the parse tree, and
> does not know how to cope.
> ...

> Another possible solution would be to have transformExpr() accept a
> previously transformed parse tree without damaging it. A simple minded
> fix having transformExpr() ignore the T_Const (the "105" node in the
> example) and T_Var nodes did not work.

Hmm. I forgot to set the return value for this. I now get:

postgres=> select 1 where float8(1) between 0.0 and 2.0;
?column?
--------
       1
(1 row)

But I'm not really happy putting in this change without knowing what the
side effects might be. I'll go ahead and try the regression tests...

                                               - Tom


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

Предыдущее
От: "Thomas G. Lockhart"
Дата:
Сообщение: Function call problems with BETWEEN
Следующее
От: Michael Yeung
Дата:
Сообщение: ODBC DRIVERS FOR 6.1/6.2