News for hackers. Stuff that matters.
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.