Re: Creating redwood datestyle in Postgres 12

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 26, 2021 at 9:42 AM Tom Lane <tgl@xxxxxxxxxxxxx> wrote:
Bruce Momjian <bruce@xxxxxxxxxx> 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.)

IIRC, in 2005-2008, the Oracle-style date/time format code was < 50 LoC total as PG already supports almost everything needed. After a cursory look through those parts of the PG code, I'd guess this is still < 100 LoC fully-functional. But, for the reasons Tom said, this is something that wouldn't make it into community PG. Of all the EDB features, this is the easiest to implement if you were OK running a patched version. I'm sure several consultants on here would write you a patch fairly quickly for a fee.

--
Jonah H. Harris


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux