dbTalk Databases Forums  

[BUGS] No rows returned from the SQL query (possible bug)

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] No rows returned from the SQL query (possible bug) in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ilir Gashi
 
Posts: n/a

Default [BUGS] No rows returned from the SQL query (possible bug) - 07-01-2004 , 04:58 PM






Hello,

I saw this 'bug' reported in the Firebird SourceForge website for the
Firebird 1.0 server. They confirmed it as a bug! I tried it in PostgreSQL
7.2 (I know its an old release but I do not have a newer version installed,
and in any case I am only using the server for reserach purposes).
PostgreSQL returns no rows for either of the queries. Of course this is the
case since the attributes F1 and F2 of Table T1 are of type Char whereas
the select query is making the test with an integer value. Is this the
intended behaviour?

Firebird returns 0 rows for the first query and 1 row (values 3,3) for the
second query. I also tried it in Oracle 8.0.5 which returns 1 row for each
of the two queries. Therefore I have different results being returned from
all three servers.

Reproducible script:

CREATE TABLE T1 (F1 CHAR(4), F2 CHAR(4));

CREATE INDEX T1_F1 ON T1 (F1);

INSERT INTO T1 (F1, F2) VALUES ('001', '001');
INSERT INTO T1 (F1, F2) VALUES ('002', '002');
INSERT INTO T1 (F1, F2) VALUES ('003', '003');
INSERT INTO T1 (F1, F2) VALUES ('004', '004');


SELECT * FROM T1 WHERE F1 = 3;

F1 F2
---- ----

SELECT * FROM T1 WHERE F2 = 3;

F1 F2
---- ----

Best regards,

Ilir

--
____________________________________________

Ilir Gashi
PhD Student
Centre for Software Reliability
City University
Northampton Square, London, UK EC1V 0HB
email: i.gashi (AT) city (DOT) ac.uk
website: http://www.csr.city.ac.uk/csr_city/staff/gashi/
____________________________________________

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org

Reply With Quote
  #2  
Old   
Jean-Luc Lachance
 
Posts: n/a

Default Re: [BUGS] No rows returned from the SQL query (possible bug) - 07-01-2004 , 06:37 PM






3 and '003 ' are not the samething!!!
Do not forget that F1 and F2 are paded with spaces also.
Maybe you want to use varchar instead.

Ilir Gashi wrote:

Quote:
Hello,

I saw this 'bug' reported in the Firebird SourceForge website for the
Firebird 1.0 server. They confirmed it as a bug! I tried it in
PostgreSQL 7.2 (I know its an old release but I do not have a newer
version installed, and in any case I am only using the server for
reserach purposes). PostgreSQL returns no rows for either of the
queries. Of course this is the case since the attributes F1 and F2 of
Table T1 are of type Char whereas the select query is making the test
with an integer value. Is this the intended behaviour?

Firebird returns 0 rows for the first query and 1 row (values 3,3) for
the second query. I also tried it in Oracle 8.0.5 which returns 1 row
for each of the two queries. Therefore I have different results being
returned from all three servers.

Reproducible script:

CREATE TABLE T1 (F1 CHAR(4), F2 CHAR(4));

CREATE INDEX T1_F1 ON T1 (F1);

INSERT INTO T1 (F1, F2) VALUES ('001', '001');
INSERT INTO T1 (F1, F2) VALUES ('002', '002');
INSERT INTO T1 (F1, F2) VALUES ('003', '003');
INSERT INTO T1 (F1, F2) VALUES ('004', '004');


SELECT * FROM T1 WHERE F1 = 3;

F1 F2 ---- ----

SELECT * FROM T1 WHERE F2 = 3;

F1 F2 ---- ----

Best regards,

Ilir


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.