You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be very nice if you could expose pg_query_nodes_to_json() so that we can convert existing trees to JSON.
E.g. I can get the necessary query tree directly from Postgres via the pg_catalog:
psql -At -U superuser -d testdb -c "select r.ev_action from pg_catalog.pg_rewrite r left join pg_catalog.pg_class c on r.ev_class = c.oid where c.relname = 'my_sick_view'" > /tmp/my_sick_view.qtree
In my case this results in a file over 180KB.
Now it would be nice to be able to write a simple program to convert it to JSON using pg_query_nodes_to_json(), but it is not in the public header.
The text was updated successfully, but these errors were encountered:
@mdr1384 I think that sounds reasonable - if I understand correctly you would also need a way to go from the built-in node text format (the one thats very obscure and hard to read) to in-memory structs, correct?
Or were you thinking of using this as an extension in a running Postgres server? (then you'd only need access to the function you mention)
I was not thinking that anything special needed to be running on the server. Just a way to get the JSON query tree for a given PostgreSQL query tree. Don't need in-memory structs either, there are already libs that convert the JSON string to structs.
FYI my reasoning was that converting the SQL schema definition as in your basic example was failing for me due to the extreme complexity of the schema (a VIEW with about 70 columns and many JOINs and function calls and a couple WITH clauses.) So I figured let PostgreSQL do the SQL parsing and then all I need is to convert PostgreSQL query tree language to JSON. I saw there was a function to do that but it was not public.
WISHLIST ITEM:
It would be very nice if you could expose
pg_query_nodes_to_json()
so that we can convert existing trees to JSON.E.g. I can get the necessary query tree directly from Postgres via the pg_catalog:
In my case this results in a file over 180KB.
Now it would be nice to be able to write a simple program to convert it to JSON using
pg_query_nodes_to_json()
, but it is not in the public header.The text was updated successfully, but these errors were encountered: