News for hackers. Stuff that matters.
Re:SQL: 2023 is finished: Here is what's new by fbdab103 on Thursday April 13, 2023 @08:39PM (#35564134)
I really like what PRQL[0] is doing. Fixes a lot of the unfortunate SQL syntax. My impossible dream is that after years of language stability, Postgres could make it a first party query language.

[0] https://prql-lang.org/

Re:SQL: 2023 is finished: Here is what's new by LeonenTheDK on Thursday April 13, 2023 @08:56PM (#35564268)
Wow, this looks like it fixes a lot of the minor gripes I have with SQL, thanks for mentioning it. It feels way less cludgy and "modernized" compared to SQL.
Re:SQL: 2023 is finished: Here is what's new by iudqnolq on Thursday April 13, 2023 @09:03PM (#35564315)
That reminds me of the Ecto DSL.
Re:SQL: 2023 is finished: Here is what's new by TylerE on Thursday April 13, 2023 @09:32PM (#35564473)
Maybe as a baby step we could just get legal trailing commas
Re:SQL: 2023 is finished: Here is what's new by candiddevmike on Thursday April 13, 2023 @09:40PM (#35564525)
Or force the big RDBMS to use the same syntax like SQL was intended to be, so I don't have to reach for an ORM or maintain different flavors of the same query.

If someone knows a tool that reliably converts PostgreSQL queries to something like SQLite, please share!

Re:SQL: 2023 is finished: Here is what's new by TylerE on Thursday April 13, 2023 @10:15PM (#35564722)
Not sure how such a tool could possibly exist, given all the functionality of Postgres that SQLite simply lacks.
Re:SQL: 2023 is finished: Here is what's new by steve_gh on Friday April 14, 2023 @01:31AM (#35565845)
You could ask ChatGPT to do this sort of conversion
Re:SQL: 2023 is finished: Here is what's new by TylerE on Friday April 14, 2023 @01:36AM (#35565865)
Still not going to have wave around things like not having transactions or proper trigger functions.
Re:SQL: 2023 is finished: Here is what's new by hnlmorg on Friday April 14, 2023 @03:33AM (#35566577)
SQLite does have transactions. But I do agree with your general point that Sqlite is worlds apart from Postgre
Re:SQL: 2023 is finished: Here is what's new by alserio on Friday April 14, 2023 @02:03AM (#35566027)
haven't really tried for that transform but have a look at https://www.jooq.org/translate/
Re:SQL: 2023 is finished: Here is what's new by snthpy on Saturday April 15, 2023 @03:09AM (#35578343)
sqlglot might be what you are looking for.

https://github.com/tobymao/sqlglot

Re:SQL: 2023 is finished: Here is what's new by jiggawatts on Thursday April 13, 2023 @09:35PM (#35564494)
The syntax looks very similar to Microsoft's Kusto Query Language (KQL): https://learn.microsoft.com/en-us/azure/data-explorer/kusto/...

It's interesting to see that everyone's attempt at fixing SQL seems to converge on surprisingly similar solutions...

Re:SQL: 2023 is finished: Here is what's new by tehlike on Friday April 14, 2023 @12:19AM (#35565468)
Microsoft did linq first which is probably the basis for the rest.
Re:SQL: 2023 is finished: Here is what's new by fbdab103 on Friday April 14, 2023 @12:52AM (#35565646)
From first principles, it seems reasonable to expect transformations to go in a linear order. From there you look for ways to minimize special cases (eg why is `where` different from `having`?). Then you can just layer on some quality of life things which would appear to a designer after five minutes of real-world use (dear god, please let me have trailing commas).

I would expect there to be a lot of convergent evolution as how to go from a pile of data to narrowing on what you want.