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 1rzDi0-002Yni-Rl for pgadmin-hackers@arkaria.postgresql.org; Tue, 23 Apr 2024 10:49:09 +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 1rzDhy-007nBV-LW for pgadmin-hackers@arkaria.postgresql.org; Tue, 23 Apr 2024 10:49:06 +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 1rzDhy-007nBN-Bp for pgadmin-hackers@lists.postgresql.org; Tue, 23 Apr 2024 10:49:06 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rzDhu-002VSn-Rw for pgadmin-hackers@postgresql.org; Tue, 23 Apr 2024 10:49:05 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-51ac5923ef6so3254769e87.0 for ; Tue, 23 Apr 2024 03:49:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgadmin.org; s=google; t=1713869340; x=1714474140; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=M3LtUIzxF3t/9cUsUYR4zNlW70h+bX6wDs9TY7DXxIo=; b=LLk9O0reFPEsDUzFEn648QPZdsSiunIjuRqu195wiPwWakbSWje9+qy8v4W1kXzUzV Zc/9Yt04nTAMzJ9b/3oZihvTLc1y4c1qVjmmFwF8IBLXMSMHbXUZTcnL0jQTi/AkpCdR bUlrcQBqAeakHEmEBmx5p9rvAqlb9LKI9V42RarlS0d0Uxjzf/QXG47nnFHApcv+A1tO WYjPL/foBMknEyeUtQt/qh2ojPIUYJPVZ8TT7ZSx2RRRZmiGijl88WesFZrMeYTR0MiI L9evnquj/vV5Eg6xixjhcZFwRWZkU4vW7E25Yw8LK42zpxqdiwS7vtm6OL21HpzYS2ZG n4FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713869340; x=1714474140; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=M3LtUIzxF3t/9cUsUYR4zNlW70h+bX6wDs9TY7DXxIo=; b=ErzrW9YX73QMgIkg9FeAibmb7hvvdC9QzHt9sRFLpujqaWc2BvSqqTpNK/hAd9cM3w QVPgmNs5FEv2IqX3cygR0lP/JtM8kh13H48T++p3xXxiAZJ/RpVD2L7S+M7TLFsJtzD2 sIbMjLmMiCh3Plmfk1dOGGb2IPS3dAm7Qfg9ZwCazOygniUyn0k+Qg2d1UJ8BtFtGaJK 6qTc6WizcDtM78Uj+GdnXfK0B8mtfZX6vaaQcDacT5sBFEzBgcHaz5uzM0FP7dva4Tyb vUSFNmoDmeR4BviIG8MSn1aST4t9QFSqZjhdrx0HuL58jFxCVN5Ci4moT+4Ls7NHPa2R gchQ== X-Forwarded-Encrypted: i=1; AJvYcCWLUS70QwZ8fs+qo7SYyVVWLGILe+IwWouQnPtzxkfWI4VWmPuxlGiO7vCs+ErI9aOOxxthXCBxq54SbF6x7sk5q472ZKqfPd/9ZNO5SeQ= X-Gm-Message-State: AOJu0Yw5bgV4PSpIqJpuBHGlULfJgoMl5QvufMNtNsV8wTEhzoTog+se U8xrNL61rJEK6z/pygInuth1JM3XECbZl6v6sUpbgGKuQuSDvNdJMLOQr3vDsw1FSzeMMoRCeIt T5O0vNs6K4vRL54B+R1wQg/FvAz8VTJmG9Mu6XSeuANdPg48= X-Google-Smtp-Source: AGHT+IGjlV+/9eyMueHcEb/EASoLqVgwoJAdtovVPRILcz7p3qdEfXq7wGX/YQJ6ljoeBISyxrfv606JRgwg3CwFwOw= X-Received: by 2002:a05:6512:54e:b0:519:2460:a5db with SMTP id h14-20020a056512054e00b005192460a5dbmr756850lfl.24.1713869340345; Tue, 23 Apr 2024 03:49:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dave Page Date: Tue, 23 Apr 2024 11:48:49 +0100 Message-ID: Subject: Re: Regarding feature #6841 To: Thom Brown Cc: Aditya Toshniwal , Anil Sahoo , pgadmin-hackers Content-Type: multipart/alternative; boundary="00000000000039276a0616c14d3a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000039276a0616c14d3a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 23 Apr 2024 at 11:29, Thom Brown wrote: > On Tue, Apr 23, 2024, 09:15 Dave Page wrote: > >> Adding some notes below to summarise a discussion we had on this in a >> call... >> >> On Mon, 22 Apr 2024 at 08:26, Aditya Toshniwal < >> aditya.toshniwal@enterprisedb.com> wrote: >> >>> Hi Dave, >>> >>> On Fri, Apr 19, 2024 at 7:15=E2=80=AFPM Aditya Toshniwal < >>> aditya.toshniwal@enterprisedb.com> wrote: >>> >>>> Hi Dave, >>>> >>>> On Fri, Apr 19, 2024 at 7:05=E2=80=AFPM Dave Page = wrote: >>>> >>>>> Hi >>>>> >>>>> On Fri, 19 Apr 2024 at 14:32, Aditya Toshniwal < >>>>> aditya.toshniwal@enterprisedb.com> wrote: >>>>> >>>>>> Hi Dave, >>>>>> >>>>>> On Fri, Apr 19, 2024 at 6:22=E2=80=AFPM Dave Page wrote: >>>>>> >>>>>>> Hi >>>>>>> >>>>>>> On Fri, 19 Apr 2024 at 11:56, Aditya Toshniwal < >>>>>>> aditya.toshniwal@enterprisedb.com> wrote: >>>>>>> >>>>>>>> >>>>>>>>> Even if you put the cursor on the "SELECT"? If so, that would >>>>>>>>> imply the parser understands the string quoting; e.g. in this cas= e, the >>>>>>>>> Python multiline string. Presumably then it would also understand= regular >>>>>>>>> single and double quotes - what about (for example) a heredoc in = a pl/sh >>>>>>>>> function? >>>>>>>>> >>>>>>>> Yes, the parser understands all the aspects of a SQL query and so >>>>>>>> it understands what type of token the cursor is based on which it = does the >>>>>>>> syntax highlighting I believe. >>>>>>>> >>>>>>> >>>>>>> Does it? Even EPAS extensions? >>>>>>> >>>>>> I mean only standard SQL grammar. >>>>>> >>>>> >>>>> Standard SQL grammar doesn't help us much - PostgreSQL is probably th= e >>>>> most standard compliant dialect there is, but if it deviates from the >>>>> standard in a few cases, and has a ton of syntax that isn't even in t= he >>>>> standard. However, I suspect you mean PostgreSQL-standard, as we are = using >>>>> the PostgreSQL dialect in CodeMirror. But, pgAdmin also supports EPAS= .... >>>>> >>>> We'll have to test different scenarios to know exactly what works and >>>> what doesn't. >>>> >>>>> >>>>> >>>>>> >>>>>>> >>>>>>> >>>>>>>> >>>>>>>>> It sounds like Thom has similar concerns, and I know him well >>>>>>>>> enough to know he wouldn't chime in without good reason. >>>>>>>>> >>>>>>>> There are limitations and it won't work correctly apart from >>>>>>>> standard SQL queries. Like I said, we're adding it as a new button= without >>>>>>>> touching the existing working. If a user chooses to use the new bu= tton, he >>>>>>>> knows that pgAdmin will try to find the query on its own. This is = an >>>>>>>> optional feature. >>>>>>>> Additionally, what we could do is when the user hits the button we >>>>>>>> will show a warning and the user can opt for not showing it again. >>>>>>>> >>>>>>> >>>>>>> Ten minutes later they will have forgotten that warning. >>>>>>> >>>>>>> I'm currently thinking that we should display the current query all >>>>>>> the time somehow (though I'm not sure how, without taking up a lot = of >>>>>>> space). >>>>>>> >>>>>> Can't we add some kind of tooltip or popover on hover over the >>>>>> execute query button? >>>>>> >>>>> >>>>> Possibly :-). Let's try a PoC. >>>>> >>>> OK. I'll ask Anil to create some samples. >>>> >>> >>> We gave a thought on how a person would know what the query is when >>> using keyboard shortcuts. So we came up with another suggestion. How ab= out >>> a highlighter on what is the query based on cursor position? Example be= low. >>> We can disable it from preferences. We still need to check how the >>> performance will be, although we'll add debouncing. >>> >>> [image: image.png] >>> >> >> So the plan is: >> >> 1) We automatically highlight the "current" query in the editor, >> similarly to the mockup above. >> >> 2) We add an option to Preferences (also exposed under the Edit drop dow= n >> in the Query Tool) to turn off that highlighting. >> >> 3) When the user clicks the "Execute Query Under Cursor" button, it will >> be executed immediately if highlighting is enabled. >> >> 4) If highlighting is disabled, the query to be executed will be >> displayed in a confirmation dialog to allow the user to review before >> execution. >> >> 5) The confirmation dialogue will have a "Don't show this again" option >> for those that trust the CodeMirror parser enough. >> >> 6) A button above the resultset will be added to allow you to see the >> query that was executed to generate that resultset in all cases. >> > > A button above the resultset? Do you mean a tab, or an actual button? > A button, alongside the ones that are already there for editing data etc. > > I guess I would like to understand the rationale for this feature. Users > supposedly want this as described, but what is the precedent? I mean, I'v= e > used GUIs for other DMBS's where you select what you want to run, and it > just runs the selection, even if it doesn't grab the whole query (e.g. > excluding ORDER BY or WHERE predicates). > Other GUIs (for PostgreSQL and other DBMSs) have this functionality, and we've had multiple requests for it. > > The latter seems more flexible and predictable IMHO. And that way you can > dispense with the confirmation dialogue, and there's no need for any > additional configuration options because there's probably no need to > disable it. > You've been able to do the "Select and run" thing for years. If you select text in the editor and hit the execute button, only the selected text is sent to the server. If nothing is selected, the entire string is sent. This feature will complement that for convenience, but for safety will have a separate button/shortcut. --=20 Dave Page pgAdmin: https://www.pgadmin.org PostgreSQL: https://www.postgresql.org EDB: https://www.enterprisedb.com --00000000000039276a0616c14d3a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Tue, 23 Apr 2024 at 11:29, Thom Br= own <thom@linux.com> wrote:
=
On Tue, Apr 23, 2024, 09:15 Dav= e Page <dpage@pgadmin.org> wrote:
Adding some notes below to summarise a discussion we had = on this in a call...

