Commit 7fb27531 authored by Heikki Linnakangas's avatar Heikki Linnakangas

Modify the new to_timestamp implementation so that end-of-format-string

is treated like a non-digit separator. This fixes the inconsistency in
examples like:

to_timestamp('2008-01-2', 'YYYY-MM-DD') -- didn't work

and

to_timestamp('2008-1-02', 'YYYY-MM-DD') -- did work
parent ec543db7
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
* formatting.c * formatting.c
* *
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.150 2008/11/10 17:36:53 heikki Exp $ * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.151 2008/12/01 17:11:18 heikki Exp $
* *
* *
* Portions Copyright (c) 1999-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1999-2008, PostgreSQL Global Development Group
...@@ -1678,8 +1678,9 @@ is_next_separator(FormatNode *n) ...@@ -1678,8 +1678,9 @@ is_next_separator(FormatNode *n)
*/ */
n++; n++;
/* end of format string is treated like a non-digit separator */
if (n->type == NODE_TYPE_END) if (n->type == NODE_TYPE_END)
return FALSE; return TRUE;
if (n->type == NODE_TYPE_ACTION) if (n->type == NODE_TYPE_ACTION)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment