Am 24.03.2024 um 17:43 schrieb Christophe Pettus:
The situation is much more like the customer saying, "I understand that the standard paint for this car is red, but I wish it painted blue instead."
Not in the least. Declaring the column to be NULL is explicitly requesting the car be blue. And declaring, in the same statement, there be a pk on that column is implicitly requesting the car be red.
Again, you can argue that PostgreSQL should remember that you explicitly asked for a NULL and generate a warning in that case, but that's not a trivial amount of work, since right now, that NULL is thrown away very early in statement processing.
Only, if PG is not aware of being in the process of creating a table. Well, I do not feel, I can make myself understood.