Pavel Stehule wrote:
create or replace function int2bool (integer) returns boolean as '
select case when $1=1 then ''t''::boolean else ''f''::boolean end;
' language sql;
I'd do it slightly differently, if only to cater to the principle of least surprise:
create or replace function int2bool (int
Dear Mage ,
I'm wondering why pgsql doesn't support boolean typecasts like select
true::int;
Many client applications including php assign 1 to true and 0 to false
This was a issue PHP < 4.2 + < PostgreSQL 7.3.x and supports it till
now for backward compatibility
--
Best Regards,
Vishal Kash
Pavel Stehule wrote:
Hello, you can use own cast.
I think I have to create an own type too, because I don't want to use
typecast in every select.
You gave me the idea, thank you.
Mage
---(end of broadcast)---
TIP 7: don't forget to i
Hello, you can use own cast.
create or replace function int2bool (integer) returns boolean as '
select case when $1=1 then ''t''::boolean else ''f''::boolean end;
' language sql;
create or replace function bool2int (boolean) returns integer as '
select case when $1 then 0 else 1 end; ' langua
Hello,
I'm wondering why pgsql doesn't support boolean typecasts like select
true::int;
Many client applications including php assign 1 to true and 0 to false
I see no use of pgsql boolean type with php, I use int2 or integer.
Mage
---(end of broadcast)---