Check a bit more carefully for preceeding ISO field tags
authorThomas G. Lockhart <lockhart@fourpalms.org>
Sat, 29 Dec 2001 18:40:58 +0000 (18:40 +0000)
committerThomas G. Lockhart <lockhart@fourpalms.org>
Sat, 29 Dec 2001 18:40:58 +0000 (18:40 +0000)
 when decoding date fields.

src/backend/utils/adt/datetime.c

index 864fede75b74e31022dcfb9beba32fc8d05e79f6..fa6bb88289a71aee497765ec39f0d668f4d9ac24 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.83 2001/12/29 18:31:29 thomas Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.84 2001/12/29 18:40:58 thomas Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -959,18 +959,18 @@ DecodeDateTime(char **field, int *ftype, int nf,
                    if (tzp == NULL)
                        return -1;
 
-                   if (ptype != 0)
-                   {
-                       /* Sanity check; should not fail this test */
-                       if (ptype != DTK_TIME)
-                           return -1;
-                       ptype = 0;
-                   }
-
-                   if (isdigit(*field[i]))
+                   if ((isdigit(*field[i]) || (ptype != 0))
                    {
                        char *cp;
 
+                       if (ptype != 0)
+                       {
+                           /* Sanity check; should not fail this test */
+                           if (ptype != DTK_TIME)
+                               return -1;
+                           ptype = 0;
+                       }
+
                        /* Starts with a digit but we already have a time field?
                         * Then we are in trouble with a date and time already...
                         */