Re: Syntax Error for "boolean('value')" Type Casting

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Syntax Error for "boolean('value')" Type Casting
Дата
Msg-id FF88D7D2-958C-4366-91DF-E8D99FA906F5@solfertje.student.utwente.nl
обсуждение исходный текст
Ответ на Syntax Error for "boolean('value')" Type Casting  ("David Johnston" <polobo@yahoo.com>)
Ответы Re: Syntax Error for "boolean('value')" Type Casting
Список pgsql-general
On 21 May 2011, at 21:17, David Johnston wrote:

> SELECT boolean('true')
>
>>> SQL Error: ERROR:  syntax error at or near "("
>>> LINE 1: SELECT boolean('true')
>>>                     ^
>
> The following work as expected:
>
> SELECT bool('true')

(...)

> While I'm here.is there any downside to using the "type(value)" form of
> casting versus other forms?

You're comparing apples and oranges here, you're not using a cast at all in fact.

Instead, you're calling the transformation function that's used by the cast. It just happens to be called the same as
thetype in some cases, which is why boolean(value) doesn't work. 

Now calling such functions will probably work just the same as the cast in most cases, but there will be some
discrepancies,as follows from reading: http://www.postgresql.org/docs/9.0/interactive/sql-createcast.html 

Alban Hertroys

--
Screwing up is an excellent way to attach something to the ceiling.


!DSPAM:737,4dd8e3fe11921124321257!



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

Предыдущее
От: "Frank Millman"
Дата:
Сообщение: Re: Problem with WITH RECURSIVE
Следующее
От: Wei
Дата:
Сообщение: Re: Fwd: Unable to Install - "unable to write inside TEMP environment variable path"