pg-mem icon indicating copy to clipboard operation
pg-mem copied to clipboard

tests: add test to support restart identity and support pgsql-ast-parser@8

Open RafaelGSS opened this issue 4 years ago • 7 comments

This PR aims to support the new feature landed in [email protected]. Shall it be based on next instead of master?

RafaelGSS avatar Apr 29 '21 03:04 RafaelGSS

No, master is fine... This project is small so I try too keep things simple.

That said, you might try, but you might have some trouble integrating the breaking change that shipped with your PR I mentioned earlier (types & tests wont be happy if you dont).

If you cant, that's fine. I dont have the time to do it today, but I will try to do it ASAP, so let me know 😀

oguimbal avatar Apr 29 '21 06:04 oguimbal

I'll take a look at it, but probably you will be faster in addressing it.

RafaelGSS avatar Apr 29 '21 13:04 RafaelGSS

I took a look but likely I won't have time to work on it right now, several tests are break.

RafaelGSS avatar Apr 29 '21 14:04 RafaelGSS

Hello! I will not let it in limbo. I'm planning to work on it in the coming weeks. Probably, I'd like a direction from you somehow. I'll figure out the steps to work on it and come back here for feedback.

RafaelGSS avatar Jun 14 '21 23:06 RafaelGSS

Hi, I think that I'm almost done. I just need some help to figure out why the truncate tests that I've just added are not working. Perhaps I missed something in https://github.com/oguimbal/pgsql-ast-parser/pull/42 @oguimbal?

I also don't know if the approach that I did is the best one.

RafaelGSS avatar Aug 12 '21 01:08 RafaelGSS

Hi, this message:

  1. Deletes can truncate table and restart identity: Error: 🔨 Not supported 🔨 : The query you ran generated an AST which parts have not been read by the query planner. This means that those parts could be ignored:
⇨ .identity ("restart")

Means that your code has not read the .identity property of the input AST. This is a security I introduced to silently ignore parts of statements: The query runner gets a proxy to the parsed AST, which ultimately checks that the execution has accessed every property of the AST at least once.

ex: { type: 'select', ...blabla } and { type: 'select', distinct: true, ...blabla} would be executed with the same behaviour if distinct is never read (if, say, we forgot to implement the "distcint" mechanism) 👉 That will not be the case with this mechanism, which will tell you that you forgot to read the distcint property.

ps: Thanks for working on this 🙂 and sorry for my late replies

oguimbal avatar Aug 16 '21 15:08 oguimbal

This is a security I introduced to silently ignore parts of statements: The query runner gets a proxy to the parsed AST, which ultimately checks that the execution has accessed every property of the AST at least once.

I've seen this approach, however, I'm not sure where I should implement it, can you give me the file with an example?

RafaelGSS avatar Aug 18 '21 00:08 RafaelGSS