proposal - custom format for date, timestamp

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: proposal - custom format for date, timestamp
Date: 2010-06-02 11:56:51
Message-ID: AANLkTingXMrYG_BcI6IPxUIfV6KrZn-FDNAIRd3OZyfP@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

I thinking about request on custom datetime format. My first idea is:

a) add new datestyle format "custom"
b) add new GUC variables - custom_date_format, custom_time_format,
custom_timestamp_format

There are some questions:
a) what is good behave when datestyle = custom, but some necessary
custom_*_format is empty?
b) custom format is used for output, have to be used for input too?
c) when input isn't correct for custom format, should be parsed by usual way?

I did some conceptual prototype - see attachment

postgres=# set datestyle to custom;
SET
Time: 0,450 ms
postgres=# select current_date;
ERROR: custom_datestyle_format is empty
postgres=# set custom_datestyle_format to 'Dy Mon YYYY';
SET
Time: 0,409 ms
postgres=# select current_date;
date
--------------
Wed Jun 2010
(1 row)

Time: 0,485 ms

Regards
Pavel Stehule

Attachment Content-Type Size
custom_format.diff application/octet-stream 4.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2010-06-02 13:24:30 Re: Streaming Replication: Checkpoint_segment and wal_keep_segments on standby
Previous Message Heikki Linnakangas 2010-06-02 11:40:52 Re: Streaming Replication: Checkpoint_segment and wal_keep_segments on standby