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

Create native nuget for libpg_query #22

Open
SoftStoneDevelop opened this issue Jun 4, 2023 · 6 comments
Open

Create native nuget for libpg_query #22

SoftStoneDevelop opened this issue Jun 4, 2023 · 6 comments
Labels

Comments

@SoftStoneDevelop
Copy link
Owner

SoftStoneDevelop commented Jun 4, 2023

https://github.com/pganalyze/libpg_query

@SoftStoneDevelop SoftStoneDevelop changed the title Create native nuget for libpg_query (https://github.com/pganalyze/libpg_query) Create native nuget for libpg_query Jun 4, 2023
@SoftStoneDevelop
Copy link
Owner Author

The main problem: to build a dll, you have to go through a whole fucking quest on windows to run the makefile.
If someone has a desire or an opportunity (maybe he works with C) to build a project for Windows, MacOS, Linux - offer.

@SoftStoneDevelop
Copy link
Owner Author

So, if I successfully solve this issue, I need to replace ~StartInner and other spec marks with -- (two dashes) like --StartInner

@SoftStoneDevelop
Copy link
Owner Author

Life is pain and it's not news:

pganalyze/libpg_query#44
The parser does not support Windows. The solution to this problem is clearly not in the competence of Gedaq and not in mine, due to little knowledge in C.
Therefore, we are waiting for the support to be added.

@SoftStoneDevelop
Copy link
Owner Author

Theoretical Pervert way: using ironpython3 + pglast. Need investigation of possibility usage.

@karlhorky
Copy link

If you manage to get libpg_query working on Windows, would love to give this a try!

@SoftStoneDevelop
Copy link
Owner Author

  1. Install IronPython.StdLib and IronPython nuget packages.
  2. Replace "from enum" to "from aenum" in all .py enums "https://github.com/lelit/pglast/tree/v4/pglast/enums". Because IntFlag live in "aenum".
  3. Try to run:
ScriptEngine engine = Python.CreateEngine();
            var paths = engine.GetSearchPaths().ToList();
            paths.Add("path to cloned https://github.com/lelit/pglast");
            paths.Add("path to cloned https://github.com/ethanfurman/aenum");
            engine.SetSearchPaths(paths);

            engine.Execute(@"
from pglast import parse_sql

root = parse_sql('select 1')
print(root)
");

Result:
Throws exception IronPython.Runtime.Exceptions.ImportException: 'No module named 'parser''.
And then i realise "he use cython"(parser.pyx).
So IronPython is also a dead end, because it will not help with a library written in C.

If there are no ideas where I went wrong, for now the only way out is to go back to trying to compile the project in C, as I originally tried.

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

No branches or pull requests

2 participants