Re: [GENERAL] Typecasting datetype as date. How do I cope with NULLs?
От | tolik@icomm.ru (Anatoly K. Lasareff) |
---|---|
Тема | Re: [GENERAL] Typecasting datetype as date. How do I cope with NULLs? |
Дата | |
Msg-id | x7sof5xwre.fsf@tolikus.hq.aaanet.ru обсуждение исходный текст |
Ответ на | Re: [GENERAL] Typecasting datetype as date. How do I cope with NULLs? ("Wim Ceulemans" <wim.ceulemans@nice.be>) |
Список | pgsql-general |
>>>>> "WC" == Wim Ceulemans <wim.ceulemans@nice.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@icomm.ru Senior programmer
В списке pgsql-general по дате отправления: