Thread

  1. Re: [PATCH] GROUP BY ALL

    x4mmm@yandex-team.ru — 2024-07-23T13:21:55Z

    <div class="52245733ac3b195ee6f02a3f4f5dbe50ApplePlainTextBody" dir="auto" style="word-wrap:break-word"><br /><br /><blockquote>On 23 Jul 2024, at 00:40, Isaac Morland &lt;<a href="mailto:isaac.morland@gmail.com">isaac.morland@gmail.com</a>&gt; wrote:<br /><br />odyssey=&gt; select (uw_term).*, count(*) from uw_term group by uw_term;<br />ERROR:  column "uw_term.term_id" must appear in the GROUP BY clause or be used in an aggregate function<br />LINE 1: select (uw_term).*, count(*) from uw_term group by uw_term;<br /></blockquote><br /><div>AFAIR this problem was solved in my implementation [0]</div><div><br /></div><div><blockquote>On 23 Jul 2024, at 01:29, Tom Lane &lt;<a href="mailto:tgl@sss.pgh.pa.us">tgl@sss.pgh.pa.us</a>&gt; wrote:<br /><br />(Personally, I'd wonder exactly what ALL is quantified over: the<br />whole output of the FROM clause, or only columns mentioned in the<br />SELECT tlist, or what? And why that choice rather than another?)<br /></blockquote><br /></div><div>I'd like to have GROUP BY AUTO (I also proposed version GROUP BY SURPRISE ME). But I wouldn't like to open pandora box of syntax sugar extensions which may will be incompatible with future standards.</div><div>If we could have extensible grammar - I'd be happy to have a lot of such enhancements. My top 2 are FROM table SELECT column and better GROUP BY.</div><div><br /></div><div><br /></div><div>Best regards, Andrey Borodin.</div><div><br /></div><div><br /></div><div>[0] <a href="https://www.postgresql.org/message-id/flat/CAAhFRxjyTO5BHn9y1oOSEp0TtpTDTTTb7HJBNhTG%2Bi3-hXC0XQ%40mail.gmail.com">https://www.postgresql.org/message-id/flat/CAAhFRxjyTO5BHn9y1oOSEp0TtpTDTTTb7HJBNhTG%2Bi3-hXC0XQ%40mail.gmail.com</a></div></div>
  2. Re: [PATCH] GROUP BY ALL

    David Christensen <david@pgguru.net> — 2024-07-23T13:39:20Z

    On Tue, Jul 23, 2024 at 8:21 AM Andrei Borodin <x4mmm@yandex-team.ru> wrote:
    >
    > On 23 Jul 2024, at 00:40, Isaac Morland <isaac.morland@gmail.com> wrote:
    >
    > odyssey=> select (uw_term).*, count(*) from uw_term group by uw_term;
    > ERROR:  column "uw_term.term_id" must appear in the GROUP BY clause or be used in an aggregate function
    > LINE 1: select (uw_term).*, count(*) from uw_term group by uw_term;
    >
    >
    > AFAIR this problem was solved in my implementation [0]
    >
    > On 23 Jul 2024, at 01:29, Tom Lane <tgl@sss.pgh.pa.us> wrote:
    >
    > (Personally, I'd wonder exactly what ALL is quantified over: the
    > whole output of the FROM clause, or only columns mentioned in the
    > SELECT tlist, or what? And why that choice rather than another?)
    >
    >
    > I'd like to have GROUP BY AUTO (I also proposed version GROUP BY SURPRISE ME). But I wouldn't like to open pandora box of syntax sugar extensions which may will be incompatible with future standards.
    > If we could have extensible grammar - I'd be happy to have a lot of such enhancements. My top 2 are FROM table SELECT column and better GROUP BY.
    
    GROUP BY AUTO also seems fine here to me; I understand the desire to
    avoid major incompatible syntax changes; GROUP BY ALL does exist in
    multiple products so it's not unprecedented.
    
    I wrote my patch before seeing your thread, sorry I missed that. :-)
    
    David
    
    
    
    
  3. Re: [PATCH] GROUP BY ALL

    Jelte Fennema-Nio <postgres@jeltef.nl> — 2024-07-24T08:58:12Z

    On Tue, 23 Jul 2024 at 15:22, Andrei Borodin <x4mmm@yandex-team.ru> wrote:
    > I'd like to have GROUP BY AUTO (I also proposed version GROUP BY SURPRISE ME). But I wouldn't like to open pandora box of syntax sugar extensions which may will be incompatible with future standards.
    > If we could have extensible grammar - I'd be happy to have a lot of such enhancements. My top 2 are FROM table SELECT column and better GROUP BY.
    
    Personally my number one enhancement would be allowing a trailing
    comma after the last column in the SELECT clause.
    
    
    
    
  4. Re: [PATCH] GROUP BY ALL

    x4mmm@yandex-team.ru — 2024-07-24T11:08:01Z

    
    > On 24 Jul 2024, at 13:58, Jelte Fennema-Nio <postgres@jeltef.nl> wrote:
    > 
    > On Tue, 23 Jul 2024 at 15:22, Andrei Borodin <x4mmm@yandex-team.ru> wrote:
    >> I'd like to have GROUP BY AUTO (I also proposed version GROUP BY SURPRISE ME). But I wouldn't like to open pandora box of syntax sugar extensions which may will be incompatible with future standards.
    >> If we could have extensible grammar - I'd be happy to have a lot of such enhancements. My top 2 are FROM table SELECT column and better GROUP BY.
    > 
    > Personally my number one enhancement would be allowing a trailing
    > comma after the last column in the SELECT clause.
    
    Yes, trailing comma sounds great too.
    
    One more similar syntax sugar I can think of. I see lots of queries like
    SELECT somtheing
    FROM table1
    WHERE 1=1
    and id = x
    --and col1 = val1
    and col2 = val2
    
    I was wondering where does that "1=1" comes from. It's because developer comment condition one by one like "--, col1 = val1". And they do not want to cope with and\or continuation.
    
    
    Best regards, Andrey Borodin.
    
    PS. Seems like Mail.App mangled my previous message despite using plain text. It's totally broken in archives...