From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Re: [COMMITTERS] pgsql: Recognize functional dependency on primary keys. |
Date: | 2010-08-14 03:22:07 |
Message-ID: | 28810.1281756127@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Stephen Frost <sfrost(at)snowman(dot)net> writes:
> * Bruce Momjian (bruce(at)momjian(dot)us) wrote:
>> My guess is our new 9.1 functionality will reduce requests for this
>> features, so we can just not list it anymore. If they still ask, we can
>> re-added this not-wanted item.
> I'm not so sure... I expect we're going to get people complaining that
> it doesn't work the way MySQL's does now instead of complaints we don't
> have it.
Yes. Please compare PG HEAD with mysql 5.1.48 (ok, it's last month's
version):
regression=# create table t1 (f1 int primary key, f2 int, f3 int);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
CREATE TABLE
regression=# select * from t1 group by f1;
f1 | f2 | f3
----+----+----
(0 rows)
regression=# select * from t1 group by f2;
ERROR: column "t1.f1" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: select * from t1 group by f2;
^
mysql> create table t1 (f1 int primary key, f2 int, f3 int);
Query OK, 0 rows affected (0.07 sec)
mysql> select * from t1 group by f1;
Empty set (0.00 sec)
mysql> select * from t1 group by f2;
Empty set (0.00 sec)
I'm not sure whether there is any clear rule for what rows you get when
grouping by a non-PK column in mysql, but it'll let you do it.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2010-08-14 03:29:44 | Re: Re: [COMMITTERS] pgsql: Recognize functional dependency on primary keys. |
Previous Message | Tom Lane | 2010-08-14 03:10:37 | Re: Re: [COMMITTERS] pgsql: Recognize functional dependency on primary keys. |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2010-08-14 03:29:44 | Re: Re: [COMMITTERS] pgsql: Recognize functional dependency on primary keys. |
Previous Message | Tom Lane | 2010-08-14 03:10:37 | Re: Re: [COMMITTERS] pgsql: Recognize functional dependency on primary keys. |