Subject Re: Possible bug
Author Adam
Hello Ilir.

The problem you are facing (or forcing Firebird to deal with) is that
in the first query, field B is a null, and in the second one field B
is a char(1).

It makes no more sense than:

select startdate from employee
union all
select name from location

Thomas has already given you a work around, by explicitly telling
Firebird what datatype you are talking about when you select null. I
wouldn't call it a bug. Some people may prefer how SQL Server
behaves, but I find it helpful because it is unusual to want to union
fields of different types.

It is probably the wrong place for a bug report, but I think you were
a bit premature with the bug call. Instead of asking if it is a bug,
ask "What am I doing wrong here?". I would also trust Oracle,
PostgreSQL and Firebirds interpretation over SQL Server any day.

1.5.2 is the latest version released by the way but it still will
give the same error.


Adam



--- In firebird-support@yahoogroups.com, "i_gashi" <I.Gashi@c...>
wrote:
>
>
> Hi,
>
> My name is Ilir Gashi and I am Research Student at the Centre for
> Software
> Reliability, City University, London. I found a (possible) bug in
> Firebird
> 1.0 (I know it is an old release but I do not have a newer one
> installed
> and in any case I am only using the server for research purposes).
>
> The script is as follows:
>
> CREATE TABLE ta (c1 CHAR(1));
> CREATE TABLE tb (c1 CHAR(1));
> CREATE TABLE tc (c1 SMALLINT);
>
> INSERT INTO ta VALUES('a');
> INSERT INTO tb VALUES('b');
> INSERT INTO tc VALUES(1);
>
> SELECT c1 AS a,NULL AS b,NULL AS c FROM ta
> UNION ALL
> SELECT NULL,c1,NULL FROM tb
> UNION ALL
> SELECT NULL,NULL,c1 FROM tc;
>
> SQL error code = -104
> Invalid command
> Data type unknown
>
> The same query with the same tables in MS SQL Server 7 returns the
> results:
>
> a b c
> ---- ---- ------
> a NULL NULL
> NULL b NULL
> NULL NULL 1
>
> (3 row(s) affected)
>
> PostgreSQL 7.2 and Oracle 8.0.5 return the same (or similar) error
> message
> to Firebird 1.0. So i have disagreements in the results retured by
the
> servers.
>
> Is this a bug, or is this the intended behaviour in Firebird.
>
> Looking forward to your reply.
>
> Best regards,
>
> Ilir
>
> P.S. I am not sure whether this is the correct place to send this
> report.
> If it is not then sorry for the inconvenience but can you give me a
> pointer
> as to where I should report this.
>
> ____________________________________________
>
> Ilir Gashi
> PhD Student
> Centre for Software Reliability
> City University
> Northampton Square, London EC1V 0HB
> email: i.gashi@c...
> website: http://www.csr.city.ac.uk/csr_city/staff/gashi/