Re: generate_series for timestamptz and time zone problem

From: Przemysław Sztoch <przemyslaw(at)sztoch(dot)pl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: generate_series for timestamptz and time zone problem
Date: 2022-06-21 14:55:40
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Przemysław Sztoch wrote on 14.06.2022 21:46:
> Tom Lane wrote on 14.06.2022 15:43:
>> =?UTF-8?Q?Przemys=c5=82aw_Sztoch?=<przemyslaw(at)sztoch(dot)pl> writes:
>>> Please let me know what is the convention (procedure) of adding new
>>> functions to pg_proc. Specifically how oid is allocated.
>> See
>> (you should probably read that whole chapter for context).
> Thx.
> There is another patch.
> It works, but one thing is wrongly done because I lack knowledge.
> Where I'm using DirectFunctionCall3 I need to pass the timezone name,
> but I'm using cstring_to_text and I'm pretty sure there's a memory
> leak here. But I need help to fix this.
> I don't know how best to store the timezone in the generate_series
> context. Please, help.
Please give me feedback on how to properly store the timezone name in
the function context structure. I can't finish my work without it.

Additionally, I added a new variant of the date_trunc function that
takes intervals as an argument.
It enables functionality similar to date_bin, but supports monthly,
quarterly, annual, etc. periods.
In addition, it is resistant to the problems of different time zones and
daylight saving time (DST).

Przemysław Sztoch | Mobile +48 509 99 00 66

Attachment Content-Type Size
generate_series_with_timezone_date_trunc_v3.patch text/plain 15.5 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2022-06-21 16:02:41 Re: doc: array_length produces null instead of 0
Previous Message Jakub Wartak 2022-06-21 13:59:20 RE: Use fadvise in wal replay