5 ms·
What’s New in PostgreSQL 18 – a Developer’s Perspective
- JoelJacobson 1y agoIt made me happy to see the pg_get_acl() function that I was involved in adding, is appreciated by users. I think there is still much improvement in the space of querying privileges. I think most users would probably struggle to come up with the query from the article: postgres=# SELECT (pg_identify_object(s.classid,s.objid,s.objsubid)).*, pg_catalog.pg_get_acl(s.classid,s.objid,s.objsubid) AS acl FROM pg_catalog.pg_shdepend AS s JOIN pg_catalog.pg_database AS d ON d.datname = current_database() AND d.oid = s.dbid JOIN pg_catalog.pg_authid AS a ON a.oid = s.refobjid AND s.refclassid = 'pg_authid'::regclass WHERE s.deptype = 'a'; -[ RECORD 1 ]----------------------------------------- type | table schema | public name | testtab identity | public.testtab acl | {postgres=arwdDxtm/postgres,foo=r/postgres} What I wanted to really add, was two new system views, pg_ownerships and pg_privileges [1]. The pg_get_acl() was a dependency that we needed to get in place first. In the end, I withdrew the patch trying to add these views. If there is enough interest from users, I might consider picking up the task of trying to work out the remaining obstacles. Do people here need pg_ownerships and/or pg_privileges? [1] https://www.postgresql.org/message-id/flat/bbe7d1cb-0435-4ee6-a9f5-7dbc79ab84b2%40app.fastmail.com https://www.postgresql.org/message-id/flat/bbe7d1cb-0435-4ee...
- cpa 1y agoYes!
- kdtsh 1y agopg_ownerships and pg_privileges would be incredibly useful.
- michaelsalim 1y agoYes. I was looking for something like this. And I've had people ask me about this before too
- d4mi3n 1y agoAbsolutely. A lot of data security risk is gauged by who has access to what, and the sad fact is that many teams don’t use row or column level security for ergonomic reasons. Features like this would do a lot to make these features easier to reason about, understand, and verify.
- tianzhou 1y agoAuthor here — I nearly overlooked this in the changelog. Definitely my second favorite feature (uuidv7() is tough to beat)
- dangoodmanUT 1y agoI always find it hard to think of a good reason for a (computed) virtual column Why would you ever force your db to multiply a value by 12 to another column, or parse a json path, if it’s not for filtering? Move that effort to your clients so you’re not needlessly consuming db resources.
- nine_k 1y agoThink about schema migrations, and the need to be compatible with the new and old versions of the schema.
- gdulli 1y agoI'm not a fan of stored procedures but this is lightweight enough that I like how it simplifies by removing responsibility from the code. I imagine the computed column could be indexed or materialized if needed.
- tczMUFlmoNk 1y ago> I imagine the computed column could be indexed or materialized if needed. The article mentions that "you cannot create indexes on VIRTUAL generated columns".
- gdulli 1y agoOh thanks I missed the distinction between a virtual and regular generated column.
- jimktrains2 1y agoSince you can index expressions I wonder if that's because you essentially emhave to store the value in the index anyway and that wouldn't be expected for a virtual column?
- evanelias 1y agoI don't really understand why this restriction would be necessary. Wouldn't the computed value just get stored in the index btree keys, exactly the same as an indexed expression? For comparison, MySQL permits indexing of virtual columns, and indexes on expressions share the same underlying implementation to support this. In other words, in MySQL an index on an expression is literally just an index on an internally-hidden virtual column.
- ChrisArchitect 1y agoSome more discussion: https://news.ycombinator.com/item?id=45372283 https://news.ycombinator.com/item?id=45372283
- metadat 1y agoThanks! Macro-expanded: PostgreSQL 18 Released https://news.ycombinator.com/item?id=45372283 https://news.ycombinator.com/item?id=45372283 - 3 days ago, 21 comments
- IgorPartola 1y agoDuring the past 15 years I have been using Postgres quite a bit. I have also almost exclusively have been accessing databases using an ORM. Love them or hate them, they do provide value for a lot of common cases and speed up development and debugability, or at least they did for me and I know they remain very popular. This all meant that as databases like Postgres keep adding cool new features they mostly go unused because an ORM just doesn’t let you pierce that layer of abstraction except dropping to pure SQL which is typically seen as a code smell and an annoyance to everyone involved. So on the one hand I love that Postgres is getting amazing new features, not to mention all the cool extensions. On the other hand I and I suspect many others are essentially locked out of them and since most ORMa try to serve multiple databases they typically only include the most common denominator features. As I get more experienced I both see why RDBMS is the right choice most times AND see the appeal of an object store instead of a row store.
- seabombs 1y agoIt depends on the ORM, I know SQLAlchemy and Django ORM have some Postgres specific features (e.g. full text search/indexing). Some also let you extend the ORM to add your own features, or at least write raw SQL.
- IgorPartola 1y agoYeah I mostly use Django ORM and TortoiseORM these days and have used SQLAlchemy in the past. FTS is nice but things like locks, pubsub, stored procedures, triggers, views/materialized views, and many others are not supported out of the box and for some of these I don’t even see where they could be hooked up. And this is before you get into things like replication and multi-server clusters.
- cyberax 1y agoFor me: computed columns in change stream records. Super nice. We use them to pull out some fields out of JSON blobs, and until PG18 they were not available for logical replication log consumers.
- JakaJancar 1y agoOne obvious thing I still can’t believe pg doesn’t have is the ability to define triggers at the database or schema level. I must have written code to mass generate DROP/CREATE TRIGGER probably 5 times (yes I know you can reuse the trigger procedure itself). And then you need to remember to re-run whenever tables are added/removed.