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

ReindexStmt does not carry concurrent attribute rather params #152

Closed
bolajiwahab opened this issue Aug 8, 2024 · 3 comments
Closed

ReindexStmt does not carry concurrent attribute rather params #152

bolajiwahab opened this issue Aug 8, 2024 · 3 comments

Comments

@bolajiwahab
Copy link

Hi,

I noticed ReindexStmt does not carry concurrent attribute but rather a params attribute with DefElem which contains concurrently when it is a concurrent reindex.

The documentation stated there is a concurrent attribute as seen here https://pglast.readthedocs.io/en/v3/ast.html#:~:text=class%20pglast.ast.ReindexStmt(kind%3DNone%2C%20relation%3DNone%2C%20name%3DNone%2C%20options%3DNone%2C%20concurrent%3DNone)%C2%B6

Version of pglast is 6.2

@lelit
Copy link
Owner

lelit commented Aug 8, 2024

Hi!

First of all, you are referencing a (now) very old version of pglast (v3) that targets PG13 when the ReindexStmt structure effectively contained that concurrent flag, but that has been dropped in v4/PG14. I'm curious to know why you consulted v3 documentation, when you at last say you are using v6.2.

That said, I think that this is very similar to what I said in issue #150: the parser exposed by libpgquery is slightly different from the real one, in particular it does not execute some of the post-parse analysis that the real one does, as some of those cannot be perfomed without accessing the PG catalog tables (that libpgquery/pglast cannot do), as explained here.

I'm afraid there is little I can do to solve all those cases, surely not on pglast v3, sorry.

@bolajiwahab
Copy link
Author

bolajiwahab commented Aug 10, 2024

Hi!

First of all, you are referencing a (now) very old version of pglast (v3) that targets PG13 when the ReindexStmt structure effectively contained that concurrent flag, but that has been dropped in v4/PG14. I'm curious to know why you consulted v3 documentation, when you at last say you are using v6.2.

Oh, apologies, I didn't realise I was on v3 in the documentation. Thanks for pointing that out.

That said, I think that this is very similar to what I said in issue #150: the parser exposed by libpgquery is slightly different from the real one, in particular it does not execute some of the post-parse analysis that the real one does, as some of those cannot be perfomed without accessing the PG catalog tables (that libpgquery/pglast cannot do), as explained here.

I'm afraid there is little I can do to solve all those cases, surely not on pglast v3, sorry.

It is fine. I was checking the wrong documentation as against v6 and I thought maybe somehow it was missed out. The good news is that there is an attribute containing the information and this one liner is sufficient for my use-case.

params = [param.defname for param in node.params] if node.params else []

Feel free to close the issue.

Thanks.

@lelit
Copy link
Owner

lelit commented Aug 10, 2024

Right, thank you.

As said, coming up with list of those post-parse computed attributes is a really daunting task, as it would require human analysis of the PG sources because unfortunately the information does not emerge in neither the PG headers nor in the libpg_query byproducts.

@lelit lelit closed this as completed Aug 10, 2024
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

2 participants