Re: [INTERFACES] Urgent, bool-to-int patch possible?

Поиск
Список
Период
Сортировка
От José Soares
Тема Re: [INTERFACES] Urgent, bool-to-int patch possible?
Дата
Msg-id 3715E778.7D8ECB99@sferacarta.com
обсуждение исходный текст
Ответ на Urgent, bool-to-int patch possible?  (Matthew Hagerty <matthew@venux.net>)
Список pgsql-interfaces
create function int(bool) returns int as
'
begin
        IF $1 THEN
            RETURN 1;
        ELSE
            RETURN 0;
        END IF;
 end;
' language 'plpgsql';


Matthew Hagerty ha scritto:

> Greetings,
>
> What would be the chances of getting a patch for 6.4.2 to do bool-to-int
> conversion?  I need to do a query similar to this:
>
> SELECT * FROM mytable ORDER BY
> int(col1 > 3) + int(col2 < 4) + ... other conditions;
>
> (courtesy of Tom Lane)
>
> Would it be that hard to make a patch to do the conversion?  I would try it
> myself but I have no idea where to start looking, and I need this sooner
> than I could probably figure it out.
>
> I'm not making demands or stomping my feet, I love postgres and I
> understand that it is free software, but if one of you feels really nice... :)
>
> Thanks,
> Matthew


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

Предыдущее
От: José Soares
Дата:
Сообщение: Re: [INTERFACES] Urgent, bool-to-int patch possible?
Следующее
От: Peter Mount
Дата:
Сообщение: RE: [INTERFACES] JDBC and Postgres