On 2/13/15 1:48 PM, Jeff Janes wrote:
> I waste an inordinate amount of time retyping select lists over into the
> group by list, or copying and pasting and then deleting the aggregate
> clauses. It is an entirely pointless exercise. I can't fault
> PostgreSQL for following the standard, but its
I will take a bit of a contrarian position from the OP. I, personally,
prefer that computer _languages_ do exactly and only what _I_ tell them to
do. I do _NOT_ want them to things for me. IMO, that is why many programs
are unreliable. They make an assumption which is not what the original
programm
-Original Message-
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Brian Dunavant
Sent: Friday, February 13, 2015 2:11 PM
To: Bill Moran
Cc: Jeff Janes; Ryan Delaney; pgsql-general@postgresql.org
Subject: Re: [GENERAL] SELECT, GROUP BY
To lower the amount of time spent copy pasting aggregate column names,
it's probably worth noting Postgres will allow you to short cut that
with the column position. For example:
select long_column_name_A, long_column_name_b, count(1)
from foo
group by 1,2
order by 1,2
This works just fine. It'
On Fri, 13 Feb 2015 10:48:13 -0800
Jeff Janes wrote:
> On Fri, Feb 13, 2015 at 10:26 AM, Bill Moran
> wrote:
>
> > > Ryan Delaney writes:
> > > > Why couldn't an RDBMS such as postgres interpret a SELECT that omits
> > the GROUP
> > > > BY as implicitly grouping by all the columns that aren't
On Fri, Feb 13, 2015 at 10:26 AM, Bill Moran
wrote:
>
> > Ryan Delaney writes:
> > > Why couldn't an RDBMS such as postgres interpret a SELECT that omits
> the GROUP
> > > BY as implicitly grouping by all the columns that aren't part of an
> aggregate?
>
> I'm Mr. Curious today ...
>
> Why would
> Ryan Delaney writes:
> > Why couldn't an RDBMS such as postgres interpret a SELECT that omits the
> > GROUP
> > BY as implicitly grouping by all the columns that aren't part of an
> > aggregate?
I'm Mr. Curious today ...
Why would you think that such a thing is necessary or desirable? Simpl
Ryan Delaney writes:
> Why couldn't an RDBMS such as postgres interpret a SELECT that omits the GROUP
> BY as implicitly grouping by all the columns that aren't part of an aggregate?
Per SQL standard, a SELECT with aggregates but no GROUP BY is supposed to
give exactly one row. What you suggest
Why couldn't an RDBMS such as postgres interpret a SELECT that omits the GROUP
BY as implicitly grouping by all the columns that aren't part of an aggregate?
If I do this, Postgres throws an exception that I cannot SELECT a series of
columns including an aggregate without a corresponding GROUP BY