public inbox for [email protected]  
help / color / mirror / Atom feed
From: Anil Sahoo <[email protected]>
To: Dave Page <[email protected]>
Cc: Thom Brown <[email protected]>
Cc: Aditya Toshniwal <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: Regarding feature #6841
Date: Wed, 15 May 2024 17:02:48 +0530
Message-ID: <CAO+oWtBExj5HmywJHs0k_C7J6Wa17=J_JQCA5MXbEK0mpq-NBg@mail.gmail.com> (raw)
In-Reply-To: <CA+OCxoyzADYJLk3XaC7x_+qpRajrujPvhhceoMZLeKqgu=acdg@mail.gmail.com>
References: <CAO+oWtBxAaDxdPOkcf=bTU0D6sDogX_az4SgN-5zKZt-9G=2xQ@mail.gmail.com>
	<CA+OCxozieNmgfoGFq0G0Mxy+bu2Ct6hK9goZA3xtVJm9EaK6HA@mail.gmail.com>
	<CAO+oWtA13KM+jmWm+MkGbmLps2dh3B06mEZu6-PQjZ0ip7+G6g@mail.gmail.com>
	<CA+OCxoxMdX9Lsyugx7=_CZ3Z6K9jxHVTOBu4q=5_1cwgXsP7LQ@mail.gmail.com>
	<CAM9w-_mdXSmj2xv9W2k6hdmdY+3V8rfi4gnjBA_Jy28ZYkza2Q@mail.gmail.com>
	<CA+OCxozSdrD1ziKmfd_xLh72P031vdEo60wZxniyYP9sBLoM7Q@mail.gmail.com>
	<CAM9w-_=tRn_zM6C8Pm6B5w6du8BjdtrRnb1XxX1qyEcaSx4kEg@mail.gmail.com>
	<CA+OCxoz30kYxbska9TFHDKO3kXoervwY6OYE2kcY6b-k6-iYvg@mail.gmail.com>
	<CAM9w-_kjmG0rthcqss2TL+eFtC93qn_5ts_5=Fkqes82VG_EMg@mail.gmail.com>
	<CA+OCxozJpVhOTkPMv3_+EoEto+v+EeL=p1-dxjHFEvJM1EMBEQ@mail.gmail.com>
	<CAM9w-_n9i5fZSzRRNywJiCGv7TSRbSHLv+LVEBR=qn3zczrAxg@mail.gmail.com>
	<CAM9w-_nvA83wZ8m47B3fLswAQygrg1X9tk1g9hyQZEFqoH_zog@mail.gmail.com>
	<CA+OCxowig3kDr7APS0jitjBcE=Mq_vbnUNYYApt6-7_xp9yg6w@mail.gmail.com>
	<CAA-aLv6Lp-zHhnrh-SqzSeO7L8XanNjwhBQpsaP_4SqgwUHcmw@mail.gmail.com>
	<CA+OCxoyH6SNE_T+2p=4sQHHoTzsOOVuT+HEzqZMzgbKRXn_EAA@mail.gmail.com>
	<CAA-aLv54foGwCFYgsEN=tHM=Jzf=HBdsK96X+M0AaKigXh9OTg@mail.gmail.com>
	<CA+OCxoxN3D+tojy+67LNc702oP2JrK9035HtSROYeJErb6EXqw@mail.gmail.com>
	<CAA-aLv4nVeTmGPTtEi15y+Pn-usOoY7KPu594QzQtF9ikG0yYg@mail.gmail.com>
	<CA+OCxoyzADYJLk3XaC7x_+qpRajrujPvhhceoMZLeKqgu=acdg@mail.gmail.com>

Hi Team,

I have implemented the Execute query feature and tested it with different
kinds of test cases.

FYI the PostgreSQL Do block does not work as a single statement when we put
the cursor inside the block at different positions.

The cursor position is mentioned using pipe('|') and underlined query is
the active query that will run on click of Execute query button.

I have attached some screenshots for reference.

Please let me know if you have any questions.

Thanks
Anil
--

<http://www.enterprisedb.com;

*Anil Sahoo*

Software Engineer

www.enterprisedb.com

Power to Postgres

<https://www.linkedin.com/company/edbpostgres;
<https://twitter.com/edbpostgres?lang=en;
<https://www.facebook.com/EDBpostgres;
<https://www.instagram.com/EDBpostgres/;


On Wed, Apr 24, 2024 at 7:27 PM Dave Page <[email protected]> wrote:

