Page 1 of 1
zeos & postgresql
Posted: 16.05.2007, 03:54
by folibis
I use ZEOS component in Builder C++ with PostgreSQL 8.2
I've got strange error with query
select "field"::integer from "table"
syntax error at or near ":"
type of "field" is boolean
what can it be?
Posted: 16.05.2007, 04:43
by folibis
ok ... I resolve the problem.
It must by "field"::::integer from any reason.
But now query return value "False" without conversion.
I need integer value ....
Posted: 16.05.2007, 09:07
by btrewern
You could use:
Code: Select all
SELECT CASE WHEN "field" THEN 1 ELSE 0 END FROM "table";
You can also try
Code: Select all
SELECT CAST("field" as integer) FROM "table";
Regards,
Ben
Posted: 16.05.2007, 23:59
by folibis
both
CAST and
::integer returns "False" in this query
I don't know what the reason ...
But
CASE is good idea ... I guess i take it
thanks
Posted: 18.05.2007, 09:28
by btrewern
If you try
Code: Select all
SELECT CAST("field" as integer) as "FieldName" From "table";
It may work.
Looks like this is to do with the slightly brain dead way Zeos finds the type of columns.
Regards,
Ben