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 9AC8C52862 for ; Thu, 23 Jun 2005 19:21:32 -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 60670-09 for ; Thu, 23 Jun 2005 22:21:22 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id B186B52838 for ; Thu, 23 Jun 2005 19:21:21 -0300 (ADT) 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 j5NMLMTQ008932; Thu, 23 Jun 2005 18:21:22 -0400 (EDT) To: Rod Taylor Cc: Markus Bertheau , PgSQL - SQL Subject: Re: empty view, replace view, column type change? In-reply-to: <1119558411.35441.104.camel@home> References: <1119557009.7430.16.camel@localhost.localdomain> <1119557984.35441.95.camel@home> <1119558477.7430.22.camel@localhost.localdomain> <1119558411.35441.104.camel@home> Comments: In-reply-to Rod Taylor message dated "Thu, 23 Jun 2005 16:26:51 -0400" Date: Thu, 23 Jun 2005 18:21:22 -0400 Message-ID: <8931.1119565282@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/290 X-Sequence-Number: 21891 Rod Taylor writes: > On Thu, 2005-06-23 at 22:27 +0200, Markus Bertheau wrote: >> Dnia 23-06-2005, czw o godzinie 16:19 -0400, Rod Taylor napisał(a): >>> The data types are different, as one has the timestamp to (6) decimal >>> places after seconds. >> >> That's strange. I explicitly specified ::TIMESTAMP on both the view and >> the table. Is that not unambiguous? > LOCALTIMESTAMP is probably more specific, so it folds the length in. > If you SELECT 'abc'::varchar(6)::varchar, the end type is varchar(6). Yeah, this is exactly what's happening --- if you look at gram.y, LOCALTIMESTAMP is expanded to "'now'::text::timestamp(6)". I am unconvinced that the (6) is a very good idea though. The code says /* SQL99 mandates a default precision of 6 for timestamp. * Also, that is about as precise as we will get since * we are using a microsecond time interface. * - thomas 2001-12-07 */ d->typmod = 6; but it doesn't seem to me to follow from what the spec says that we need to explicitly cast the result of now() to six places. As long as it's coming from gettimeofday it can't have more than 6 places anyway, and so we might as well save the extra coercion step. (The parser *will* tack on a separate coercion function call when presented with this parse tree.) In short, I'm inclined to remove the above-quoted lines, and similarly for CURRENT_TIME, CURRENT_TIMESTAMP, and LOCALTIME. Thoughts? regards, tom lane