One of the questions that gets asked quite a lot, is: how can you use variables in your queries? Other databases have them, does PostgreSQL? Actually the answer is "no". But, it is actually very easy to work around, and what's ...

On 19t of January, Heikki Linnakangas committed patch: Make pg_relation_size() and friends return NULL if the object doesn't exist. That avoids errors when the functions are used in queries like "SELECT pg_relation_size(oid) FROM pg_class", and a table is dropped concurrently. Phil Sorber

On 18th of July, Tom Lane committed patch: Add GET STACKED DIAGNOSTICS plpgsql command to retrieve exception info. This is more SQL-spec-compliant, more easily extensible, and better performing than the old method of inventing special variables. Pavel Stehule, reviewed by Shigeru Hanada and David ...

On 16th of February, Tom Lane committed patch: Add FOREACH IN ARRAY looping to plpgsql.   (I'm not entirely sure that we've finished bikeshedding the syntax details, but the functionality seems OK.)   Pavel Stehule, reviewed by Stephen Frost and Tom Lane

Every now and then somebody asks how to make diff of database schemata. Usual background is like: we have production database, and development database, and we want to see what is different on development to be able to change production in ...

I have a mixed love/hate relationship with tests. I hate writing them. I hate remembering to add them when I'm in the zone, and application code is flowing freely from the tips of my fingers. But when I do add them, I ...

One of the most common questions is "how do I get select * from table, but without one of the column". Short answer is of course - name your columns, instead of using *. Or use a view. But I decided to ...

Dynamic updates of fields in NEW in PL/pgSQL Today, on #postgresql on IRC, strk asked about updating fields in NEW record, in plpgsql, but where name of the field is in variable. After some time, he sent his question to hackers mailing ...

On 18th of December Bruce Momjian committed very important, but relatively small, patch: Log Message: ----------- Install server-side language PL/pgSQL by default. There is no point in showing it, commit log tells all - basically from 8.5 on PL/pgSQL will be enabled by default ...

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", ...