Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3d88742

Browse files
committed
Fix crash when using CALL on an aggregate
Author: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>Reported-by: Rushabh Lathia <rushabh.lathia@gmail.com>
1 parent8e211f5 commit3d88742

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

‎src/backend/parser/parse_func.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,15 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
336336
Form_pg_aggregateclassForm;
337337
intcatDirectArgs;
338338

339+
if (proc_call)
340+
ereport(ERROR,
341+
(errcode(ERRCODE_UNDEFINED_FUNCTION),
342+
errmsg("%s is not a procedure",
343+
func_signature_string(funcname,nargs,
344+
argnames,
345+
actual_arg_types)),
346+
parser_errposition(pstate,location)));
347+
339348
tup=SearchSysCache1(AGGFNOID,ObjectIdGetDatum(funcid));
340349
if (!HeapTupleIsValid(tup))/* should not happen */
341350
elog(ERROR,"cache lookup failed for aggregate %u",funcid);

‎src/test/regress/expected/create_procedure.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ SELECT 5;
4141
$$;
4242
CALL ptest2();
4343
-- various error cases
44+
CALL version(); -- error: not a procedure
45+
ERROR: version() is not a procedure
46+
LINE 1: CALL version();
47+
^
48+
HINT: To call a function, use SELECT.
49+
CALL sum(1); -- error: not a procedure
50+
ERROR: sum(integer) is not a procedure
51+
LINE 1: CALL sum(1);
52+
^
4453
CREATE PROCEDURE ptestx() LANGUAGE SQL WINDOW AS $$ INSERT INTO cp_test VALUES (1, 'a') $$;
4554
ERROR: invalid attribute in procedure definition
4655
LINE 1: CREATE PROCEDURE ptestx() LANGUAGE SQL WINDOW AS $$ INSERT I...

‎src/test/regress/sql/create_procedure.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ CALL ptest2();
3030

3131
-- various error cases
3232

33+
CALL version();-- error: not a procedure
34+
CALLsum(1);-- error: not a procedure
35+
3336
CREATE PROCEDURE ptestx() LANGUAGE SQL WINDOWAS $$INSERT INTO cp_testVALUES (1,'a') $$;
3437
CREATE PROCEDURE ptestx() LANGUAGE SQL STRICTAS $$INSERT INTO cp_testVALUES (1,'a') $$;
3538
CREATE PROCEDURE ptestx(OUT aint) LANGUAGE SQLAS $$INSERT INTO cp_testVALUES (1,'a') $$;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp