X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5C203528C7 for ; Thu, 23 Jun 2005 17:22:27 -0300 (ADT) 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 39298-07 for ; Thu, 23 Jun 2005 20:22:26 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id DFB5C528D9 for ; Thu, 23 Jun 2005 17:22:24 -0300 (ADT) Received: from 209-161-193-22.dsl.look.ca (209-161-193-22.dsl.look.ca [209.161.193.22]) by tht.net (Postfix) with ESMTP id 67AA876A84; Thu, 23 Jun 2005 16:22:26 -0400 (EDT) Subject: Re: empty view, replace view, column type change? From: Rod Taylor To: Markus Bertheau Cc: PgSQL - SQL In-Reply-To: <1119557009.7430.16.camel@localhost.localdomain> References: <1119557009.7430.16.camel@localhost.localdomain> Content-Type: text/plain Date: Thu, 23 Jun 2005 16:19:44 -0400 Message-Id: <1119557984.35441.95.camel@home> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.119 tagged_above=0 required=5 tests=AWL, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200506/287 X-Sequence-Number: 21888 On Thu, 2005-06-23 at 22:03 +0200, Markus Bertheau wrote: > Hi, > > it seems to me that the following should work but it fails: > > CREATE VIEW co AS SELECT LOCALTIMESTAMP::TIMESTAMP AS ov WHERE FALSE; > CREATE TABLE link (ov TIMESTAMP); > CREATE OR REPLACE VIEW co AS SELECT ov FROM link; The data types are different, as one has the timestamp to (6) decimal places after seconds. development=# CREATE VIEW co AS SELECT LOCALTIMESTAMP::TIMESTAMP AS ov WHERE FALSE; CREATE VIEW development=# CREATE TABLE link (ov TIMESTAMP); CREATE TABLE development=# CREATE OR REPLACE VIEW cod AS SELECT ov FROM link; CREATE VIEW development=# \d co View "rbt.co" Column | Type | Modifiers --------+--------------------------------+----------- ov | timestamp(6) without time zone | View definition: SELECT 'now'::text::timestamp(6) without time zone AS ov WHERE false; development=# \d cod View "rbt.cod" Column | Type | Modifiers --------+-----------------------------+----------- ov | timestamp without time zone | View definition: SELECT link.ov FROM link; --