From: | tolik(at)icomm(dot)ru (Anatoly K(dot) Lasareff) |
---|---|
To: | "Wim Ceulemans" <wim(dot)ceulemans(at)nice(dot)be> |
Cc: | <pgsql-general(at)postgreSQL(dot)org> |
Subject: | Re: [GENERAL] Typecasting datetype as date. How do I cope with NULLs? |
Date: | 1998-11-27 10:20:21 |
Message-ID: | x7sof5xwre.fsf@tolikus.hq.aaanet.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
>>>>> "WC" == Wim Ceulemans <wim(dot)ceulemans(at)nice(dot)be> writes:
WC> I find the above interesting and I've tried something similar that won't
WC> work.
WC> I have two tables defined as follows
WC> create table test1 (id1 int,link1 int);
WC> create table test2 (id2 int, field2 varchar(5));
WC> where link1 is a foreign key of test1 that should be linked to id2 of test2
WC> Now when I execute the following query:
WC> select id1,field2,link1 from test1,test2 where test1.link1=test2.id2
WC> union
WC> select id1,NULL,link1 from test1;
WC> I always get the following error:
WC> Each UNION query must have identical target types.
WC> Why this error, and what does it mean?
Pehaps this is a bug fixed in 6.4 version? I saw this message when
before upgrating to 6.4. You can modify query so:
select id1,field2,link1 from test1,test2 where test1.link1=test2.id2
union
select id1, -1, link1 from test1;
where -1 is value non present in field2 domain.
--
Anatoly K. Lasareff Email: tolik(at)icomm(dot)ru
Senior programmer
From | Date | Subject | |
---|---|---|---|
Next Message | Stuart Rison | 1998-11-27 11:12:22 | Re: [GENERAL] Typecasting datetype as date. How do I cope with NULLs? |
Previous Message | Wim Ceulemans | 1998-11-27 08:51:48 | Re: [GENERAL] Typecasting datetype as date. How do I cope with NULLs? |