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 13BD3528BD for ; Fri, 24 Jun 2005 01:32:23 -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 42678-01 for ; Fri, 24 Jun 2005 04:32:18 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id 7180A52822 for ; Fri, 24 Jun 2005 01:32:17 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j5O4WF026888; Fri, 24 Jun 2005 00:32:15 -0400 (EDT) From: Bruce Momjian Message-Id: <200506240432.j5O4WF026888@candle.pha.pa.us> Subject: Re: empty view, replace view, column type change? In-Reply-To: <8931.1119565282@sss.pgh.pa.us> To: Tom Lane Date: Fri, 24 Jun 2005 00:32:15 -0400 (EDT) Cc: Rod Taylor , Markus Bertheau , PgSQL - SQL X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/291 X-Sequence-Number: 21892 Tom Lane wrote: > > 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? Agreed. That "6" bothered me too when I was cleaning up the timestamp code a while back. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073