Re: Document DateStyle effect on jsonpath string()

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Document DateStyle effect on jsonpath string()
Date: 2024-07-09 14:35:09
Message-ID: CACJufxHE6q47-GEf3Kk0pD+Snr3yZMM4Byig2=bQKV8js7sP-A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 4, 2024 at 10:45 PM David E. Wheeler <david(at)justatheory(dot)com> wrote:
>
> On Jul 4, 2024, at 04:28, jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>
> > Do you need to reset the datestyle?
>
> Wouldn’t hurt but it’s not necessary, no. It’s set only for the execution of this file, and there are no more calls that rely on it.
>
> > also the above query is time zone sensitive, maybe the time zone is
> > set in another place, but that's not explicit?
>
> It’s implicit in how PostgreSQL runs its test suite; other tests later change it.

I inserted these two commands into it.
show time zone;
show datestyle;

turns out in the test suite, the default data style is "Postgres,
MDY", and the default time zone is "PST8PDT".
These two implicit settings weren't mentioned anywhere.

your tests look ok to me.
one tiny complaint would be maybe we need `reset datestyle`.
Because we are in line 600 of src/test/regress/sql/jsonb_jsonpath.sql,
We want to make sure the following test is not influenced by guc datestyle.

> > <para>
> > - String value converted from a JSON boolean, number, string, or datetime
> > + String value converted from a JSON boolean, number, string, or
> > + datetime. Note that the string output of datetimes is determined by
> > + the <xref linkend="guc-datestyle"/> parameter.
> > </para>
> > imho, your patch has just too many examples.
>
> I’m confused. There are no examples in my patch, or this bit you cite.
>
> > for explaining the above sentence, the following example should be enough.
>
> Are you referring to the tests? I made them comprehensive so that we reliably demonstrate the behavior of the string() method on all the date/time data types. They are not examples, not in the documentation sense at least.
>
I mean tests, sorry for the confusion. added several more tests should be fine.

overall looks good to me.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2024-07-09 14:41:41 Re: Optimize WindowAgg's use of tuplestores
Previous Message David E. Wheeler 2024-07-09 14:22:03 Re: jsonpath: Inconsistency of timestamp_tz() Output