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 1lbDhu-0000QS-VT for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Apr 2021 02:44:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lbDht-0003mz-RN for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Apr 2021 02:44:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lbDht-0003mr-GO for pgsql-hackers@lists.postgresql.org; Tue, 27 Apr 2021 02:44:13 +0000 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lbDhr-0004Ik-5I for pgsql-hackers@lists.postgresql.org; Tue, 27 Apr 2021 02:44:12 +0000 Received: by mail-oo1-xc2e.google.com with SMTP id c6-20020a4aacc60000b02901e6260b12e2so10266319oon.3 for ; Mon, 26 Apr 2021 19:44:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pE+P86jzyMi38ztyrJ4t4ev4Ngg7bce5HjspM0S1Hz0=; b=C5jR0JQRyeBKQmCcyyfbAhB52zxyRSKLNlN2ZrWzm7NwF+sG/WIMWMhhQHawT2OVtx l1OUsZk4+QObCGF4EuMVuLFVGHy5DD+5kXkqUfD/9WFxsoba2g0tI4H3hIa9PId4KP+s Zlgp4dW0C9c92QcCzV4DBH2wEMkOFJbRT8litQK9kLyepKU99yUh832hUQgPrQoNuVvq tL/He1Xo9XQsRFw1mBP86FVAVf5/XH+RBSjhDLq4OxOZpEXNHnODrBrwWHjBWopHp1fp y5Y4f6/BBWdVGIisn0xQWZirxozYZV55YLFrdTk1M1sHRBDhnlYt+7p9XU1/IytiBhzV NUGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pE+P86jzyMi38ztyrJ4t4ev4Ngg7bce5HjspM0S1Hz0=; b=VWpB3nPGGpQXxTBKwmlTkNTebVZ8ZPqXTMY8IbEA0pmmBpgoCswe3rzKE2w4osaLKp 4DTHa/7mCDe2yUO3NKyLmKxuf9O15alQoX80eBaXAuUkiqxN8YqTx6EJkDuBuM5beMwt sGSWKrb+Zjk1YYJK/j2n97FfMccS+rVeRBsxBiEP399YKB2sviLQN0G5zpFFUUYwYkzZ z47lAIzcOV0ylFBV7Qkwyq4K0LHL7pNxtrWk1DwN/NaSzoLnglAQoeYWLphD++M/Ef2l hJe4ZodcZEKR9xII7Oyg02FVPco5M646ED0ISLG8L8mJYT2BxBz7wJkNGJh6wlWusmXt GiCQ== X-Gm-Message-State: AOAM533dQzg7cAiGmk0887aOYPqlIpPW0jBkDEWfsc0hdVLig1KcVh2q RsEn1xvWxRZfc34ueuaW/gJVrg== X-Google-Smtp-Source: ABdhPJy/fp24hDx/vCLzaLal7JgbIwbl3oq/Anl4czCL8rR/sLtU1sD0m331U379r+b9FAMKhZcJ2g== X-Received: by 2002:a4a:df0a:: with SMTP id i10mr15906435oou.82.1619491449058; Mon, 26 Apr 2021 19:44:09 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id p11sm3832288oti.53.2021.04.26.19.44.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Apr 2021 19:44:08 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 70121800D31; Mon, 26 Apr 2021 21:44:07 -0500 (CDT) Date: Mon, 26 Apr 2021 21:44:07 -0500 From: Justin Pryzby To: Jeff Janes Cc: Peter Eisentraut , Julien Rouhaud , Jaime Casanova , pgsql-hackers@lists.postgresql.org Subject: Re: SQL-standard function body Message-ID: <20210427024407.GY7256@telsasoft.com> References: <20210315080344.wed62yy54fuse7jg@nol> <20210315081448.63vagqr3ly45l74i@nol> <20210331101256.d7h7d74o4celskt4@nol> <9277ef6a-bfa8-9c06-8e91-16c2892120cc@2ndquadrant.com> <20210403033943.dp6um65shvrovoj5@nol> <01c65ea6-e5bf-22f4-cacc-6d0f6853a965@2ndquadrant.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Apr 22, 2021 at 04:04:18PM -0400, Jeff Janes wrote: > This commit break line continuation prompts for unbalanced parentheses in > the psql binary. Skimming through this thread, I don't see that this is > intentional or has been noticed before. > > with psql -X > > Before: > > jjanes=# asdf ( > jjanes(# > > Now: > > jjanes=# asdf ( > jjanes-# > > I've looked through the parts of the commit that change psql, but didn't > see an obvious culprit. I haven't studied it in detail, but it probably needs something like this. diff --git a/src/fe_utils/psqlscan.l b/src/fe_utils/psqlscan.l index 991b7de0b5..0fab48a382 100644 --- a/src/fe_utils/psqlscan.l +++ b/src/fe_utils/psqlscan.l @@ -1098,23 +1098,23 @@ psql_scan(PsqlScanState state, { case LEXRES_EOL: /* end of input */ switch (state->start_state) { case INITIAL: case xqs: /* we treat this like INITIAL */ if (state->paren_depth > 0) { result = PSCAN_INCOMPLETE; *prompt = PROMPT_PAREN; } - if (state->begin_depth > 0) + else if (state->begin_depth > 0) { result = PSCAN_INCOMPLETE; *prompt = PROMPT_CONTINUE; } else if (query_buf->len > 0) { result = PSCAN_EOL; *prompt = PROMPT_CONTINUE; } else {