Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UZBjM-0001tY-7d for pgsql-bugs@arkaria.postgresql.org; Mon, 06 May 2013 03:04:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UZBjL-0002lM-EI for pgsql-bugs@arkaria.postgresql.org; Mon, 06 May 2013 03:04:47 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UZ3Vp-0002lE-5V for pgsql-bugs@postgresql.org; Sun, 05 May 2013 18:18:17 +0000 Received: from mahout.postgresql.org ([2001:4800:7903:4::123]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UZ3Vi-0004cF-Gx for pgsql-bugs@postgresql.org; Sun, 05 May 2013 18:18:16 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UZ3Vf-0001yv-RO for pgsql-bugs@postgresql.org; Sun, 05 May 2013 18:18:09 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1UZ3Va-0003QK-KE for pgsql-bugs@postgresql.org; Sun, 05 May 2013 18:18:02 +0000 Date: Sun, 05 May 2013 18:18:02 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #8135: current_setting('DateStyle'); does not reflect User setting To: pgsql-bugs@postgresql.org From: frank@heuveltop.nl X-Pg-Spam-Score: -3.1 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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:=20=20=20=20=20=20=20=20 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 =3D '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 =3D '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), '=3D', 1) AS key, split_part(unnest(rolconfig), '=3D', 2) AS value FROM pg_roles ) SELECT * FROM user_config WHERE rolname =3D USER AND key ILIKE 'DateStyle'; Thank you for reading, Frank --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs