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 5FBC056505 for ; Tue, 22 Mar 2005 08:50:24 +0000 (GMT) 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 94546-09 for ; Tue, 22 Mar 2005 08:50:15 +0000 (GMT) Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by svr1.postgresql.org (Postfix) with SMTP id 733D556539 for ; Tue, 22 Mar 2005 08:50:12 +0000 (GMT) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Tue Mar 22 09:50:07 2005 +0100 Received: from rodos.fzk.de (resy6.fzk.de [141.52.68.10]) by resy5.fzk.de (8.12.7/8.12.7/SuSE Linux 0.6) with ESMTP id j2M8o6sG012870; Tue, 22 Mar 2005 09:50:06 +0100 Message-ID: <423FDC3D.2D59CBB2@rodos.fzk.de> Date: Tue, 22 Mar 2005 09:50:05 +0100 From: Christoph Haller X-Mailer: Mozilla 4.77 [en] (X11; U; HP-UX B.10.20 9000/780) X-Accept-Language: en MIME-Version: 1.0 To: "mroyce@gmail.com" Cc: pgsql-sql@postgresql.org Subject: Re: timestamp precision - can I control precision at select time References: <1111013876.573335.284450@o13g2000cwo.googlegroups.com> Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS - amavis-milter (http://www.amavis.org/) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.256 tagged_above=0 required=5 tests=AWL, TO_ADDRESS_EQ_REAL X-Spam-Level: X-Archive-Number: 200503/299 X-Sequence-Number: 20778 "mroyce@gmail.com" wrote: > > I have a database with several tables that use timestamp without time > zone type. I upgraded from an older pgsql and have code that does not > expect the precision in the select output. Is there a way I can get the > effect of zero precision without modifying all the tables? > > The docs say it uses "default precision" as set in the "timestamp > literal". I wasn't able to find docs describing what literals are. If > there's a way I can set this to zero precision for everything, that'd > save me a bunch of time. > > with thanks, > Royce > I was facing the same obstacle. The only cure I've found was either SELECT CURRENT_TIMESTAMP ; timestamptz ------------------------------ 2005-03-22 09:43:51.05193+01 (1 row) SELECT CURRENT_TIMESTAMP::TIMESTAMP(0) ; timestamp --------------------- 2005-03-22 09:44:11 (1 row) resp. change column types to TIMESTAMP(0) But I assume you've found this already by yourself. Regards, Christoph