Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ueEh5-006jQb-P3 for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Jul 2025 15:14:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ueEh4-009AU6-Rn for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Jul 2025 15:14:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ueEh4-009ATx-BL for pgsql-hackers@lists.postgresql.org; Tue, 22 Jul 2025 15:14:14 +0000 Received: from cornsilk.maple.relay.mailchannels.net ([23.83.214.40]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ueEh0-000FMi-1s for pgsql-hackers@postgresql.org; Tue, 22 Jul 2025 15:14:14 +0000 X-Sender-Id: dreamhost|x-authsender|nico@cryptonector.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 34E7A42F41; Tue, 22 Jul 2025 15:14:09 +0000 (UTC) Received: from pdx1-sub0-mail-a288.dreamhost.com (trex-blue-3.trex.outbound.svc.cluster.local [100.120.55.178]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 8C64445352; Tue, 22 Jul 2025 15:14:07 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1753197247; a=rsa-sha256; cv=none; b=BMZU3mCm1bzRd+9RkXE77ojcs9gPGyEps+u5VB2Uy6K6V5QNUzHaqBKdBUmA9QW0vAiCXp 3zwjHA0nHK1rfw178GrysnXKZtA/N+cj6wG8rSEW996MOcfyFNA3+brerilIG/gau54SKX 6WV5219ckjDRtsXBWLb+qGNc9GF15I4xNYmIjMpql94uTtb/FpY881qqv+NcBCSOVQPHjd 9AKclbAuCiMdBHfqpHMjp3eK4LCi/X2OdLLb5b0TUR1QfkM90dh+p735Gt/92Po+faiqTZ mCrg14CBPWtip0B94/ZDZwfC29zcYemwps2RSQS7BeQDdYy/LFnTpzaCI+W4pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1753197247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wv5KHlSrFAJdeTu+D/SK9n8CNaM1x4s17Yf3G1R4pyY=; b=3Ue+85pgNyzfYTspSMo5E217tYwnblRFdhUAZ6kR+oH8/ljE+jb+imQ2xTMxkbeEgnpEPO GwOz1C1d4GXjKZJLVdbQQwYCpeqkcC7Zs4fk6BkMXaHF5uSiaS3i9CmPZGtLQXXfAaK/7L K6PoaQNZ9i/xc+iAb/MddZFoKC3S7MUVIbEOA8gF9PEwEfYvEtYp+7sIR6DXhdpOXFVAhY klFVe2wDz6wTeQD+6mkY8EcTo2fxkw/4kho9HHKKgAFx4TKEDnpL478GezpvPxybSP+Tup OLRGgYpU0H0ZFVlS8qwGm08rxfJ/2yTVuK4UCgY4+NFVy/Te4h6YMZ+IOO6GZg== ARC-Authentication-Results: i=1; rspamd-7d4d75f7cc-955mn; auth=pass smtp.auth=dreamhost smtp.mailfrom=nico@cryptonector.com X-Sender-Id: dreamhost|x-authsender|nico@cryptonector.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|nico@cryptonector.com X-MailChannels-Auth-Id: dreamhost X-Interest-Rock: 52a6f4ca489e6b06_1753197247821_3422869612 X-MC-Loop-Signature: 1753197247821:3947434661 X-MC-Ingress-Time: 1753197247821 Received: from pdx1-sub0-mail-a288.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.120.55.178 (trex/7.1.3); Tue, 22 Jul 2025 15:14:07 +0000 Received: from ubby (syn-075-081-095-064.res.spectrum.com [75.81.95.64]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nico@cryptonector.com) by pdx1-sub0-mail-a288.dreamhost.com (Postfix) with ESMTPSA id 4bmglf5bNPz2g; Tue, 22 Jul 2025 08:14:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cryptonector.com; s=dreamhost; t=1753197247; bh=wv5KHlSrFAJdeTu+D/SK9n8CNaM1x4s17Yf3G1R4pyY=; h=Date:From:To:Cc:Subject:Content-Type; b=R4uPY18m+oY6DV3U5+t54CTtMLh8a4IEWarjbaRzYVw1z6jBfqpkIDBheoYPXec64 sUpk1LkiRc26KE76fADhh1gZ73o6iYTEYBqvxEEX2nyQqzVM+TSe+DQxfvJwS1IOfc Dt3pMsw+GkxM9eNQnujLGwsrBDaSIUQoToegMOE/3eufjhnKDRgT8Z1XrK/2Uahnb4 uwma6sVBYbf7NbUhhO8I4Kr+Qch/2hm9Z1qt8EgM6mm/Q7nqOugz0R1NPCSbgA0yMP hPMgR+qO4UaKjwqT6ucboZ1Dw7OJ3w/s/llACnAXPRMzz1S8Q8i2xGxX8FGgPolnnZ 9a56tgN4FPSwQ== Date: Tue, 22 Jul 2025 10:14:04 -0500 From: Nico Williams To: Merlin Moncure Cc: Pavel Stehule , Vik Fearing , Matheus Alcantara , Pg Hackers , Peter Eisentraut Subject: Re: Proposal: QUALIFY clause Message-ID: References: <6c998e4f-f6f2-43c2-8b67-cfff360ef241@postgresfriends.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I often accidentally write SELECT .. WHERE .. WHERE ..; which is obviously wrong, but what I mean when I do this is SELECT .. WHERE .. AND ..; and if I wrote GROUP BY .. HAVING queries as often as I do ones that don't GROUP BY then I'd probably also accidentally use extra HAVINGs as ANDs. It doesn't seem too crazy that extra WHEREs in WHERE clauses should some day function as ANDs, and ditto HAVINGs, which is another reason not to reuse HAVING for this: just to leave that a possibility, remote though it might be. My advice is to wait till QUALIFY is standardized, then hold your nose and adopt it, or maybe sooner when it becomes clear that it will be standardized (because so many other RDBMSes have it too).