Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when parsing PL/pgSQL function with RETURN NEXT; #248

Open
MGorkov opened this issue May 3, 2024 · 0 comments
Open

Error when parsing PL/pgSQL function with RETURN NEXT; #248

MGorkov opened this issue May 3, 2024 · 0 comments

Comments

@MGorkov
Copy link

MGorkov commented May 3, 2024

Trying to parse the following example gives the error missing expression at or near ";"

CREATE OR REPLACE FUNCTION public.test_pl(s integer, e integer)
  RETURNS TABLE(id INTEGER) AS $$
BEGIN
  id := s;
LOOP
  EXIT WHEN id>e;
  RETURN NEXT;
  id := id + 1;
END LOOP;
END
$$
  LANGUAGE plpgsql;

after debugging i discovered that plpgsql_curr_compile->out_param_varno is -1 in function make_return_next_stmt for this example , so the function continues execution in the block else with comment "Note that a well-formed expression is required here; anything else is a compile-time error"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant