Add collation assignment to CALL statement
Otherwise functions that require collation information will not have it if they are called in arguments to a CALL statement. Reported-by: Jean-Marc Voillequin <Jean-Marc.Voillequin@moodys.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/1EC8157EB499BF459A516ADCF135ADCE39FFAC54%40LON-WGMSX712.ad.moodys.net
This commit is contained in:
parent
d850af428d
commit
004f494b51
|
@ -2634,6 +2634,8 @@ transformCallStmt(ParseState *pstate, CallStmt *stmt)
|
||||||
true,
|
true,
|
||||||
stmt->funccall->location);
|
stmt->funccall->location);
|
||||||
|
|
||||||
|
assign_expr_collations(pstate, node);
|
||||||
|
|
||||||
stmt->funcexpr = castNode(FuncExpr, node);
|
stmt->funcexpr = castNode(FuncExpr, node);
|
||||||
|
|
||||||
result = makeNode(Query);
|
result = makeNode(Query);
|
||||||
|
|
|
@ -139,6 +139,13 @@ AS $$
|
||||||
SELECT NULL::int;
|
SELECT NULL::int;
|
||||||
$$;
|
$$;
|
||||||
CALL ptest6(1, 2);
|
CALL ptest6(1, 2);
|
||||||
|
-- collation assignment
|
||||||
|
CREATE PROCEDURE ptest7(a text, b text)
|
||||||
|
LANGUAGE SQL
|
||||||
|
AS $$
|
||||||
|
SELECT a = b;
|
||||||
|
$$;
|
||||||
|
CALL ptest7(least('a', 'b'), 'a');
|
||||||
-- various error cases
|
-- various error cases
|
||||||
CALL version(); -- error: not a procedure
|
CALL version(); -- error: not a procedure
|
||||||
ERROR: version() is not a procedure
|
ERROR: version() is not a procedure
|
||||||
|
|
|
@ -101,6 +101,17 @@ $$;
|
||||||
CALL ptest6(1, 2);
|
CALL ptest6(1, 2);
|
||||||
|
|
||||||
|
|
||||||
|
-- collation assignment
|
||||||
|
|
||||||
|
CREATE PROCEDURE ptest7(a text, b text)
|
||||||
|
LANGUAGE SQL
|
||||||
|
AS $$
|
||||||
|
SELECT a = b;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
CALL ptest7(least('a', 'b'), 'a');
|
||||||
|
|
||||||
|
|
||||||
-- various error cases
|
-- various error cases
|
||||||
|
|
||||||
CALL version(); -- error: not a procedure
|
CALL version(); -- error: not a procedure
|
||||||
|
|
Loading…
Reference in New Issue