Question
Munich RE
MX
Last activity: 3 May 2022 11:06 EDT
How to call stored procedure with an output parameter in PostgreSQL - provided syntax does not seem to work
I find that the syntax provided in the Online help, for returning an Output parameter from a stored procedure, does not work. Perhaps someone can spot the error, or perhaps the syntax requirement has changed?
System Details
- Pega Platform 8.6.3
- system is in Pega Cloud
- Postgres version "PostgreSQL 11.13 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11), 64-bit"
Syntax recommended
The online help gives this syntax for an output parameter or in/out parameter. The syntax is entered in the Save tab of a Connect-SQL rule and called by an activity with RDB-Save
First, to create and call the procedure from the postgres SQL query tool in pgAdmin
I find that the syntax provided in the Online help, for returning an Output parameter from a stored procedure, does not work. Perhaps someone can spot the error, or perhaps the syntax requirement has changed?
System Details
- Pega Platform 8.6.3
- system is in Pega Cloud
- Postgres version "PostgreSQL 11.13 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11), 64-bit"
Syntax recommended
The online help gives this syntax for an output parameter or in/out parameter. The syntax is entered in the Save tab of a Connect-SQL rule and called by an activity with RDB-Save
First, to create and call the procedure from the postgres SQL query tool in pgAdmin
Within Pega, syntax attempted and results
In the activity, setting input and output properties to pass as parameters
In the Save tab of the Connect-SQL rule
First, the control for this experiment: calling the procedure with only input parameters
CALL bix.test_proc_return_output_param(
{.InputProperty in},
{.InputOutputProperty in}
)
The procedure runs - the Tracer shows no issues. A Show-Page step in the Activity shows us the contents of tmpPage after calling the procedure
<pagedata>
<pxObjClass>MCRH-MCRHMkt-BIX-Int-extract_summary</pxObjClass>
<InputProperty>a bit of input</InputProperty>
<InputOutputProperty>this will be overwritten if the procedure runs and returns output</InputOutputProperty>
<pzStatus>valid</pzStatus>
</pagedata>
Calling with Output parameters
The following table shows the syntax I used for the output parameter/property and the results
- Was the output property overwritten in tmpPage? if yes, the procedure succeeded. If no change, the procedure failed to return output.
- Observations in the Tracer
- Log message
Syntax for output param/ property |
about the syntax | tmpPage | Exception in Tracer? | Log message |
---|---|---|---|---|
{.InputOutputProperty in out} | from Pega online help | no change | Database Exception with no detail | Error in RDB-Save com.pega.pegarules.pub.database.DatabaseException: There was a problem getting a list: code: 0 SQLState: 2F003 Message: This statement does not declare an OUT parameter. Use { ?= call ... } to declare one. |
{.InputOutputProperty out} | from Pega online help | no change | Database Exception with no detail | Error in RDB-Save com.pega.pegarules.pub.database.DatabaseException: There was a problem getting a list: code: 0 SQLState: 2F003 Message: This statement does not declare an OUT parameter. Use { ?= call ... } to declare one. |
{.InputOutputProperty INOUT} | PostgreSQL documentation | no change | Database Exception with no detail | Error in RDB-Save com.pega.pegarules.pub.database.BadInputException: The specified SQL is invalid: Encountered "INOUT" at line 1, column 95. Was expecting one of: "out" ... "in" ... "DateTime" ... "Date" ... "Integer" ... "Double" ... "Decimal" ... "}" ... |
Conclusion
The log messages seem to indicate that Pega is not passing the syntax that PostgreSQL expects.
Am I missing something here?
***Edited by Moderator Marije to add Capability tags***