From d202a5484a30f98d9ec98a024ce0ba3df389d74e Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Mon, 10 Nov 2008 17:36:53 +0000 Subject: [PATCH] Fix 'Q' format char parsing in the new to_timestamp() code. Used to crash. --- src/backend/utils/adt/formatting.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 3500d86e17..8f14391524 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -1771,7 +1771,7 @@ from_char_set_int(int *dest, const int value, const FormatNode *node) /* * Read a single integer from the source string, into the int pointed to by - * 'dest'. + * 'dest'. If 'dest' is NULL, the result is discarded. * * In fixed-width mode (the node does not have the FM suffix), consume at most * 'len' characters. @@ -1862,7 +1862,8 @@ from_char_parse_int_len(int *dest, char **src, const int len, FormatNode *node) errdetail("Value must be in the range %d to %d.", INT_MIN, INT_MAX))); - from_char_set_int(dest, (int) result, node); + if (dest != NULL) + from_char_set_int(dest, (int) result, node); return *src - init; } -- 2.39.5