Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f27Ilbx80066 for ; Wed, 7 Mar 2001 13:47:37 -0500 (EST) (envelope-from pgsql-sql-owner@postgresql.org) Received: from golem.fourpalms.org (www.fourpalms.org [64.3.68.148]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f27EEjx74357 for ; Wed, 7 Mar 2001 09:14:45 -0500 (EST) (envelope-from lockhart@alumni.caltech.edu) Received: from alumni.caltech.edu (localhost.localdomain [127.0.0.1]) by golem.fourpalms.org (Postfix) with ESMTP id E63B4FEB4; Wed, 7 Mar 2001 14:14:37 +0000 (UTC) Message-ID: <3AA6424D.AE3AE0A1@alumni.caltech.edu> Date: Wed, 07 Mar 2001 14:14:37 +0000 From: Thomas Lockhart Reply-To: lockhart@fourpalms.org Organization: Yes X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.17-21mdksmp i686) X-Accept-Language: en MIME-Version: 1.0 To: Karel Zak , Josh Berkus Cc: sqllist Subject: Re: No Documentation for to_char(INTERVAL, mask) References: <3AA469E9.DCFFC0AE@agliodbs.com> <20010306091316.B6115@ara.zf.jcu.cz> <3AA51CD1.8A55F64F@agliodbs.com> <20010307112335.A6373@ara.zf.jcu.cz> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200103/154 X-Sequence-Number: 1806 > > Given the lack of to_char(interval), I'd like to write a PLPGSQL > > function to fill the gap in the meantime... > I mean is too much difficult write a 'interval' to_char() version in > some procedural language without access to real (internal) form of > 'interval'. I agree with Karel's point that it may be a pain to use a procedural language to manipulate a "stringy" interval value. If you use a C function instead, you can get access to the internal manipulation functions already present, as well as access to system functions to manipulate a tm structure. A combination of contrib/ and src/backend/utils/adt/ information could give you a start on the C implementation (and that is rather easily moved into the backend later). I haven't tried the PL/PGSQL approach however. If you decide to proceed on that, let us know how it goes! - Thomas