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 0D4B3D1B18C for ; Mon, 7 Jun 2004 06:09:05 -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 54337-03 for ; Mon, 7 Jun 2004 09:09:01 +0000 (GMT) Received: from viefep19-int.chello.at (viefep11-int.chello.at [213.46.255.27]) by svr1.postgresql.org (Postfix) with ESMTP id 2FF8CD1B1A1 for ; Mon, 7 Jun 2004 06:08:57 -0300 (ADT) Received: from weyoun ([213.47.56.254]) by viefep19-int.chello.at (InterMail vM.6.00.05.02 201-2115-109-103-20031105) with ESMTP id <20040607090858.ZHCI28959.viefep19-int.chello.at@weyoun> for ; Mon, 7 Jun 2004 11:08:58 +0200 Content-Type: text/plain; charset="iso-8859-1" From: Stefan Weiss Organization: Foo Orbital Operations To: pgsql-sql@postgresql.org Subject: Re: Formatting problems with negative intervals, TO_CHAR Date: Mon, 7 Jun 2004 11:08:37 +0200 User-Agent: KMail/1.4.3 References: <13d849b7ee63de04179c102cb25159d2@news.teranews.com> <21474.1086561656@sss.pgh.pa.us> <20040607075200.GA28529@zf.jcu.cz> In-Reply-To: <20040607075200.GA28529@zf.jcu.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200406071108.37410.spaceman@foo.at> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200406/51 X-Sequence-Number: 17996 On Monday, 07 June 2004 09:52, Karel Zak wrote: > http://www.postgresql.org/docs/7.4/static/functions-formatting.html > > Warning: to_char(interval, text) is deprecated and should not be > used in newly-written code. It will be removed in the next version. This is news for me. Are there any suggestions what we should replace TO_CHAR with? For example, we were using TO_CHAR to print timestamp values in ISO format without milliseconds ("YYYY-MM-DD HH24:MI:SS" style), regardless of the current datestyle setting. I see only three solutions to do this without using TO_CHAR, and IMO none of them are very attractive: - do the formatting at the application level, - change the datestyle for this query only - an ugly construct using 6 EXTRACT functions I hope there is a more elegant way to solve this... Why was TO_CHAR deprecated anyway? It seemed to me like a very useful and flexible way to do date/time formatting. Tnx, stefan