From: | grd(at)gmx(dot)net |
---|---|
To: | Domingo Alvarez Duarte <mingodad(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Fwd: Grammar railroad diagram |
Date: | 2021-07-09 14:13:38 |
Message-ID: | trinity-afe0193f-d8ea-415f-ad79-1e51d5a84f09-1625840018305@3c-app-gmx-bs70 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Domingo, Bruce,</div>
<div> </div>
<div>sorry for the error. It was caused by my server using Tomcat's default maxPostSize of 2MB, which</div>
<div>is not sufficient for the diagrams generated from the Postgres grammar. I have now extended it</div>
<div>to 10MB.</div>
<div> </div>
<div>By the way, I had already created diagrams for PostgreSQL back in 2017, please find them here:<br/>
<br/>
https://cdn.rawgit.com/GuntherRademacher/1e5a275f433fdc61bc4e81e24c287d67/raw/7c8599f5d2bf8450c52750abd70bb4bc90369bf8/gram.xhtml</div>
<div> </div>
<div>At the time, this answered a question on StackOverflow, but apparently that question has been</div>
<div>deleted since. Those diagrams were created by pasting the content of</div>
<div> </div>
<div>https://raw.githubusercontent.com/postgres/postgres/master/src/backend/parser/gram.y</div>
<div> </div>
<div>to</div>
<div> </div>
<div>https://bottlecaps.de/convert/</div>
<div> </div>
<div>then clicking "Convert" and on the bottom of the result page, "View Diagram".</div>
<div> </div>
<div>Downloading diagrams now works after maxPostSize has been extended on my side.</div>
<div> </div>
<div>Best regards</div>
<div>Gunther</div>
<div>
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Dienstag, 06. Juli 2021 um 20:04 Uhr<br/>
<b>Von:</b> "Domingo Alvarez Duarte" <mingodad(at)gmail(dot)com><br/>
<b>An:</b> grd(at)gmx(dot)net<br/>
<b>Betreff:</b> Fwd: Grammar railroad diagram</div>
<div name="quoted-content">
<p>Hello Gunther !</p>
<p>I've sent this to postgresql and they reported the error bellow.</p>
<div class="moz-forward-container">Cheers !<br/>
<br/>
-------- Forwarded Message --------
<table border="0" cellpadding="0" cellspacing="0" class="moz-email-headers-table">
<tbody>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject:</th>
<td>Re: Grammar railroad diagram</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date:</th>
<td>Tue, 6 Jul 2021 12:51:54 -0400</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">From:</th>
<td>Bruce Momjian <a class="moz-txt-link-rfc2396E" href="mailto:bruce(at)momjian(dot)us" onclick="parent.window.location.href='mailto:bruce(at)momjian(dot)us'; return false;" target="_blank"><bruce(at)momjian(dot)us></a></td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">To:</th>
<td>Domingo Alvarez Duarte <a class="moz-txt-link-rfc2396E" href="mailto:mingodad(at)gmail(dot)com" onclick="parent.window.location.href='mailto:mingodad(at)gmail(dot)com'; return false;" target="_blank"><mingodad(at)gmail(dot)com></a></td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">CC:</th>
<td><a class="moz-txt-link-abbreviated" href="mailto:pgsql-hackers(at)lists(dot)postgresql(dot)org" onclick="parent.window.location.href='mailto:pgsql-hackers(at)lists(dot)postgresql(dot)org'; return false;" target="_blank">pgsql-hackers(at)lists(dot)postgresql(dot)org</a></td>
</tr>
</tbody>
</table>
<br/>
<br/>
On Sat, Jul 3, 2021 at 10:39:02AM +0200, Domingo Alvarez Duarte wrote:
<blockquote>
<pre class="moz-quote-pre">I've done a experimental tool to convert bison grammars to a kind of EBNF
understood by <a class="moz-txt-link-freetext" href="https://www.bottlecaps.de/rr/ui" target="_blank">https://www.bottlecaps.de/rr/ui</a> to generate railroad diagrams see
bellow the converted 'postgresql-13.3/src/backend/parser/gram.y' and with some
hand made changes to allow view it at <a class="moz-txt-link-freetext" href="https://www.bottlecaps.de/rr/ui" target="_blank">https://www.bottlecaps.de/rr/ui</a> the order
of the rules could be changed to a better view of the railroad diagrams. Copy
and paste the EBNF bellow on <a class="moz-txt-link-freetext" href="https://www.bottlecaps.de/rr/ui" target="_blank">https://www.bottlecaps.de/rr/ui</a> tab Edit Grammar
then switch to the tab View Diagram.
</pre>
</blockquote>
<br/>
That is pretty cool. I had trouble figuring out how to get it working,<br/>
so here are the steps I used:<br/>
<br/>
1. save my attachment (created by Domingo)<br/>
2. go to <a class="moz-txt-link-freetext" href="https://www.bottlecaps.de/rr/ui" target="_blank">https://www.bottlecaps.de/rr/ui</a><br/>
3. select "Edit Grammar"<br/>
4. choose "Browse" at the bottom<br/>
5. select the attachment you saved in #1<br/>
6. choose "Load" at the bottom<br/>
7. select "View Diagram"<br/>
<br/>
You can even click on the yellow boxes to see the sub-grammar. People<br/>
have asked for railroad diagrams in the past, and this certainly<br/>
produces them, and "Options" allows many customizations.<br/>
<br/>
I tried downloading as XHTML+SVG and HTML+PNG but got an error:<br/>
<br/>
HTTP Status 500 – Internal Server Error<br/>
<br/>
Type Exception Report<br/>
<br/>
Message The multi-part request contained parameter data (excluding<br/>
uploaded files) that exceeded the limit for maxPostSize set on the<br/>
associated connector<br/>
<br/>
Description The server encountered an unexpected condition that<br/>
prevented it from fulfilling the request.<br/>
<br/>
It might be nice to download this output and host it on the Postgres<br/>
website at some point.<br/>
<pre class="moz-signature">--
Bruce Momjian <a class="moz-txt-link-rfc2396E" href="mailto:bruce(at)momjian(dot)us" onclick="parent.window.location.href='mailto:bruce(at)momjian(dot)us'; return false;" target="_blank"><bruce(at)momjian(dot)us></a> <a class="moz-txt-link-freetext" href="https://momjian.us" target="_blank">https://momjian.us</a>
EDB <a class="moz-txt-link-freetext" href="https://enterprisedb.com" target="_blank">https://enterprisedb.com</a>
If only the physical world exists, free will is an illusion.
</pre>
</div>
</div>
</div>
</div>
</div></div></body></html>
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/html | 6.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2021-07-09 14:43:46 | Re: Query about time zone patterns in to_char |
Previous Message | Tom Lane | 2021-07-09 14:06:18 | Re: Preventing abort() and exit() calls in libpq |