function lower(numeric) not found on postgresql

Questionsfunction lower(numeric) not found on postgresql
Abu Ghufran asked 3 years ago

Hi Abu,

I already bought the new library, and its working fine. except when I declare the following and try to search a numeric field, i am getting a postgresql error that

$col = array();
$col["title"] = isset($lang['HIGH']) ? $lang['HIGH'] : 'High';
$col["name"] = "px_high";
$col["dbname"] = "h.px_high";
$col["width"] = "80";
$col["fixed"]=true;
$col["sorttype"] = int;
$col["editable"] = false;
$col["align"] = "right";
$cols[] = $col;

SELECT count(*) as c FROM (SELECT a.px_date as Date, ROUND(a.px_open,2) AS open, ROUND(a.px_high,2) AS high, ROUND(a.px_low,2) AS low, ROUND(a.px_close,2) AS close, ROUND(a.adj_px_close,2) AS adj_close, a.volume, a.ex_dividend as dividend, a.split_factor as split FROM historical_prices a WHERE a.figi = 'BBG000C2V3D6' AND ( LOWER(a.px_open) LIKE LOWER('%1%') )) pg_tmp

this coming under postgresql query site

ERROR: function lower(numeric) does not exist

SQL state: 42883

Hint: No function matches the given name and argument types. You might need to add explicit type casts.

Character: 326

Can you help?

Thanks

2 Answers
Abu Ghufran answered 3 years ago

You can typecast it to text:
e.g.

$col["name"] = "id";
$col["dbname"] = "id::TEXT";

It will start working without any fiurther change.

CLAUDIO MELO answered 1 year ago

For me works like these exemple:

$col[“name”] = “numero_bem”; // grid column name, same as db field or alias from sql
$col[“dbname”] = “CAST(numero_bem AS TEXT)”; // postgresql problem with search

Your Answer

2 + 17 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?