>
>
> On Wed, 24 Apr 2024 at 14:43, Thom Brown <[email protected]> wrote:
>
>> On Tue, 23 Apr 2024 at 13:50, Dave Page <[email protected]> wrote:
>>
>>>
>>>
>>> On Tue, 23 Apr 2024 at 12:03, Thom Brown <[email protected]> wrote:
>>>
>>>>
>>>>> 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.
>>>>>
>>>>
>>>> Oh, I clearly don't use PgAdmin enough to know this already.
>>>>
>>>
>>> Boo!
>>>
>>>
>>>>
>>>> I still find the proposal somewhat unintuitive, but the foot-gun
>>>> safeguards that have been suggested sound like any pedal injuries will
>>>> solely be the fault of the user.
>>>>
>>>> I would want to see it tested in a diverse range of scenarios though,
>>>> which will require some imagination given what users will no doubt try to
>>>> use it on.
>>>>
>>>
>>> Yes, I have made that very clear to the team. Suggestions for test
>>> scenarios are welcome of course - a good way to experiment might be to see
>>> how the current version of pgAdmin (which uses the new CodeMirror code)
>>> manages to mess up syntax highlighting of anything weird.
>>>
>>
>> I guess here's a few to try out:
>>
>
> Very helpful - thanks Thom!
>
>
>>
>> -- Put the cursor on every relation name, and every SELECT, DELETE and
>> INSERT
>> WITH deleted_rows AS (
>>   DELETE FROM mytable WHERE id IN (
>>     -- Does this run on its own?
>>     SELECT id FROM mytable
>>   )
>>   RETURNING id, content
>> ),
>> move_rows AS (
>>   INSERT INTO newtable
>>   -- Does this SELECT run on its own, or does it backtrack to the INSERT?
>>   SELECT id, content
>>   FROM deleted_rows
>> ),
>> combined_result AS(
>>   SELECT tableoid::regclass, id, content
>>   FROM mytable
>>   UNION ALL
>>   -- Does this SELECT get run on its own?
>>   SELECT tableoid::regclass, id, content
>>   FROM newtable
>> )
>> -- Does this SELECT get run on its own?
>> SELECT id, content
>> INTO backuptable
>> FROM combined_result;
>>
>>
>> SELECT id, content
>> FROM (
>>   /*
>>     We are just performing:
>>     SELECT id, content
>>     FROM newtable;
>>     ... at 2 levels
>>     Does that commented query above highlight?
>>
>>     Does each level of the query and nested queries run correctly?
>>   */
>>   SELECT id, content, 'dummy1'
>>   FROM (
>>      SELECT id, content, 'dummmy1', 'dummy2'
>>      FROM newtable
>>   )
>> );
>>
>>
>> DO LANGUAGE plpgsql $SELECT$
>> DECLARE
>>   myrec RECORD;
>>   -- Does either SELECT in the cursor try to run when under PgAdmin's
>> cursor?
>>   -- Is there any backtracking when selecting the 2nd one?
>>   mycur CURSOR FOR SELECT 1 FROM (SELECT (VALUES (1)));
>> BEGIN
>>   SELECT INTO STRICT myrec FROM (
>>     -- Does selecting the following SELECT correctly run without going
>>     -- into the SELECT INTO?
>>     SELECT
>>  -- Can you run the query that appears in the value?
>>       $$SELECT * FROM mytable$$ AS query,
>>
>>  -- What happens when you select either of these SELECTs?
>>       'SELECT' AS "SELECT",
>>
>>  -- And what happens on each one of these 4 DELETEs
>>       $DELETE$DELETE$DELETE$ AS "DELETE"
>>   );
>> END
>> $SELECT$;
>>
>> None of this renders incorrectly in PgAdmin though.
>>
>> Thom
>>
>
>
> --
> Dave Page
> pgAdmin: https://www.pgadmin.org
> PostgreSQL: https://www.postgresql.org
> EDB: https://www.enterprisedb.com
>
>


Attachments:

  [image/png] Screenshot 2024-05-15 at 4.51.21 PM.png (218.5K, 3-Screenshot%202024-05-15%20at%204.51.21%20PM.png)
  download | view image

  [image/png] Screenshot 2024-05-15 at 4.52.05 PM.png (209.7K, 4-Screenshot%202024-05-15%20at%204.52.05%20PM.png)
  download | view image

  [image/png] Screenshot 2024-05-15 at 4.52.21 PM.png (224.9K, 5-Screenshot%202024-05-15%20at%204.52.21%20PM.png)
  download | view image

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Regarding feature #6841
  In-Reply-To: <CAO+oWtBExj5HmywJHs0k_C7J6Wa17=J_JQCA5MXbEK0mpq-NBg@mail.gmail.com>

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

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