
When Postgres blocks: tips for dealing with locks (2018) - pvsukale3
https://www.citusdata.com/blog/2018/02/22/seven-tips-for-dealing-with-postgres-locks/
======
felixge
> 1: Never add a column with a default value

This only applies to Postgres versions < 11\. See
[https://blog.2ndquadrant.com/add-new-table-column-default-
va...](https://blog.2ndquadrant.com/add-new-table-column-default-value-
postgresql-11/) which was released after this article was written.

~~~
Lewton
I ran into this last week when wanting to upgrade a column to non-null and
discovering we were running Postgres 9.something

It made me curious, since the solution is so simple and fairly obvious, and it
covers a common use case. How come it’s taken so long to be implemented?
Similarly, it wasn’t added in oracle until version 11, so I must be missing
something

~~~
lazyjones
Perhaps it wasn't really that simple? It seems to have taken more than 2 years
according to [https://www.postgresql-archive.org/ALTER-TABLE-ADD-COLUMN-
fa...](https://www.postgresql-archive.org/ALTER-TABLE-ADD-COLUMN-fast-default-
td5995655.html) and Tom Lane found it a bit scary first.

~~~
Lewton
Thanks for the link! That definitely illuminates some of the complexity
involved

