Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mJywZ-0008PJ-Ss for pgsql-novice@arkaria.postgresql.org; Sat, 28 Aug 2021 14:04:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mJywY-00062g-4I for pgsql-novice@arkaria.postgresql.org; Sat, 28 Aug 2021 14:04:22 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mJy4q-0005t6-B4 for pgsql-novice@lists.postgresql.org; Sat, 28 Aug 2021 13:08:52 +0000 Received: from esa02.ucs.mun.ca ([134.153.136.22]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mJy4k-0002wk-U4 for pgsql-novice@postgresql.org; Sat, 28 Aug 2021 13:08:49 +0000 IronPort-SDR: AUQ/gMPe/LVF9INlmf6nrMjIyERZ03ZPhEooSPfNg9gR4i75nJN5yiu+GqhJFkqOI8QUuafwoW RXk+QYrHkj8I1rfVIzYoomcEoaVCS4U/rNWorauQOmw9waa6JaLnmR2p5VVX7ctfkXcm+DsJPP LLMugZjFTOjg3bek3Mdis8lrSW6CGYoA9s1Ycb7MA/0ExMI91+TfX3Jnih/jYC0Y6RMC+pw/5j /pSC3d36w2zOwweOx2L1ZgAyQBcF+GkQBFGjEKQLedotWUS96iO3ONoqs/OTlHIjW2AdjgctUq JXc= IronPort-HdrOrdr: =?us-ascii?q?A9a23=3ArrNAy654CYDNVR6cxgPXwPLXdLJyesId70?= =?us-ascii?q?hD6qkXc20xTiX4rbHNoB11737JYVoqNU0IudfFI6WYRGOZ6Jgd2+cs1NSZLW?= =?us-ascii?q?rbUQmTTL2KhLGKqwEIWReUygc378hdmsZFZOHYMUJ3loLz7gW+Dr8bquW6zA?= =?us-ascii?q?=3D=3D?= X-IronPort-AV: E=Sophos;i="5.84,359,1620700200"; d="scan'208";a="65696405" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from cpe00fc8db7a323-cm00fc8db7a320.cpe.net.cable.rogers.com (HELO pyrope.local) ([174.117.202.255]) by smtp02.ucs.mun.ca with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2021 10:38:43 -0330 References: <20210825204256.GX17906@tamriel.snowman.net> <77511C44-068E-4047-A955-9C6C08BC1942@jimkeener.com> User-agent: mu4e 1.5.6; emacs 27.2 From: Roger Mason To: pgsql-novice Subject: Re: select from grouped data In-reply-to: Date: Sat, 28 Aug 2021 10:38:41 -0230 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Stephen Frost writes: > > It=E2=80=99s generally better as it follows the SQL standard and is more = flexible > as it allows you to get top-N, as I said. DISTINCT ON has always been a > hack and its use should be discouraged at this point. > > When an UPSERT capability exists in the actual standard then it=E2=80=99s= use > should be promoted over other hacks that various vendors have implemented > also. OK, thanks, I've filed this discussion away for future reference. Meanwhile I'm having trouble getting this function to work as a trigger. I'll start another thread on that. Thanks again. Roger