LIKE '%%' does not return NULL

From: "Traci Sumpter" <Traci(dot)Sumpter(at)opus(dot)co(dot)nz>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: LIKE '%%' does not return NULL
Date: 2004-08-11 01:22:00
Message-ID: KFEJJKOAGCCGEJFLKCBBKEALEBAA.Traci.Sumpter@opus.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

A team developer has chosen the lazy way of not checking if a variable
exists on his PHP page and has code which produces the following SQL

SELECT * FROM mytable where myfield ilike '%%'

I have noticed that this statement does not return null or empty myfield
records.

Is this the way (SQL) to do this??

Is there a better syntax to the SQL??

Is the better way to create the statement in PHP is to check if the passed
value <> '' ??

Or is this issue being fixed in the new V8 version of postgreSQL.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Theo Galanakis 2004-08-11 02:23:54 ERROR: Cross-database references are not implemented
Previous Message Joe Conway 2004-08-10 17:41:46 Re: function expression in FROM may not refer to other relations