Subject Firebird 3.0 : Reordering Fields in WHERE Search Condition of Query Returns Different Recordsets
Author LtColRDSChauhan

1. On reordering the fields in WHERE search condition of a query, different sets of records are returned. Relevant details listed in subsequent Paras.

2. The table :

CREATE TABLE MYUSERS

(

USERNAME Varchar(80) NOT NULL,

USERPSWD Varchar(80) NOT NULL,

CONSTRAINT PK_MYUSERS_1 PRIMARY KEY (USERNAME)

);

GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE

ON MYUSERS TO SYSDBA WITH GRANT OPTION;

2. Query 1 And the Records Returned :

SELECT a.USERNAME, a.USERPSWD FROM MYUSERS a where upper('%' || a.USERNAME || '%') like upper('%' || a.USERPSWD || '%')

xyz        xyz

abc       abc

3. Query 2 And the Records Returned :

SELECT a.USERNAME, a.USERPSWD FROM MYUSERS a where upper('%' || a.USERPSWD || '%') like upper('%' || a.USERNAME || '%')

xyz      xyz

abc     abc

pqr      pqr123

user    user123


4. Environment Details :

Firebird-3.0.0.30566_0_Win32_Alpha1

FlameRobin 0.9.2.1851

Windows 7 Home Premiun SP1


--
  Regards,
  Lt Col (Retd) Rajiv Dular Singh Chauhan
 
_____________________________