diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-09-05 15:45:42 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-09-05 15:45:42 +0000 |
commit | a756f5ce140914d6b316721f42b43e828820e93e (patch) | |
tree | fd12573737015689abf77534b2da3d69dee34ff1 /src | |
parent | 8d8d5cb612bb008741f2104a5479cb0c22b76e1d (diff) | |
download | postgresql-a756f5ce140914d6b316721f42b43e828820e93e.tar.gz postgresql-a756f5ce140914d6b316721f42b43e828820e93e.zip |
GROUP BY can only infer functional dependency from non-deferrable primary keys.
Peter's original patch had this right, but I dropped the check while revising
the code to search pg_constraint instead of pg_index. Spotted by Dean Rasheed.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/catalog/pg_constraint.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backend/catalog/pg_constraint.c b/src/backend/catalog/pg_constraint.c index 106b8df6e4c..42d7d6caca0 100644 --- a/src/backend/catalog/pg_constraint.c +++ b/src/backend/catalog/pg_constraint.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.55 2010/08/07 02:44:06 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.56 2010/09/05 15:45:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -836,6 +836,9 @@ check_functional_grouping(Oid relid, /* Only PK constraints are of interest for now, see comment above */ if (con->contype != CONSTRAINT_PRIMARY) continue; + /* Constraint must be non-deferrable */ + if (con->condeferrable) + continue; /* Extract the conkey array, ie, attnums of PK's columns */ adatum = heap_getattr(tuple, Anum_pg_constraint_conkey, |