X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AD6DD535F2 for ; Tue, 5 Apr 2005 02:43:26 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41231-03 for ; Tue, 5 Apr 2005 01:43:24 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0511D535EC for ; Tue, 5 Apr 2005 02:43:23 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j351hIpp004853; Mon, 4 Apr 2005 21:43:18 -0400 (EDT) To: Jerry Day Cc: "'Bruce Momjian'" , "'pgsql-interfaces@postgresql.org'" Subject: Re: Problems with PQfmod() returning -1 on varchar f In-reply-to: <491DC5F3D279CD4EB4B157DDD62237F406ABE859@zipwire.esri.com> References: <491DC5F3D279CD4EB4B157DDD62237F406ABE859@zipwire.esri.com> Comments: In-reply-to Jerry Day message dated "Mon, 04 Apr 2005 10:54:15 -0700" Date: Mon, 04 Apr 2005 21:43:18 -0400 Message-ID: <4852.1112665398@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.11 tagged_above=0 required=5 tests=AWL, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200504/20 X-Sequence-Number: 5436 Jerry Day writes: > Thanks for your quick response. The column in question is defined as 'DATA > VARCHAR(20) NOT NULL'. The issue occurs when this is referenced in a fairly > complex query, such as: > SELECT data,int16_col,int64_col,float32_col,float64_col, > date_col,row_id > FROM > (SELECT b.data,b.int16_col,b.int64_col, > b.float3_col,b.float64_col,b.date_col,b.row_id > FROM table1 b > LEFT JOIN > (SELECT * > FROM table3 > ) d ON b.ROW_ID = d.ROW_ID > WHERE d.ROW_ID IS NULL > UNION ALL > SELECT a.data,a.int16_col,a.int64_col,a.float32_col, > a.float6_col,a.date_col,a.row_id > FROM table2 a > LEFT JOIN > (SELECT * > FROM table3 > ) d ON (a.ROW_ID = d.ROW_ID) > WHERE d.ROW_ID IS NULL > ) V__282 LIMIT 0; The UNION will drop the typmod, even if both its inputs have the same typmod. See e.g. http://archives.postgresql.org/pgsql-general/2005-04/msg00204.php This is on the agenda to look at for 8.1 ... regards, tom lane