News for hackers. Stuff that matters.
Re:PostgreSQL and SQL:2023 by roenxi on Friday June 02, 2023 @05:45AM (#36163113)
As a reminder; the main purpose of the SQL standard is for governments and Oracle to negotiate sales contracts. The OSS databases don't need ISO. They can just coordinate using the Internet.
Re:PostgreSQL and SQL:2023 by codetrotter on Friday June 02, 2023 @06:40AM (#36163448)
But PostgreSQL is still known for being very compliant with the SQL standard right? At least that’s what I recall hearing.

I use PostgreSQL a bit and I like it. I am not generally concerned about the SQL standard though. The PostgreSQL official docs are good, and you can find a lot of PostgreSQL specific questions and answers on the internet.

But it is my impression that people were saying that it follows the standard pretty closely.

Re:PostgreSQL and SQL:2023 by roenxi on Friday June 02, 2023 @07:40AM (#36163843)
* * *
Re:PostgreSQL and SQL:2023 by osigurdson on Friday June 02, 2023 @09:29AM (#36164784)
Can you state why this is the case? Are there products that need to use both?
Re:PostgreSQL and SQL:2023 by netcraft on Friday June 02, 2023 @09:57AM (#36165142)
I believe the assertion is that between those two youve accounted for a significant majority of the usage of SQL in the world.
Re:PostgreSQL and SQL:2023 by codetrotter on Friday June 02, 2023 @11:06AM (#36166156)
Agreed. But aside from that I could easily see someone using PostgreSQL on their server, and storing data client side in SQLite
Re:PostgreSQL and SQL:2023 by sbuttgereit on Friday June 02, 2023 @08:44AM (#36164331)
PostgreSQL's documented position indicates the standard does matter. Conformance to the standard is described as a "target" rather than PosrtgreSQL's feature set as being "defining". This stands to reason: you can't conform to a target without the target pre-existing and you'd already be conformant if you were setting the standard.

PostgreSQL's current documentation states:

"PostgreSQL development aims for conformance with the latest official version of the standard where such conformance does not contradict traditional features or common sense." -- https://www.postgresql.org/docs/15/features.html

This basic stance is documented at least as far back as PostgreSQL 7.3:

"PostgreSQL development tends to aim for conformance with the latest official version of the standard where such conformance does not contradict traditional features or common sense. At the time of this writing, ballotting is under way for a new revision of the standard, which, if approved, will eventually become the conformance target for future PostgreSQL development." -- https://www.postgresql.org/docs/7.3/features.html

I can only assume that the person you're responding to is advocating a personal opinion on what should count as the standard setting process for SQL (be that formal or informal). That person's opinion does not appear to be shared by the PostgreSQL team as if they believed that... they'd be conformant by definition and there would be no need to accommodate the standard. If they didn't care about the standard, presumably it wouldn't be listed as an "aim" in any capacity.

Re:PostgreSQL and SQL:2023 by ellisv on Friday June 02, 2023 @10:45AM (#36165807)
from the docs:

"Out of 177 mandatory features required for full Core conformance, PostgreSQL conforms to at least 170."

[1] https://www.postgresql.org/docs/current/features.html

Re:PostgreSQL and SQL:2023 by sbuttgereit on Friday June 02, 2023 @01:49PM (#36168426)
A bit meta on my part, but I'd recommend referencing the version specific URLs from the PostgreSQL documentation when backing up a quoted claim. Your quote will referenceable now, but anyone seeing it later may see different number or the statement might be omitted from whatever the "current" version is in the future.

So instead of:

https://www.postgresql.org/docs/current/features.html

I'd recommend:

https://www.postgresql.org/docs/15/features.html

Re:PostgreSQL and SQL:2023 by paulddraper on Friday June 02, 2023 @11:57AM (#36166823)
Yes.

Though it takes liberties whenever it feels the standard chosen something poorly.

Random examples:

* Standard says FKs are deferred by default. PostgreSQL uses immediate by default.

* Standards says triggers are executed in the order added. PostgreSQL executes them in alphabetical orders.

Re:PostgreSQL and SQL:2023 by sam_goody on Friday June 02, 2023 @07:24AM (#36163709)
And even so, Postgres is closer to the spec than Oracle is. (Based on perusing https://modern-sql.com)
Re:PostgreSQL and SQL:2023 by thejosh on Friday June 02, 2023 @08:28AM (#36164186)
Ticking boxes is fun and all, but I like it because it at least gets everyone on the same page for features, functions, etc across databases.
Re:PostgreSQL and SQL:2023 by tgv on Friday June 02, 2023 @10:56AM (#36165982)
I think I'd rather not have much of a difference between Oracle and Postgresql, if only because it would make it given "certain people" more arguments against switching from Oracle to Postgresql.
Re:PostgreSQL and SQL:2023 by ElectricalUnion on Friday June 02, 2023 @11:32AM (#36166510)
> rather not have much of a difference between Oracle and Postgresql

That will make Postgresql blatantly non-standard and you will instead get the old "it's the same thing, why bother changing" argument against switching from Oracle to Postgresql.

Re:PostgreSQL and SQL:2023 by tgv on Friday June 02, 2023 @11:35AM (#36166560)
The price?
Re:PostgreSQL and SQL:2023 by tracker1 on Friday June 02, 2023 @01:13PM (#36167928)
Considering how painful it is to even configure Oracle client software, I cannot disagree more. I'd much rather deal with PostgreSQL any given day of the week, and should you need much more than what's in the box, that's the point that the six figure consultants and DBAs earn their income. Oracle (and DB2) are just a massive mess to actually work with.

PostgreSQL is really nice in terms of dev features. MS-SQL is nice in terms of Ops features. And even Firebird is easier to use in practice than Oracle/DB2. Don't add friction to your life when you don't need to. The only place I've ever worked that chose Oracle over MS-SQL or PostgreSQL was a larger company where the Oracle DBA team was generally easier to work with.

Re:PostgreSQL and SQL:2023 by chx on Friday June 02, 2023 @12:42PM (#36167449)
Sure they can but do they? Where's the WHATWG of SQL?
Re:PostgreSQL and SQL:2023 by samwillis on Friday June 02, 2023 @05:53AM (#36163164)
Related thread yesterday:

https://news.ycombinator.com/item?id=36154102

SQL:2023 has been released (iso.org) | 251 points | 118 comments

Re:PostgreSQL and SQL:2023 by truth_seeker on Friday June 02, 2023 @07:42AM (#36163851)
Property Graph Queries would be cool addition to PG. Looking forward to this.
Re:PostgreSQL and SQL:2023 by IceHegel on Friday June 02, 2023 @08:08AM (#36164041)
The bigger question is when will ChatGPT be updated to be able to write SQL 2023.
Re:PostgreSQL and SQL:2023 by ElectricalUnion on Friday June 02, 2023 @11:34AM (#36166538)
"I apologize for the confusion. It seems that the SQL:2023 query I mentioned in my previous response is not a valid query in ${your-database-here}. I apologize for the incorrect information."
Re:PostgreSQL and SQL:2023 by IceHegel on Friday June 02, 2023 @01:22PM (#36168060)
The fact that this got downvoted shows disruption is in the air. Don’t shoot the messenger.
Re:PostgreSQL and SQL:2023 by evangow on Friday June 02, 2023 @11:27AM (#36166447)
Since we're here talking about Postgres and SQL standards. Here's my wishlist:

- Support for arrays of foreign keys. This one has been worked on a couple of times but hasn't made it into a release. https://commitfest.postgresql.org/17/1252/ - I think this would be an absolutely phenomenal way of handling sorting, instead of having to use linked lists and CTEs or some type of "order/position" column

- Support for deferring NOT NULL and CHECK constraints to the end of a transaction (just ran into this problem yesterday)

Edit: typos

Re:PostgreSQL and SQL:2023 by paulddraper on Friday June 02, 2023 @11:52AM (#36166778)
> Support for arrays of foreign keys.

Standards-wise, the first step would be arrays in general :)

> Support for deferring NOT NULL and CHECK constraints to the end of a transaction

Agreed 100%

Re:PostgreSQL and SQL:2023 by meotimdihia on Friday June 02, 2023 @12:04PM (#36166916)
Is there a database that supported arrays of foreign keys?
Re:PostgreSQL and SQL:2023 by lolive on Friday June 02, 2023 @03:28PM (#36169677)
We use it in Palantir, that is a proprietary overlay on top of Spark. It supports this feature reasonably fine.
Re:PostgreSQL and SQL:2023 by paulddraper on Friday June 02, 2023 @04:51PM (#36170581)
Of the major databases, only Oracle and PostgreSQL have array extensions and neither support FKs as array elements.

I'm curious how people think this feature should work? ON DELETE SET NULL, ON DELETE CASCADE, something else?

Re:PostgreSQL and SQL:2023 by evangow on Tuesday June 06, 2023 @04:18PM (#36218553)
I would love it if the would remove the key from the array.
Re:PostgreSQL and SQL:2023 by zwily on Friday June 02, 2023 @12:55PM (#36167638)
“Array of foreign keys” has been at the top of my list for so long. Would simplify sooooo much.
Re:PostgreSQL and SQL:2023 by _a_a_a_ on Friday June 02, 2023 @01:23PM (#36168085)
I followed the link about arrays of foreign keys but couldn't see what it was saying. Could you briefly summarise for me?
Re:PostgreSQL and SQL:2023 by petereisentraut on Saturday June 03, 2023 @08:07AM (#36175956)
> - Support for deferring NOT NULL and CHECK constraints to the end of a transaction (just ran into this problem yesterday)

I'm curious what the use case of this is?

Deferrable constraints are usually considered for foreign keys, since there you might have to juggle updates to multiple tables and might violate the constraint in the intermediate states. But that doesn't appear to apply in that way to CHECK constraints.

Re:PostgreSQL and SQL:2023 by evangow on Tuesday June 06, 2023 @04:16PM (#36218537)
2 tables that reference each other and the foreign key columns both have a NOT NULL constraint.
Re:PostgreSQL and SQL:2023 by nologic01 on Friday June 02, 2023 @12:24PM (#36167194)
There is a PostgreSQL extension (Apache AGE) [1] that provides graph database functionality, implementing the proposed SQL:2023 specification for property graphs queries might be easier in that context?

[1] https://age.apache.org/