pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: frank@heuveltop.nl
To: pgsql-bugs@postgresql.org
Subject: BUG #8135: current_setting('DateStyle'); does not reflect User setting
Date: Sun, 05 May 2013 18:18:02 +0000
Message-ID: <E1UZ3Va-0003QK-KE@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      8135
Logged by:          Frank van den Heuvel
Email address:      frank@heuveltop.nl
PostgreSQL version: 9.1.8
Operating system:   Ubuntu 12.04
Description:        

Dear developers,

I think I have found a bug. I am building an application that relies on user
setting of TimeZone and DateStyle.

After
 ALTER ROLE frank SET TimeZone = 'Europe/Amsterdam';

Where the TimeZone differs from the default timezone.

 SELECT current_setting('TimeZone');

Gives the correct answer.

But this same doesn't work for DateStyle

  ALTER ROLE frank SET DateStyle = 'SQL, DMY';

Where the DateStyle differs from the default DateStyle

 SELECT current_setting('DateStyle');

Gives the system/database setting but not the user setting; while the
setting does have its effect on the output of date's and timestamps. This
might also effect other user settings, but I haven't found any yet.

My application needs to know what the user setting is, so this is a
workaround that I use:

WITH user_config AS (
SELECT rolname, split_part(unnest(rolconfig), '=', 1) AS key,
split_part(unnest(rolconfig), '=', 2) AS value
FROM pg_roles )

SELECT *
FROM user_config
WHERE rolname = USER
AND key ILIKE 'DateStyle';


Thank you for reading,

Frank



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (2+ messages)  latest in thread

Message-ID: <E1UZ3Va-0003QK-KE@wrigleys.postgresql.org>
Permalink:  ../E1UZ3Va-0003QK-KE@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1UZ3Va-0003QK-KE@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: frank@heuveltop.nl
  Subject: Re: BUG #8135: current_setting('DateStyle'); does not reflect User setting
  In-Reply-To: <E1UZ3Va-0003QK-KE@wrigleys.postgresql.org>
  References: <E1UZ3Va-0003QK-KE@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox