Re: Why can't I select un-grouped columns when grouping by a (non-primary) unique key?
От | Daniel Lenski |
---|---|
Тема | Re: Why can't I select un-grouped columns when grouping by a (non-primary) unique key? |
Дата | |
Msg-id | CAOw_LSHNCbp+zscdXHLHv099Jtwyh0Sx6A5kr=G0GFDqS0un+Q@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Why can't I select un-grouped columns when grouping by a (non-primary) unique key? (Geoff Montee <geoff.montee@gmail.com>) |
Ответы |
Re: Why can't I select un-grouped columns when grouping by a (non-primary) unique key?
|
Список | pgsql-general |
On Wed, Sep 24, 2014 at 10:46 AM, Geoff Montee <geoff.montee@gmail.com> wrote: > > I believe this blog post contains better examples of the feature he's > referring to: > > http://www.depesz.com/2010/08/08/waiting-for-9-1-recognize-functional-dependency-on-primary-keys/ > > For example: > > SELECT > p.id, > p.firstname, > p.lastname, > count(*) > FROM > people p > JOIN visits v on p.id = v.person_id > GROUP BY p.id; > Geoff, that's exactly the feature I'm referring to. I see that the inclusion of UNIQUE NOT NULL constraints was recognized as a logical next step when this feature was introduced. Now that I understand PG's current behavior, it doesn't seem like a huge limitation... but I'm curious about what is preventing the UNIQUE NOT NULL constraints from being allowed as well. Is there something different about the internal representation of UNIQUE NOT NULL constraints compared to PRIMARY KEY constraints? Thanks, Dan
В списке pgsql-general по дате отправления: