Re: No rows returned from the SQL query (possible bug)

From: Jean-Luc Lachance <jllachan(at)sympatico(dot)ca>
To: Ilir Gashi <I(dot)Gashi(at)city(dot)ac(dot)uk>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: No rows returned from the SQL query (possible bug)
Date: 2004-07-01 22:16:29
Message-ID: 40E48D3D.4030901@sympatico.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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:

> 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
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-07-01 22:48:46 Re: VACUUM analyze verbose is skipping tables
Previous Message Tom Lane 2004-07-01 21:10:21 Re: Possible bug?