pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Julien Rouhaud <rjuju123@gmail.com>
Cc: Jaime Casanova <jcasanov@systemguards.com.ec>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: SQL-standard function body
Date: Mon, 26 Apr 2021 21:44:07 -0500
Message-ID: <20210427024407.GY7256@telsasoft.com> (raw)
In-Reply-To: <CAMkU=1zKGWEJdBbYKw7Tn7cJmYR_UjgdcXTPDqJj=dNwCETBCQ@mail.gmail.com>
References: <CAJKUy5j3N23=SuF=S=xX6mu8VX3N9qSbxiej2wMsAqZ3FB2Pow@mail.gmail.com>
	<20210315080344.wed62yy54fuse7jg@nol>
	<20210315081448.63vagqr3ly45l74i@nol>
	<c17ea953-0837-70ab-b408-522421697d54@2ndquadrant.com>
	<CAJKUy5giffMO31KfBxgSgcaXRC48HfhqwWB6fewAE_8cgOGe2w@mail.gmail.com>
	<20210331101256.d7h7d74o4celskt4@nol>
	<9277ef6a-bfa8-9c06-8e91-16c2892120cc@2ndquadrant.com>
	<20210403033943.dp6um65shvrovoj5@nol>
	<01c65ea6-e5bf-22f4-cacc-6d0f6853a965@2ndquadrant.com>
	<CAMkU=1zKGWEJdBbYKw7Tn7cJmYR_UjgdcXTPDqJj=dNwCETBCQ@mail.gmail.com>

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.

inline patch 1: src/fe_utils/psqlscan.l (+1/-1 lines) download inline-1.patchdiff --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 {

view thread (90+ messages)  latest in thread

Message-ID: <20210427024407.GY7256@telsasoft.com>
Permalink:  ../20210427024407.GY7256@telsasoft.com/
Also on:    postgresql.org/message-id/20210427024407.GY7256@telsasoft.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: pryzby@telsasoft.com, jeff.janes@gmail.com, peter.eisentraut@2ndquadrant.com, rjuju123@gmail.com, jcasanov@systemguards.com.ec, pgsql-hackers@lists.postgresql.org
  Subject: Re: SQL-standard function body
  In-Reply-To: <20210427024407.GY7256@telsasoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox