-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
parsing plpgsql #43
Comments
No support for that right now. Maybe in the future. It's a thing I've thought about, but I haven't investigated how to also pull that bit of code out of the LLVM IR postgres-parser currently generates from the postgres sources. |
There are 2 interesting places in pl_comp.c
So I wonder if we can already parse the function definition (a function name, parameters, return type...) would it be not too crazy just trying to parse the function body with plpgsql_compile_inline and stitch it together with the current results? |
hmm. If it's that simple to just specify one function (_compile_inline), then all the llvm extraction stuff should do the rest for us. Are there additional headers we'll have to process? I assume there's additional structs to represent the plpgsql parse tree... |
I see plpgsql.h seems to have all the structs needed. Most probably PLpgSQL_execstate is not interesting in our case since it should include runtime data.
So we would need to tweak the actual string literal code block by adding |
I was actually poking at this a bit earlier today. The first thing is that the patch file postgres-parser applies against some of the Postgres Makefiles (in order to compile as llvm ir) purposely excludes the Additionally, the plpgsql code is not compiled into postgres proper, but as a postgres extension. So we're gonna have to do a lot of additional work in Then we'll be able to work on This is looking like a lot of work. It's probably good work to do, but it's not an afternoon job. |
Any way to parse plpgsql?
It parses correctly CreateFunctionStmt, but since function declaration itself is a string literal it is "correctly" parsed as a string.
Would be great if it could detect plpgsql language option and use the appropriate parser for that.
The text was updated successfully, but these errors were encountered: