pgsql: Recognize functional dependency on primary keys.

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Recognize functional dependency on primary keys.
Date: 2010-08-07 02:44:09
Message-ID: 20100807024409.35E3A7541D7@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Log Message:
-----------
Recognize functional dependency on primary keys. This allows a table's
other columns to be referenced without listing them in GROUP BY, so long as
the primary key column(s) are listed in GROUP BY.

Eventually we should also allow functional dependency on a UNIQUE constraint
when the columns are marked NOT NULL, but that has to wait until NOT NULL
constraints are represented in pg_constraint, because we need to have
pg_constraint OIDs for all the conditions needed to ensure functional
dependency.

Peter Eisentraut, reviewed by Alex Hunsaker and Tom Lane

Modified Files:
--------------
pgsql/doc/src/sgml:
queries.sgml (r1.58 -> r1.59)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/queries.sgml?r1=1.58&r2=1.59)
pgsql/doc/src/sgml/ref:
select.sgml (r1.131 -> r1.132)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ref/select.sgml?r1=1.131&r2=1.132)
pgsql/src/backend/catalog:
dependency.c (r1.96 -> r1.97)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/dependency.c?r1=1.96&r2=1.97)
pg_constraint.c (r1.54 -> r1.55)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/pg_constraint.c?r1=1.54&r2=1.55)
pgsql/src/backend/nodes:
copyfuncs.c (r1.466 -> r1.467)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/copyfuncs.c?r1=1.466&r2=1.467)
equalfuncs.c (r1.386 -> r1.387)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/equalfuncs.c?r1=1.386&r2=1.387)
outfuncs.c (r1.387 -> r1.388)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/outfuncs.c?r1=1.387&r2=1.388)
readfuncs.c (r1.232 -> r1.233)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/readfuncs.c?r1=1.232&r2=1.233)
pgsql/src/backend/parser:
parse_agg.c (r1.93 -> r1.94)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_agg.c?r1=1.93&r2=1.94)
pgsql/src/include/catalog:
catversion.h (r1.590 -> r1.591)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/catversion.h?r1=1.590&r2=1.591)
pg_constraint.h (r1.40 -> r1.41)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_constraint.h?r1=1.40&r2=1.41)
pgsql/src/include/nodes:
parsenodes.h (r1.433 -> r1.434)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/parsenodes.h?r1=1.433&r2=1.434)
pgsql/src/test/regress:
parallel_schedule (r1.61 -> r1.62)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/parallel_schedule?r1=1.61&r2=1.62)
serial_schedule (r1.56 -> r1.57)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/serial_schedule?r1=1.56&r2=1.57)

Added Files:
-----------
pgsql/src/test/regress/expected:
functional_deps.out (r1.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/functional_deps.out?rev=1.1&content-type=text/x-cvsweb-markup)
pgsql/src/test/regress/sql:
functional_deps.sql (r1.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/functional_deps.sql?rev=1.1&content-type=text/x-cvsweb-markup)

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-08-07 02:45:10 Re: Surprising dead_tuple_count from pgstattuple
Previous Message Itagaki Takahiro 2010-08-07 01:11:30 Re: Surprising dead_tuple_count from pgstattuple

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2010-08-07 13:07:06 pgsql: Fix 9.0 release notes vacuum mention, not -> now Peter Fokkinga
Previous Message Peter Eisentraut 2010-08-06 20:09:03 pgsql: Fix indexterm spelling