On Mon, 22 Apr 2024 at 08:26, Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
<= /div>
Hi=C2=A0Dave,

On Fri, Apr 19, 2024 at 7:15= =E2=80=AFPM Aditya Toshniwal <aditya.toshniwal= @enterprisedb.com> wrote:
Hi=C2=A0Dav= e,

On Fri, Apr 19, 2024 at 7:05=E2=80=AFPM Dave Page <dpa= ge@pgadmin.org> wrote:
Hi

On Fri, 19 Apr 2024 at 14:32, Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
Hi=C2=A0Dave,

On Fri, Apr 19, 2024 at 6:22=E2=80=AFPM Dave= Page <dpage@pgadmin.org> wrote:
Hi

On Fri, 19 Apr 2024 at 11:56, Aditya Toshniwa= l <aditya.toshniwal@enterprisedb.com> w= rote:

Even if you put the cursor on the "SELECT"? If so, that wo= uld imply the parser understands the string quoting; e.g. in this case, the= Python multiline string. Presumably then it would also understand regular = single and double quotes - what about (for example) a heredoc in a pl/sh fu= nction?
Yes, the parser understands all the = aspects of a SQL query and so it understands what type of token the cursor = is based on which it does the syntax highlighting I believe.

Does it? Even EPAS extensions?
I mean only standard SQL grammar.

