Re: Creating redwood datestyle in Postgres 12

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tim <timfosho(at)gmail(dot)com>, Paul Smith <paul(at)pscs(dot)co(dot)uk>, pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Creating redwood datestyle in Postgres 12
Date: 2021-03-26 13:42:28
Message-ID: 1578794.1616766148@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> On Fri, Mar 26, 2021 at 08:24:37AM -0400, Tim wrote:
>> I suppose that would be possible, but maintaining date triggers + views across
>> a large database would be a lot of work. I'm just one humble DBA and there is
>> 15-20 devs

> You probably need a custom data type with a custom C output function do
> to this efficiently.

If you're willing to write C code it likely wouldn't be that hard
to modify datetime output to honor a new datestyle value. (Input
is messier, but since we already read this format okay, I don't
think anything is needed on that end.)

It would seem reasonable to me to have a datestyle that emits
the month as a 3-letter abbreviation, so that you could get
'2021-Mar-26' or '26-Mar-2021' etc depending on the YMD/DMY/MDY
setting. I'd draw the line at emitting 2-digit years though.
(If you need to be that bug-compatible with Oracle, you should
stick with EDB --- that's what their AS product is for.)

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Jonah H. Harris 2021-03-26 15:27:22 Re: Creating redwood datestyle in Postgres 12
Previous Message Laurenz Albe 2021-03-26 12:38:18 Re: Old query lying around in pg_stat_activity for weeks