Skip to content

Commit a756f5c

Browse files
committed
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.
1 parent 8d8d5cb commit a756f5c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/backend/catalog/pg_constraint.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.55 2010/08/07 02:44:06 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.56 2010/09/05 15:45:42 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -836,6 +836,9 @@ check_functional_grouping(Oid relid,
836836
/* Only PK constraints are of interest for now, see comment above */
837837
if (con->contype != CONSTRAINT_PRIMARY)
838838
continue;
839+
/* Constraint must be non-deferrable */
840+
if (con->condeferrable)
841+
continue;
839842

840843
/* Extract the conkey array, ie, attnums of PK's columns */
841844
adatum = heap_getattr(tuple, Anum_pg_constraint_conkey,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy