Subject Re: [Firebird-Architect] Re: RFC: Please unify stored procedure execution
Author Ivan Prenosil
From: "Roman Rokytskyy" <rrokytskyy@...>
> > Can you explain why is a necessity to accept that people do
> > things against documentation and write stored procedure with RETURNS
> > clauses but without SUSPEND statements?
>
> because PSQL compiler does not complain when it sees following code:
>
> CREATE PROCEDURE test(a INTEGER) RETURNS (b INTEGER)
> AS BEGIN
> b = a;
> END
>
> Since compiler does not complain, this procedure is fully legitimate.
> But when I check whether it has output params and use "SELECT * FROM
> test(1)" I get empty result set, not a result set with 1 row and 1 column.

Why should PSQL complain ???? All these procedures are legal:

CREATE PROCEDURE test(a INTEGER) RETURNS (b INTEGER)
AS BEGIN
b = a;
END

CREATE PROCEDURE test(a INTEGER) RETURNS (b INTEGER)
AS BEGIN
b = a;
SUSPEND;
END

CREATE PROCEDURE test(a INTEGER) RETURNS (b INTEGER)
AS BEGIN
b = a;
SUSPEND;
SUSPEND;
END

The first returns zero rows, the second one row, the third two rows.
How the PSQL compiler could know what was programmers intentions ???
Is "programmer" or "Firebird" responsible for "correct" coding of SP ?
What if I am interested only in sideeffects, and do not want to return
any resultset ?

Ivan