-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Unknown variable errors with plpgsql composite types #156
Comments
Hi, I cannot check since I'm away for a brief vacation, but this could be
related to #154, that is, a problem in the underlying libpg_query, possibly
solved by a not-yet-merged PR.
|
Hi! Re-reading your report I see that it is clearly unrelated to #154, and indeed the following C program #include <pg_query.h>
#include <stdio.h>
#include <stdlib.h>
int main() {
PgQueryPlpgsqlParseResult result;
result = pg_query_parse_plpgsql(" \
CREATE FUNCTION public.dz_sumfunc(\
IN p_in INTEGER\
,OUT p_out public.dz_sumthing\
)\
AS $BODY$\
DECLARE\
BEGIN\
p_out.sumattribute := p_in;\
END;\
$BODY$\
LANGUAGE plpgsql;");
if (result.error) {
printf("error: %s at %d\n", result.error->message, result.error->cursorpos);
} else {
printf("%s\n", result.plpgsql_funcs);
}
pg_query_free_plpgsql_parse_result(result);
// Optional, this ensures all memory is freed upon program exit (useful when running Valgrind)
pg_query_exit();
return 0;
} fails even with svenklemm's branch. So I'm afraid there's little I can do on the |
Thanks for your help, I passed the problem over to libpg_query as pganalyze/libpg_query#260 |
Latest commits (in particular pganalyze/libpg_query@9a6fb9e) there fix issue #156, but they didn't release an official version yet.
This is fixed in just released v6.8. |
Hi Lele, great project,
When parsing a plpgsql function with a composite type, the parse fails with an unknown variable error.
Example:
In this case I'd like to parse the function code:
This returns
I assume the code does not currently support cross-referencing the attributes of the type when variables are checked? Is there a way to avoid the check and just accept that p_out.sumattribute is valid?
Thanks!
Paul
The text was updated successfully, but these errors were encountered: