This topic is locked

(Like) in PostgreSQL 8.2 and 8.3

3/5/2008 10:59:41 AM
PHPRunner General questions
R
rafamarquez author

Using PHPRunner with PostgreSQL Database 8.2 and 8.3
In the List page - With PostgreSQL 8.2
Search for Any field Contains 178
returns
178; "2008-02-16"; 4700.00; 2; 1; "2008-02-22 16:39:09.14"; 2; "maricel"; 2
In the List page - With PostgreSQL 8.3
Search for Any field Contains 178
returns
PHP error happened
Technical information
Error type 2
Error description pg_query() [function.pg-query]: Query failed: ERROR: operator does not exist: integer ~~ unknown LINE 1: ...where 1=0 or "public"."cotizacion"."idcotizacion" like '%178... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
URL localhost/finanzas/consultas/runner/cotizacion_list.php?a=search&value=1&SearchFor=178&SearchOption=Contains&SearchField=
Error file C:\Arquivos de programas\Apache Software Foundation\Apache2.2\htdocs\finanzas\consultas\runner\include\dbconnection.php
Error line 20
SQL query select "idcotizacion", "fecha", "cotizacion", "idmoneda", "contramoneda", "creacion", "modificacion", "idusuario", "login", "idrol", "idusuariomod", "loginmod", "remote_addrmod", "remote_hostmod", "remote_addr", "remote_host" From "public"."cotizacion" where 1=0 or "public"."cotizacion"."idcotizacion" like '%178%' or "public"."cotizacion"."fecha" like '%178%' or "public"."cotizacion"."cotizacion" like '%178%' or "public"."cotizacion"."idmoneda" like '%178%' or "public"."cotizacion"."contramoneda" like '%178%' ORDER BY "idcotizacion" DESC
What can I do to resolve?
Hugo

J
Jane 3/6/2008

Hugo,
please zip and send to support@xlinesoft.com a full set of generated PHP files, your database creation script with sample data and project file.

I'll find what's wrong with your project running it on my test box.

R
rafamarquez author 4/12/2008

Hugo Rafael,
I inspected your project.

It looks like PgSQL 8.3 doesn't support LIKE operator for numeric fields.
To overcome this you can add your numeric fields converted to VARCHAR to the SQL query and use them for searching.

I.e. modify your query on the Edit SQL query tab in PHPRunner this way:

select

...

"idcotizacion",

CAST("idcotizacion" AS VARCHAR) as stridcotizacion,

...
Then select to use stridcotizacion for searching on the Choose fields tab in PHPRunner.
---

Ask me about our Web hosting special

---

Alexey Kornilov

E-Mail: support@xlinesoft.com

WWW: http://www.xlinesoft.com

1-888-290-6617

R
rafamarquez author 4/12/2008

8.3 is fussier about type matching than 8.2 was. The query above is

casting idmovimientos to TEXT to do the comparison (since LIKE is

pointless on a BIGINT value). 8.3 doesn't do this automatically.
If you have a legit reason to do the above comparison, cast that column

to TEXT. Although I agree with Alvaro Herrera that the query (as provided) is

pretty pointless.
You could also adjust the pg_cast table to make the cast implicit, which

would mimic the 8.2 behaviour.
--

Bill Moran

Collaborative Fusion Inc.

http://people.collaborativefusion.com/~wmoran/
wmoran <at> collaborativefusion.com

Phone: 412-422-3463x4023
--

Sent via pgsql-bugs mailing list (pgsql-bugs <at> postgresql.org)

To make changes to your subscription:

http://www.postgresql.org/mailpref/pgsql-bugs