Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.9.3/8.9.3) with ESMTP id SAA14399 for ; Fri, 3 Dec 1999 18:01:44 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id SAA03256; Fri, 3 Dec 1999 18:00:32 -0500 (EST) To: wieck@debis.com (Jan Wieck) cc: mjnf@uevora.pt, pgsql-sql@postgreSQL.org Subject: Re: [SQL] Wierd stuff In-reply-to: Your message of Fri, 3 Dec 1999 17:33:32 +0100 (MET) Date: Fri, 03 Dec 1999 18:00:32 -0500 Message-ID: <3254.944262032@sss.pgh.pa.us> From: Tom Lane wieck@debis.com (Jan Wieck) writes: > Mario Filipe wrote: >>>> | concelho_naturalidade | int2 >>>> ... >>>> | codigo | int4 >>>> >>>> The field "concelho_naturalidade" on the first table has values taken >>>> from the "codigo" field from the second. > First of all, why aren't the two fields of the same data > type? Shouldn't cause your problem, but it's bad database > design anyway IMHO. Actually, I think that this may indeed be the root of the problem. I killed several bugs in cross-data-type joins a while back ... for example, IIRC pre-6.5 Postgres thought it could use hash joins for cross-data-type equality operators, but that doesn't work properly in general. Mario, what does EXPLAIN show about how the join query is being done? If I'm right about this, then upgrading to 6.5.* should fix the problem. regards, tom lane