Re: Obtain boolean value of expression in PLPGSQL

Поиск
Список
Период
Сортировка
От Martin Hart
Тема Re: Obtain boolean value of expression in PLPGSQL
Дата
Msg-id 57780.81.136.181.57.1067944627.squirrel@maxproxy1.uk2net.com
обсуждение исходный текст
Ответ на Obtain boolean value of expression in PLPGSQL  (Max Speransky <mx@lucky.net>)
Список pgsql-general
Max Speransky said:
> Hello
>
> My task is to validate expression and get value of it in boolean variable.
[snip]
> when I try to execute this function I get such result:
>
> bill=# select get_value(3);
> WARNING:  Error occurred while executing PL/pgSQL function get_value
> WARNING:  line 6 at assignment
> ERROR:  Bad boolean external representation '3=3'

|| is the string concatenation operator - so your expression creates a
string "3=3" and then tries to return that as a boolean hence the error.

if you cannot just do "return 3 = $1;" perhaps you could try using EXECUTE?

cheers
Martin


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

Предыдущее
От: "Najib Abi Fadel"
Дата:
Сообщение: Using SUBSELECT in CHECK expressions
Следующее
От: "Hijax"
Дата:
Сообщение: now() problem