Doubt in reset date style

Started by Manav Kumar12 months ago3 messagesbugs
Jump to latest
#1Manav Kumar
mkumar@yugabyte.com

Hi Team,
I have a doubt in the expected output file:
src/test/regress/expected/horology.out

at
https://github.com/postgres/postgres/blob/913c60b067aa1a618420fd0372c4df3cf5501863/src/test/regress/expected/horology.out#L117.

After doing the reset DateStyle.
Why output is still in 'Postgres, MDY' form rather than 'ISO, MDY'. As
reset would have reset the datestyle value to default value as 'ISO, MDY'.
I don't see any Alter cmd which changes the default value of DateStyle as
well.
Can you please correct me why this Pg Behaviour is expected.

Thanks In Advance!

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Manav Kumar (#1)
Re: Doubt in reset date style

On Wed, Apr 30, 2025 at 2:17 PM Manav Kumar <mkumar@yugabyte.com> wrote:

at
https://github.com/postgres/postgres/blob/913c60b067aa1a618420fd0372c4df3cf5501863/src/test/regress/expected/horology.out#L117.

I don't see any Alter cmd which changes the default value of DateStyle as
well.

There are many ways to change GUCs (I'm unsure where exactly this one comes
into play, feel free to look or wait for others to comment). Assume that
the script, when the first thing it does is 'SHOW DateStyle;' when issuing
"reset datestyle", will have its value reset to the shown value. The
calling environment has made it so that is the session default.

The session default is:

SHOW DateStyle;
DateStyle
---------------
Postgres, MDY
(1 row)

David J.

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Manav Kumar (#1)
Re: Doubt in reset date style

Manav Kumar <mkumar@yugabyte.com> writes:

I have a doubt in the expected output file:
src/test/regress/expected/horology.out

After doing the reset DateStyle.
Why output is still in 'Postgres, MDY' form rather than 'ISO, MDY'.

Because pg_regress.c does this:

setenv("PGDATESTYLE", "Postgres, MDY", 1);

which determines the environment for all the psql runs it
launches.

regards, tom lane