Standard SQL grammar doesn= 9;t help us much - PostgreSQL is probably the most standard compliant diale= ct there is, but if it deviates from the standard in a few cases, and has a= ton of syntax that isn't even in the standard. However, I suspect you = mean PostgreSQL-standard, as we are using the PostgreSQL dialect in CodeMir= ror. But, pgAdmin also supports EPAS....
We&= #39;ll have to test different scenarios to know exactly what works and what= doesn't.
=C2=A0

=C2=A0

It sounds like Thom has similar concerns, and I= know him well enough to know he wouldn't chime in without good reason.=
There are limitations and it won't work= correctly apart from standard SQL queries. Like I said, we're adding i= t as a new button without touching the existing working. If a user chooses = to use the new button, he knows that pgAdmin will try to find the query on = its own. This is an optional feature.
Additionally, what we co= uld do is when the user hits the button we will show a warning and the user= can opt for=C2=A0not showing it again.

Ten minutes later they will have forgotten that warni= ng.

I'm currently thinking that we should disp= lay the current query all the time somehow (though I'm not sure how, wi= thout taking up a lot of space).
Can't we add some kind of tooltip or popover on= hover over the execute query button?

Possibly :-). Let's try a PoC.
OK. I'll ask Anil to create some samples.
=C2=A0
We gave a thought on how a person would know what the qu= ery is when using keyboard shortcuts. So we came up with another suggestion= . How about a highlighter on what is the query based on cursor position? Ex= ample below. We can disable it from preferences. We still need to check how= the performance will be, although we'll add debouncing.

3D"image.png"

So the plan is:

1) We a= utomatically highlight the "current" query in the editor, similar= ly to the mockup above.

2) We add an option to Pre= ferences (also exposed under the Edit drop down in the Query Tool) to turn = off that highlighting.

3) When the user clicks the= "Execute Query Under Cursor" button, it will be executed immedia= tely if highlighting is enabled.

4) If highlightin= g is disabled, the query to be executed will be displayed in a confirmation= dialog to allow the user to review before execution.

<= div>5) The confirmation dialogue will have a "Don't show this agai= n" option for those that trust the CodeMirror parser enough.

6) A button above the resultset will be added to allow you = to see the query that was executed to generate that resultset in all cases.=

A button above the resultset? Do you mean a tab, or an actual but= ton?

A button, alongside the on= es that are already there for editing data etc.=C2=A0
=C2=A0

I guess I would like t= o understand the rationale for this feature. Users supposedly want this as = described, but what is the precedent? I mean, I've used GUIs for other = DMBS's where you select what you want to run, and it just runs the sele= ction, even if it doesn't grab the whole query (e.g. excluding ORDER BY= or WHERE predicates).

Other GU= Is (for PostgreSQL and other DBMSs) have this functionality, and we've = had multiple requests for it.
=C2=A0

The latter seems = more flexible and predictable IMHO. And that way you can dispense with the = confirmation dialogue, and there's no need for any additional configura= tion options because there's probably no need to disable it.

You've been able to do the "Sele= ct and run" thing for years. If you select text in the editor and hit = the execute button, only the selected text is sent to the server. If nothin= g is selected, the entire string is sent. This feature will complement that= for convenience, but for safety will have a separate button/shortcut.

--
=
--00000000000039276a0616c14d3a--