diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c index 6661a3d8a1d1044eccdef2e3c2e7bf2fd59a951d..3102f2089ec9bc017446b44d923ffecaf935fc3f 100644 --- a/src/backend/parser/parse_coerce.c +++ b/src/backend/parser/parse_coerce.c @@ -280,13 +280,13 @@ coerce_type(ParseState *pstate, Node *node, newcon->constlen = typeLen(targetType); newcon->constbyval = typeByVal(targetType); newcon->constisnull = con->constisnull; - /* Use the leftmost of the constant's and coercion's locations */ - if (location < 0) - newcon->location = con->location; - else if (con->location >= 0 && con->location < location) - newcon->location = con->location; - else - newcon->location = location; + + /* + * We use the original literal's location regardless of the position + * of the coercion. This is a change from pre-9.2 behavior, meant to + * simplify life for pg_stat_statements. + */ + newcon->location = con->location; /* * Set up to point at the constant's text if the input routine throws