pgsql: Remove the hack in the grammar that "optimized away" DEFAULT NULL - Mailing list pgsql-committers

From tgl@postgresql.org (Tom Lane)
Subject pgsql: Remove the hack in the grammar that "optimized away" DEFAULT NULL
Date
Msg-id 20071029194040.B0019754229@cvs.postgresql.org
Whole thread Raw
List 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)

pgsql-committers by date:

Previous
From: teodor@postgresql.org (Teodor Sigaev)
Date:
Subject: pgsql: - Add check of already changed page while replay WAL.
Next
From: mkz@pgfoundry.org (User Mkz)
Date:
Subject: plproxy - plproxy: remove syncing of standard_conforming_strings, seems