Re: Fwd: Grammar railroad diagram

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>&nbsp;</div>

<div>sorry for the error. It was caused by my server using Tomcat&#39;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>&nbsp;</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>&nbsp;</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>&nbsp;</div>

<div>https://raw.githubusercontent.com/postgres/postgres/master/src/backend/parser/gram.y</div>

<div>&nbsp;</div>

<div>to</div>

<div>&nbsp;</div>

<div>https://bottlecaps.de/convert/</div>

<div>&nbsp;</div>

<div>then clicking &quot;Convert&quot; and on the bottom of the result page, &quot;View Diagram&quot;.</div>

<div>&nbsp;</div>

<div>Downloading diagrams now works after maxPostSize has been extended on my side.</div>

<div>&nbsp;</div>

<div>Best regards</div>

<div>Gunther</div>

<div>&nbsp;
<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>&nbsp;Dienstag, 06. Juli 2021 um 20:04 Uhr<br/>
<b>Von:</b>&nbsp;&quot;Domingo Alvarez Duarte&quot; &lt;mingodad(at)gmail(dot)com&gt;<br/>
<b>An:</b>&nbsp;grd(at)gmx(dot)net<br/>
<b>Betreff:</b>&nbsp;Fwd: Grammar railroad diagram</div>

<div name="quoted-content">
<p>Hello Gunther !</p>

<p>I&#39;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=&#39;mailto:bruce(at)momjian(dot)us&#39;; return false;" target="_blank">&lt;bruce(at)momjian(dot)us&gt;</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=&#39;mailto:mingodad(at)gmail(dot)com&#39;; return false;" target="_blank">&lt;mingodad(at)gmail(dot)com&gt;</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=&#39;mailto:pgsql-hackers(at)lists(dot)postgresql(dot)org&#39;; 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&#39;ve done a experimental tool to convert bison grammars to a kind of EBNF
understood by&nbsp;<a class="moz-txt-link-freetext" href="https://www.bottlecaps.de/rr/ui" target="_blank">https://www.bottlecaps.de/rr/ui</a>&nbsp;to generate railroad diagrams see
bellow the converted &#39;postgresql-13.3/src/backend/parser/gram.y&#39; and with some
hand made changes to allow view it at&nbsp;<a class="moz-txt-link-freetext" href="https://www.bottlecaps.de/rr/ui" target="_blank">https://www.bottlecaps.de/rr/ui</a>&nbsp;the order
of the rules could be changed to a better view of the railroad diagrams. Copy
and paste the EBNF bellow on&nbsp;<a class="moz-txt-link-freetext" href="https://www.bottlecaps.de/rr/ui" target="_blank">https://www.bottlecaps.de/rr/ui</a>&nbsp;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 &quot;Edit Grammar&quot;<br/>
4. choose &quot;Browse&quot; at the bottom<br/>
5. select the attachment you saved in #1<br/>
6. choose &quot;Load&quot; at the bottom<br/>
7. select &quot;View Diagram&quot;<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 &quot;Options&quot; allows many customizations.<br/>
<br/>
I tried downloading as XHTML+SVG and HTML+PNG but got an error:<br/>
<br/>
HTTP Status 500 &ndash; 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/>
&nbsp;
<pre class="moz-signature">--
Bruce Momjian <a class="moz-txt-link-rfc2396E" href="mailto:bruce(at)momjian(dot)us" onclick="parent.window.location.href=&#39;mailto:bruce(at)momjian(dot)us&#39;; return false;" target="_blank">&lt;bruce(at)momjian(dot)us&gt;</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

In response to

Browse pgsql-hackers by date

  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