Comments (13)
I have found several examples that trigger the "safety belt"
Thanks for the report: I will try to address all of them, as soon as I'll restart working on v2, hopefully next week.
from pglast.
@lelit I'm not sure I understand, we already have them here https://github.com/lelit/pglast/blob/v2/pglast/keywords.py don't we ?
from pglast.
I'm not familiar enough with the parser to know what it implies for a keyword to be in one particular set or another. It would seem like depending on the context, you should check some sets and not others...
from pglast.
@tscholak, I think I cured both problems with the recent commits, any chance you can try current master and (possibly) confirm?
Note to myself: I should spend a tad of time learning the new "GH Actions"...
from pglast.
Thanks, I missed that, sorry. Can you try again with latest master please?
from pglast.
Great, released as v1.12.
from pglast.
@rdunklau, the right
vs "right"
issue appears to require the list of reserved words: maybe there's a way in libpgquery to expose the list defined in src/include/parser/kwlist.h
? I could not spend enough time figuring out how they are actually stored, see keywords.c...
from pglast.
Yes, sorry, one should never read (his own!) source code early in the morning, before first coffee!
from pglast.
That problem should be fixable by considering also TYPE_FUNC_NAME_KEYWORDS
, instead of only RESERVED_KEYWORDS
here. We should add a test to verify the behaviour with all different kinds of keyword (that is, checking also some COL_NAME_KEYWORDS
and UNRESERVED_KEYWORDS
...)
from pglast.
Thank you very much for the quick response!
I was not aware of the v2 effort. Are you saying that these issues are already fixed in the v2 branch?
Btw, the queries I am considering are from an open source dataset called Spider, https://yale-lily.github.io/spider. There are almost 10k queries in this dataset, and I think it could be a great asset for your work if you wanted to run a lot of there-and-back-again tests.
from pglast.
I was not aware of the v2 effort. Are you saying that these issues are already fixed in the v2 branch?
No, v1 and v2 are very close in functionality, but the latter targets PG12.
Btw, the queries I am considering are from an open source dataset called Spider, https://yale-lily.github.io/spider. There are almost 10k queries in this dataset, and I think it could be a great asset for your work if you wanted to run a lot of there-and-back-again tests.
Interesting indeed, thanks.
from pglast.
Hi @lelit, thank you very much for looking into this. The two changes you made fixed the examples reported above, well done! I'm very happy :)
What remained an issue though are nested intersect, union, and except blocks as mentioned in the last paragraph of my initial report.
Can you have a look please at situations like these:
(
SELECT * FROM "table"
) INTERSECT (
(
SELECT * FROM "table"
) UNION (
SELECT * FROM "table"
)
)
(
(
SELECT * FROM "table"
) UNION (
SELECT * FROM "table"
)
) INTERSECT (
SELECT * FROM "table"
)
etc.?
from pglast.
tried it, works as expected!!!
Thanks so much! Consider this issue closed.
from pglast.
Related Issues (20)
- Extra parens when formatting different operations HOT 2
- Support PG 15 HOT 5
- deparse_protobuf() broken on big-endian HOT 9
- Deparsing of modified queries and query parts HOT 3
- Double Quotes NOT preserved after parsing HOT 2
- Support statement types similar to referenced relations HOT 3
- Failed to install with pip (python 3.10.11) HOT 1
- ParseError when handling a statement containing a UUID HOT 1
- Token's reported location shifts when query has Turkish characters HOT 6
- Safety belt triggered HOT 2
- Duplicate `DEFERRABLE INITIALLY DEFERRED` in output HOT 3
- Can't compile with glibc >= 2.38 HOT 2
- pgpp remove important parentheses HOT 3
- Support PG16 HOT 6
- TypeError while init RawStmt from query parse tree dict which has A_Star. HOT 2
- (32-bit) FETCH ALL -> FETCH 2147483647 HOT 3
- Printing of AlterOwnerStmt for operator class results in error. HOT 3
- pglast>-6 install from wheel is missing symbol HOT 11
- referenced_relations: incorrectly treating LATERAL-ly-joined aliases as real relations HOT 4
- Question about the traverse method on v6 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pglast.