You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
investigating on a similar issue reported against pglast, I found that effectively the following example
#include<pg_query.h>#include<stdio.h>#include<stdlib.h>intmain() {
PgQueryPlpgsqlParseResultresult;
result=pg_query_parse_plpgsql("\ CREATE FUNCTION foo(cmd TEXT) RETURNS void AS $$\ DECLARE\ i INT;\ c CURSOR FOR SELECT generate_series(1,10);\ BEGIN\ FOR i IN c LOOP\ RAISE NOTICE 'i is %',i;\ END LOOP;\ END\ $$ 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();
return0;
}
emits
error: syntax error at or near "c" at 0
I tried looking at open issues targeting plpgsql, but failed to find one related to cursors.
The text was updated successfully, but these errors were encountered:
Hi,
investigating on a similar issue reported against
pglast
, I found that effectively the following exampleemits
I tried looking at open issues targeting
plpgsql
, but failed to find one related to cursors.The text was updated successfully, but these errors were encountered: