Posts

Showing posts from September, 2025

PostgreSQL 18 Old & New

 Learning Structured Query Language can be frustrating when double-checking that what you wanted to have done is actually what was done. PostgreSQL 18 has 'OLD and NEW support for RETURNING clauses in INSERT, UPDATE, DELETE, and MERGE commands'. Now you can get instant feedback.  The addition of the RETURNING clause in the previous version made MERGE much easier to use. Now it makes other commands easier. To demonstrate, let's create a table with one column that is designated as a unique, primary key integer and insert a value. create table foo ( a int unique primary key ) ; insert into foo ( a ) values ( 1 ) ; Now is the point where many of us would run a SELECT a FROM foo , just to double check that indeed there is a 1 in column a. There is now an option in PG 18 to use RETURNING, and it provides the previous 'old' value of a column along with the 'new' value. insert into foo ( a ) values ( 2 ) returning old .a, new .a ; a|a| -+-+  |2| The ...

PostgreSQL 18 Release Notes

 The PostgreSQL 18 Release Notes are like a great noir novel, full of surprises and intrigue. But we know who did it - the amazing PostgreSQL community. If you have not perused the Notes, I advise you to do so now. They contain many of what I call 'Wow!' level items, such as the redesigned I/O subsystem, skip scan lookups, virtual generated columns, and more.  The new Uuidv7 function and temporal constraints would be a significant leap forward. The OLD and NEW support for RETURNING will help lessen the learning curve for many who are new to SQL. But go down to the seemingly more mundane items. Removing redundant self-joins, merge-joins can now use incremental sorts, and internally reordering the keys of SELECT DISTINCT to avoid sorting are the types of improvements that are not as attention-getting as the items in the preceding paragraph, but will make life much nicer for us.  Each release of PostgreSQL is faster than the previous one, and early reports report that this ...