On 2nd of February, Tom Lane committed patch: Create a psql command \gset to store query results into psql variables. This eases manipulation of query results in psql scripts. Pavel Stehule, reviewed by Piyush Newe, Shigeru Hanada, and Tom Lane

On 13th of November (I know, backlog again), Tom Lane committed patch which make PostgreSQL more strict about what happens in stored procedures in PL/pgSQL: Add control knobs for plpgsql's variable resolution behavior, and make the default be "throw error on conflict", ...

This post has been updated with new code that uses temporary table - the code is at the end of post! There was this question on Stack Overflow. For future reference: guy asked how to do session variables - i.e. something he ...