pgsql: Remove the hack in the grammar that "optimized away" DEFAULT NULL

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Remove the hack in the grammar that "optimized away" DEFAULT NULL
Date: 2007-10-29 19:40:40
Message-ID: 20071029194040.B0019754229@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Remove the hack in the grammar that "optimized away" DEFAULT NULL clauses.
Instead put in a test to drop a NULL default at the last moment before
storing the catalog entry. This changes the behavior in a couple of ways:
* Specifying DEFAULT NULL when creating an inheritance child table will
successfully suppress inheritance of any default expression from the
parent's column, where formerly it failed to do so.
* Specifying DEFAULT NULL for a column of a domain type will correctly
override any default belonging to the domain; likewise for a sub-domain.
The latter change happens because by the time the clause is checked,
it won't be a simple null Const but a CoerceToDomain expression.

Personally I think this should be back-patched, but there doesn't seem to
be consensus for that on pgsql-hackers, so refraining.

Modified Files:
--------------
pgsql/src/backend/catalog:
heap.c (r1.324 -> r1.325)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/heap.c?r1=1.324&r2=1.325)
pgsql/src/backend/commands:
typecmds.c (r1.108 -> r1.109)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/typecmds.c?r1=1.108&r2=1.109)
pgsql/src/backend/parser:
gram.y (r2.603 -> r2.604)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/gram.y?r1=2.603&r2=2.604)
parse_expr.c (r1.221 -> r1.222)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_expr.c?r1=1.221&r2=1.222)
parse_utilcmd.c (r2.3 -> r2.4)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_utilcmd.c?r1=2.3&r2=2.4)
pgsql/src/include/parser:
gramparse.h (r1.38 -> r1.39)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/parser/gramparse.h?r1=1.38&r2=1.39)
pgsql/src/test/regress/expected:
domain.out (r1.41 -> r1.42)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/domain.out?r1=1.41&r2=1.42)
pgsql/src/test/regress/sql:
domain.sql (r1.24 -> r1.25)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/domain.sql?r1=1.24&r2=1.25)

Browse pgsql-committers by date

  From Date Subject
Next Message User Mkz 2007-10-29 19:50:38 plproxy - plproxy: remove syncing of standard_conforming_strings, seems
Previous Message Teodor Sigaev 2007-10-29 19:27:21 pgsql: - Add check of already changed page while replay WAL.