pglast icon indicating copy to clipboard operation
pglast copied to clipboard

Visualization

Open takacsg84 opened this issue 2 years ago • 3 comments

Hi there! Is there a best practice to visualize this format of AST? Thank you!

takacsg84 avatar May 10 '22 12:05 takacsg84

Sorry, what do you mean? What do you want to visualize and what is this format of AST?

lelit avatar May 10 '22 14:05 lelit

Sorry for the ambiguous question. I would like to achieve something like this: https://shardingsphere.apache.org/document/current/img/sharding/sql_ast.png And by "this format" of AST what i mean is any output that I can get by using pglast package on a valid SQL query.

takacsg84 avatar May 10 '22 14:05 takacsg84

Interesting, but no, there's nothing similar, and it's not trivial to obtain that, although probably doable with some effort, for example as an alternative set of printer functions that emits dot syntax....

The main problem I foresee is how to tag the various pieces... I mean, in that picture you see fields as a tag of id and name, but what should happen when the query is not trivial, and the fields are actually subselects, or expressions?

lelit avatar May 10 '22 15:05 lelit