agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedparser that could handle "FROM... SELECT..." as well as "SELECT... FROM..."
5+ messages / 3 participants
[nested] [flat]
* parser that could handle "FROM... SELECT..." as well as "SELECT... FROM..."
@ 2019-10-08 06:12 Marius Andreiana <marius.andreiana@gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Marius Andreiana @ 2019-10-08 06:12 UTC (permalink / raw)
To: pgsql-sql@lists.postgresql.org
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=21150606
I'd also like to write "FROM... SELECT..." instead of "SELECT... FROM...".
Postgres doesn't support this though. Would it be possible to please add
parsing support for this syntax as well?
Somebody mentioned:
Engines don’t run sql directly. They make an AST, make an intermediate
representation of instructions and then execute.
So if it results in same AST, the parser should be flexible.
Thanks!
Marius
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: parser that could handle "FROM... SELECT..." as well as "SELECT... FROM..."
@ 2019-10-08 06:32 Pavel Stehule <pavel.stehule@gmail.com>
parent: Marius Andreiana <marius.andreiana@gmail.com>
0 siblings, 2 replies; 5+ messages in thread
From: Pavel Stehule @ 2019-10-08 06:32 UTC (permalink / raw)
To: Marius Andreiana <marius.andreiana@gmail.com>; +Cc: pgsql-sql@lists.postgresql.org
Hi
út 8. 10. 2019 v 8:12 odesílatel Marius Andreiana <
marius.andreiana@gmail.com> 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=21150606
> 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’t run sql directly. They make an AST, make an intermediate
> representation of instructions and then execute.
> So if it results in same AST, the parser should be flexible.
>
> Thanks!
> Marius
>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: parser that could handle "FROM... SELECT..." as well as "SELECT... FROM..."
@ 2019-10-08 07:14 Marius Andreiana <marius.andreiana@gmail.com>
parent: Pavel Stehule <pavel.stehule@gmail.com>
1 sibling, 1 reply; 5+ messages in thread
From: Marius Andreiana @ 2019-10-08 07:14 UTC (permalink / raw)
To: Pavel Stehule <pavel.stehule@gmail.com>; +Cc: pgsql-sql@lists.postgresql.org
Hi Pavel,
> Personally I don't see any benefit of proposed feature - It breaks
> portability of SQL queries (that is not high today).
>
It would be up to each developer which form to use. Some use only
PostgreSQL and don't need portability.
Also, more DBs could parse the new format as well in the future, so this
issue will go away. Need to start somewhere.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: parser that could handle "FROM... SELECT..." as well as "SELECT... FROM..."
@ 2019-10-08 07:25 Pavel Stehule <pavel.stehule@gmail.com>
parent: Marius Andreiana <marius.andreiana@gmail.com>
0 siblings, 0 replies; 5+ messages in thread
From: Pavel Stehule @ 2019-10-08 07:25 UTC (permalink / raw)
To: Marius Andreiana <marius.andreiana@gmail.com>; +Cc: pgsql-sql@lists.postgresql.org
út 8. 10. 2019 v 9:14 odesílatel Marius Andreiana <
marius.andreiana@gmail.com> napsal:
> Hi Pavel,
>
>
>> Personally I don't see any benefit of proposed feature - It breaks
>> portability of SQL queries (that is not high today).
>>
> It would be up to each developer which form to use. Some use only
> PostgreSQL and don't need portability.
> Also, more DBs could parse the new format as well in the future, so this
> issue will go away. Need to start somewhere.
>
I cannot to accept this argument. Lot of developers miss global
perspective, and expect what is supported by one database, then all others
supports too. Lot of code is created by mistake, and if parser will be
tolerant, then this mistake will not be fixed.
I don't like a idea, so Postgres is first database that breaks ANSI/SQL. If
ANSI/SQL changes syntax, I'll be for it.
More, I think so current strict mode is better for readability - every body
knows, where can expect some, it is easy and simple. Don't see any reason
to change it.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: parser that could handle "FROM... SELECT..." as well as "SELECT... FROM..."
@ 2019-10-08 14:29 Tom Lane <tgl@sss.pgh.pa.us>
parent: Pavel Stehule <pavel.stehule@gmail.com>
1 sibling, 0 replies; 5+ messages in thread
From: Tom Lane @ 2019-10-08 14:29 UTC (permalink / raw)
To: Pavel Stehule <pavel.stehule@gmail.com>; +Cc: Marius Andreiana <marius.andreiana@gmail.com>; pgsql-sql@lists.postgresql.org
Pavel Stehule <pavel.stehule@gmail.com> writes:
> út 8. 10. 2019 v 8:12 odesílatel Marius Andreiana <
> marius.andreiana@gmail.com> napsal:
>> 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=21150606
>> I'd also like to write "FROM... SELECT..." instead of "SELECT... FROM...".
> Personally I don't see any benefit of proposed feature - It breaks
> portability of SQL queries (that is not high today).
The one advantage I could see to this is that, in principle,
it would allow tab-completion in the SELECT list to know
what column names to offer. Of course, making that actually
work would take a huge amount of effort, since psql's tab
completion "parser" is so lame.
On balance I agree that's not attractive enough to justify the
compatibility gotchas we'd be introducing. Postgres does have
some intentional deviations from the SQL standard, but they
seem to me to have better justifications than this one.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2019-10-08 14:29 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08 06:12 parser that could handle "FROM... SELECT..." as well as "SELECT... FROM..." Marius Andreiana <marius.andreiana@gmail.com>
2019-10-08 06:32 ` Pavel Stehule <pavel.stehule@gmail.com>
2019-10-08 07:14 ` Marius Andreiana <marius.andreiana@gmail.com>
2019-10-08 07:25 ` Pavel Stehule <pavel.stehule@gmail.com>
2019-10-08 14:29 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox