Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 45d146a

Browse files
committed
Fix 'Q' format char parsing in the new to_timestamp() code. Used to crash.
1 parent 6462e7b commit 45d146a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/backend/utils/adt/formatting.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -----------------------------------------------------------------------
22
* formatting.c
33
*
4-
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.149 2008/10/06 05:03:27 tgl Exp $
4+
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.150 2008/11/10 17:36:53 heikki Exp $
55
*
66
*
77
* Portions Copyright (c) 1999-2008, PostgreSQL Global Development Group
@@ -1771,7 +1771,7 @@ from_char_set_int(int *dest, const int value, const FormatNode *node)
17711771

17721772
/*
17731773
* Read a single integer from the source string, into the int pointed to by
1774-
* 'dest'.
1774+
* 'dest'. If 'dest' is NULL, the result is discarded.
17751775
*
17761776
* In fixed-width mode (the node does not have the FM suffix), consume at most
17771777
* 'len' characters.
@@ -1862,7 +1862,8 @@ from_char_parse_int_len(int *dest, char **src, const int len, FormatNode *node)
18621862
errdetail("Value must be in the range %d to %d.",
18631863
INT_MIN, INT_MAX)));
18641864

1865-
from_char_set_int(dest, (int) result, node);
1865+
if (dest != NULL)
1866+
from_char_set_int(dest, (int) result, node);
18661867
return *src - init;
18671868
}
18681869

0 commit comments

Comments
 (0)