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 1sqeMo-00BWy4-W2 for pgsql-bugs@arkaria.postgresql.org; Tue, 17 Sep 2024 20:00:07 +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 1sqeMo-00FfPY-GV for pgsql-bugs@arkaria.postgresql.org; Tue, 17 Sep 2024 20:00:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqeMo-00FfFc-7a for pgsql-bugs@lists.postgresql.org; Tue, 17 Sep 2024 20:00:06 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqeMl-001gn5-9k for pgsql-bugs@lists.postgresql.org; Tue, 17 Sep 2024 20:00:04 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 48HK02vH1681152; Tue, 17 Sep 2024 16:00:02 -0400 From: Tom Lane To: Pavel Stehule cc: PetSerAl , pgsql-bugs@lists.postgresql.org Subject: Re: PL/pgSQL THEN binging in condition In-reply-to: References: Comments: In-reply-to Pavel Stehule message dated "Tue, 17 Sep 2024 20:45:55 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1681150.1726603202.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Tue, 17 Sep 2024 16:00:02 -0400 Message-ID: <1681151.1726603202@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Pavel Stehule writes: > Ășt 17. 9. 2024 v 20:04 odesĂ­latel PetSerAl napsal: >> It seems error here because first THEN bound to IF statement rather than >> CASE expression. > It is an interesting use case, but I am afraid it can be fixed (enhanced) > without a strong rewrite of the plpgsql engine. It would not be that hard to teach read_sql_construct to count nesting of CASE ... END, as it already does for parentheses. However, I'm a little worried whether that'd interact badly with plpgsql's own uses of CASE and END. regards, tom lane