{
if (n->type != NODE_TYPE_ACTION)
{
+ /*
+ * Separator, so consume one character from input string. Notice
+ * we don't insist that the consumed character match the format's
+ * character.
+ */
s++;
- /* Ignore spaces when not in FX (fixed width) mode */
- if (isspace((unsigned char) n->character) && !fx_mode)
- {
- while (*s != '\0' && isspace((unsigned char) *s))
- s++;
- }
continue;
}
+ /* Ignore spaces before fields when not in FX (fixed width) mode */
+ if (!fx_mode && n->key->id != DCH_FX)
+ {
+ while (*s != '\0' && isspace((unsigned char) *s))
+ s++;
+ }
+
from_char_set_mode(out, n->key->date_mode);
switch (n->key->id)
Wed Mar 02 00:00:00 2005 PST
(1 row)
+--
+-- Check handling of multiple spaces in format and/or input
+--
+SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS');
+ to_timestamp
+------------------------------
+ Sun Dec 18 03:38:15 2011 PST
+(1 row)
+
+SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS');
+ to_timestamp
+------------------------------
+ Sun Dec 18 23:38:15 2011 PST
+(1 row)
+
+SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS');
+ to_timestamp
+------------------------------
+ Sun Dec 18 23:38:15 2011 PST
+(1 row)
+
+SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS');
+ to_timestamp
+------------------------------
+ Sun Dec 18 23:38:15 2011 PST
+(1 row)
+
+SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS');
+ to_timestamp
+------------------------------
+ Sun Dec 18 23:38:15 2011 PST
+(1 row)
+
+SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS');
+ to_timestamp
+------------------------------
+ Sun Dec 18 03:38:15 2011 PST
+(1 row)
+
+SELECT to_date('2011 12 18', 'YYYY MM DD');
+ to_date
+------------
+ 12-18-2011
+(1 row)
+
+SELECT to_date('2011 12 18', 'YYYY MM DD');
+ to_date
+------------
+ 12-18-2011
+(1 row)
+
+SELECT to_date('2011 12 18', 'YYYY MM DD');
+ to_date
+------------
+ 12-08-2011
+(1 row)
+
+SELECT to_date('2011 12 18', 'YYYY MM DD');
+ to_date
+------------
+ 02-18-2011
+(1 row)
+
+SELECT to_date('2011 12 18', 'YYYY MM DD');
+ to_date
+------------
+ 12-18-2011
+(1 row)
+
+SELECT to_date('2011 12 18', 'YYYY MM DD');
+ to_date
+------------
+ 12-18-2011
+(1 row)
+
--
-- Check errors for some incorrect usages of to_timestamp()
--
SELECT to_timestamp(' 20050302', 'YYYYMMDD');
+--
+-- Check handling of multiple spaces in format and/or input
+--
+
+SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS');
+SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS');
+SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS');
+
+SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS');
+SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS');
+SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS');
+
+SELECT to_date('2011 12 18', 'YYYY MM DD');
+SELECT to_date('2011 12 18', 'YYYY MM DD');
+SELECT to_date('2011 12 18', 'YYYY MM DD');
+
+SELECT to_date('2011 12 18', 'YYYY MM DD');
+SELECT to_date('2011 12 18', 'YYYY MM DD');
+SELECT to_date('2011 12 18', 'YYYY MM DD');
+
--
-- Check errors for some incorrect usages of to_timestamp()
--