Re: parser that could handle "FROM... SELECT..." as well as "SELECT... FROM..."

Pavel Stehule <[email protected]> Tue, 8 Oct 2019 08:32:01 +0200
Newsgroups gmane.comp.db.postgresql.sql
Message-ID <CAFj8pRCsrM=2=Tz0=PGHntcWFSNV4ig4kxdY4sSRQ0M0t1QVhw@mail.gmail.com>
--0000000000009ef06a05946055f0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi

=C3=BAt 8. 10. 2019 v 8:12 odes=C3=ADlatel Marius Andreiana <
[email protected]> napsal:

> Hello Postgres folks,
>
> After reading
> https://jvns.ca/blog/2019/10/03/sql-queries-don-t-start-with-select/
> and the discussions at https://news.ycombinator.com/item?id=3D21150606
> I'd also like to write "FROM... SELECT..." instead of "SELECT... FROM..."=
.
>

This article is little bit strange, it mix syntax and execution together

>
> Postgres doesn't support this though. Would it be possible to please add
> parsing support for this syntax as well?
>

PostgreSQL supports ANSI/SQL.  ANSI/SQL doesn't allow use clauses in any
order.

Personally I don't see any benefit of proposed feature - It breaks
portability of SQL queries (that is not high today).

Regards

Pavel


> Somebody mentioned:
> Engines don=E2=80=99t run sql directly. They make an AST, make an interme=
diate
> representation of instructions and then execute.
> So if it results in same AST, the parser should be flexible.
>

> Thanks!
> Marius
>

--0000000000009ef06a05946055f0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi<br></div><br><div class=3D"gmail_quote"><div dir=
=3D"ltr" class=3D"gmail_attr">=C3=BAt 8. 10. 2019 v=C2=A08:12 odes=C3=ADlat=
el Marius Andreiana &lt;<a href=3D"mailto:[email protected]">mariu=
[email protected]</a>&gt; napsal:<br></div><blockquote class=3D"gmail_q=
uote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,2=
04);padding-left:1ex"><div dir=3D"ltr">Hello Postgres folks,<div><br></div>=
<div>After reading</div><div><a href=3D"https://jvns.ca/blog/2019/10/03/sql=
-queries-don-t-start-with-select/" target=3D"_blank">https://jvns.ca/blog/2=
019/10/03/sql-queries-don-t-start-with-select/</a></div><div>and the discus=
sions at=C2=A0<a href=3D"https://news.ycombinator.com/item?id=3D21150606" t=
arget=3D"_blank">https://news.ycombinator.com/item?id=3D21150606</a></div><=
div>I&#39;d also like to write=C2=A0&quot;FROM... SELECT...&quot; instead o=
f &quot;SELECT... FROM...&quot;.</div></div></blockquote><div><br></div><di=
v>This article is little bit strange, it mix syntax and execution together=
=C2=A0 <br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=
=3D"ltr"><div><br></div><div>Postgres doesn&#39;t support this though. Woul=
d it be possible to please add parsing support for this syntax as well?</di=
v></div></blockquote><div><br></div><div>PostgreSQL supports ANSI/SQL.=C2=
=A0 ANSI/SQL doesn&#39;t allow use clauses in any order.</div><div><br></di=
v><div>Personally I don&#39;t see any benefit of proposed feature - It brea=
ks portability of SQL queries (that is not high today).</div><div><br></div=
><div>Regards</div><div><br></div><div>Pavel<br></div><div><br></div><block=
quote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1=
px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div><br></div=
><div>Somebody mentioned:</div><div>Engines don=E2=80=99t run sql directly.=
 They make an AST, make an intermediate representation of instructions and =
then execute.<br>So if it results in same AST, the parser should be flexibl=
e.=C2=A0 <br></div></div></blockquote><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddi=
ng-left:1ex"><div dir=3D"ltr"><div></div><div><br></div><div>Thanks!<br cle=
ar=3D"all"><div><div dir=3D"ltr"><div dir=3D"ltr"><div><div dir=3D"ltr"><di=
v><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr">Marius</div>=
</div></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div></div>

--0000000000009ef06a05946055f0--