Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 404B59F9C05 for ; Tue, 4 Sep 2007 01:24:06 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 17024-01-10 for ; Tue, 4 Sep 2007 01:24:01 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from web31802.mail.mud.yahoo.com (web31802.mail.mud.yahoo.com [68.142.207.65]) by postgresql.org (Postfix) with SMTP id 2D72A9F9913 for ; Tue, 4 Sep 2007 01:24:00 -0300 (ADT) Received: (qmail 87501 invoked by uid 60001); 4 Sep 2007 04:23:59 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=yOILSVzWSdtOqAL6n6pQ+DXnwpE4CQaudmFdWhYNnfyHYeocwHPjgj//rzFvLYKQsrwmFsu9D+OmbUhU/iOGbH1j0rU/VTD71RVQmhsm36KlawW7KdJu/1B44LLCWghl94DOfQZTQJS16+wV1rw+DXCgbN1XJaWwSbg66eDgPYQ=; X-YMail-OSG: KYd8TQcVM1nhqZ.0sJgMTu.shwMtmLuID7JVnLGVbsdvm.lx6PC5paCKeJLpfoNxxQ-- Received: from [75.84.89.248] by web31802.mail.mud.yahoo.com via HTTP; Mon, 03 Sep 2007 21:23:59 PDT Date: Mon, 3 Sep 2007 21:23:59 -0700 (PDT) From: Richard Broersma Jr Subject: Re: Cast on character columns in views To: "Luiz K. Matsumura" , pgsql-sql@postgresql.org In-Reply-To: <46DCD4AC.1060004@planit.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <144384.86744.qm@web31802.mail.mud.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.509 tagged_above=0 required=5 tests=AWL=0.508, BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200709/17 X-Sequence-Number: 29230 --- "Luiz K. Matsumura" wrote: > CREATE VIEW view1( id, col1, type1, type2) AS > SELECT table1.id, > table1.col1, > CAST( table2.type1 AS CHARACTER( 3 )), > NULL > FROM table1 > JOIN table2 ON table2.fk_table1 = table1.id > UNION ALL > SELECT table1.id, > table1.col1, > CAST( NULL AS CHARACTER( 3 )), > table3.type2 > FROM table1 > JOIN table3 ON table3.fk_table1 = table1.id; Would the above changes work? Regards, Richard Broersma Jr.