2011/12/6 ben hockey <neonstalw...@gmail.com>:
>
> On 12/6/2011 3:20 PM, Pavel Stehule wrote:
>>
>>
>> I am for ECMA datestyle
>>
>> it is there but just is not public, if I remember well
>>
>> Theoretically some custom output/input transform routine can be very
>> interesting - for domains, for boolean type - but on second hand - the
>> usage of this feature is minimal and there is risk for less advanced
>> users - so ECMA datestyle is very adequate solution.
>>
>> Regards
>>
>> Pavel
>>
> i don't particularly need anything other than ECMA datestyle - i was just
> under the impression that a more generic solution was preferred.  so, ECMA
> is enough to stop me from making any more noise about this.
>
> pavel, is there a way i can use this currently?  if not, would it take much
> effort to make this public?

I am not sure, if this patch is 100% correct

but it does something

the name is not ECMA but XSD - I hope, so both formats are same

postgres=# set datestyle TO 'XSD';
SET
postgres=# select current_timestamp;
               now
──────────────────────────────────
 2011-12-06T21:50:34.142933+01:00
(1 row)

postgres=# select '2011-12-06T22:46:53.455866+01:00'::timestamp;
         timestamp
────────────────────────────
 2011-12-06T22:46:53.455866
(1 row)

but maybe this will be some more, if XSD format is not exact ECMA

Regards

Pavel

>
> thanks,
>
> ben...
*** ./src/backend/commands/variable.c.orig	2011-09-22 23:57:57.000000000 +0200
--- ./src/backend/commands/variable.c	2011-12-06 21:46:03.489229819 +0100
***************
*** 123,128 ****
--- 123,135 ----
  			newDateOrder = DATEORDER_MDY;
  			have_order = true;
  		}
+ 		else if (pg_strcasecmp(tok, "XSD") == 0)
+ 		{
+ 			if (have_style && newDateStyle != USE_XSD_DATES)
+ 				ok = false;		/* conflicting styles */
+ 			newDateStyle = USE_XSD_DATES;
+ 			have_style = true;
+ 		}
  		else if (pg_strcasecmp(tok, "DEFAULT") == 0)
  		{
  			/*
***************
*** 191,196 ****
--- 198,206 ----
  		case USE_GERMAN_DATES:
  			strcpy(result, "German");
  			break;
+ 		case USE_XSD_DATES:
+ 			strcpy(result, "XSD");
+ 			break;
  		default:
  			strcpy(result, "Postgres");
  			break;
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to