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 1tYJVl-008l5g-Lh for pgadmin-hackers@arkaria.postgresql.org; Thu, 16 Jan 2025 06:37:50 +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 1tYJVj-006oNp-N5 for pgadmin-hackers@arkaria.postgresql.org; Thu, 16 Jan 2025 06:37:48 +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 1tYJVj-006oN6-3J for pgadmin-hackers@lists.postgresql.org; Thu, 16 Jan 2025 06:37:47 +0000 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tYJVg-000fD6-2D for pgadmin-hackers@postgresql.org; Thu, 16 Jan 2025 06:37:45 +0000 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-2a3d8857a2bso353590fac.1 for ; Wed, 15 Jan 2025 22:37:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1737009463; x=1737614263; 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=cQv/ZE2tEwgR4LYQR/WYSXNjTkNppKAUQyzj+3pAJZM=; b=Cl7QVxkhqvgER+D1PYExEOSeqV/MGAPTTXnFCkPPgmLIjbD5s6WtvwH6vRdAfMPaTo AZ9hQe2Cvq2EkOqzNS5cZ0R1yNbUOLCj0db6O+ypFXWoagXB2Z2oDMAiXCxpii84+c2F 4iaQgoQAkgFV3ZqTrLK4xEQgYOzL0vgCFVHqnZ9ayOLWOgcc1WIWwRv+jdMdt/3h0ZXe jqgs5GyqCMMBT5dmNVrNPiPjBJml42xZoCtV7Uldm5kAtEXibdpPeJmhu7EqTWLEMr86 RW4UxP8NqMmTsmGQPbTKWSjTrl7IOa7tj66/W+VaD1acqdRrBzm2mEGt1xAY+V6Z1J2H BhzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737009463; x=1737614263; 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=cQv/ZE2tEwgR4LYQR/WYSXNjTkNppKAUQyzj+3pAJZM=; b=aU0pNGCQk0iC284ueB1sIu9kFgVP5Eb1mlBHfOJDuMbGvTztyDCWNu1AuC6IwjlBRC 0t0l14qe371mjz4Kn6RqC+4p80pRvetnTvPutRuglziwNPfWhMJuBY+TL8rtCNvE+74p h9IKZDo6VXqrWPUITnKPZaAfwWYLuGnZnBo3MHWnLsR/RyfOQxW77bEyPAt7FRB7dc5B wM0Rmn4FHHquXwvN0xA7Oz1ILloOloaS1DYS6TKzR5RUy2tzc47iTxyoFV50EBaH6s8n Zv6eZfiZAg/kk38ouN0ChguX1NTVt4dx/QSLXGxqW3h70oZFC7JwqY719rzAFph3tc3G MoDg== X-Forwarded-Encrypted: i=1; AJvYcCWqLYK8jwpqcJ4j65uq47P0uR9GYlbnDW72peLfESLFxrkW9SkmdHGkyeWnpVFCfteIBhe3vy0qM6X3P/ab54E=@postgresql.org X-Gm-Message-State: AOJu0Yy15ZWE713o+WMqdWd5PwfYqw+dVOGwjgwRywYhTRk/wew86PUW UUKvBmDTNs9n17uAy9m85r1MBvhj1Cj3KquUW43QrFiPP0l+pFOvhBQCN46JQb6EbsxrQ+x38Ki bIK7qXCrJDTXbQJr/1D0fd9x1IJT3jBUbkpuO X-Gm-Gg: ASbGncuuM3gNMhrWluRd5A7M7E8VvD7ZxwTLZfF6u/tDp6SkshthA0gYlx7kZohx//0 YT33KIc4lSsrwzCeEGzvG7XAQmuZHr9DjeWecU9bVJCudOw3LfyxxMOUAWsHhPjLfNt55QyIL X-Google-Smtp-Source: AGHT+IH6pBzE6P4j/+fIwHejVJ4Cyfw0KB47MbKIVQWtdHYebx4O4sj9nv/SInNgqQAXOzC65CBhFnsPKnl0x+PZft8= X-Received: by 2002:a05:6870:71c6:b0:29e:247b:4f77 with SMTP id 586e51a60fabf-2aa06739003mr6838932fac.20.1737009462710; Wed, 15 Jan 2025 22:37:42 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Aditya Toshniwal Date: Thu, 16 Jan 2025 12:07:05 +0530 X-Gm-Features: AbW1kvb-p5_73tCPFdspi5WIMRvaPfzSSY1gb0V7c6yb2pxsPIQYF18njZEO7qs Message-ID: Subject: Re: Regarding feature #3319 To: Anil Sahoo Cc: Dave Page , pgadmin-hackers Content-Type: multipart/alternative; boundary="000000000000ff3135062bcd076d" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000ff3135062bcd076d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Anil/Dave, Why not use browser localStorage for saving this information? It persists when the browser closes and is based on the URL. It is safer to store at the user's machine than on our server. For Electron also it should work. This will reduce load on the pgAdmin server. On Wed, Aug 28, 2024 at 12:50=E2=80=AFPM Anil Sahoo wrote: > Hi Hackers, > > > We are going to store the below details > > 1. List of Query tools opened > 2. List of connections present in each query tool > 3. Each connection=E2=80=99s details that are required to make the con= nection > once the application restarts > 4. Active connection details of each query tool opened > 5. Store the query that is written in the editor that may or may not > be executed > 6. Store the contents of the scratch pad > 7. Store the file which is opened in the query tool with any unsaved > changes > > Some questions that I have are mentioned below, > > 1. For desktop mode the application is opened with some query tools > and the user closes the application and on restarts the tabs will open= as > it is and will restore the workspace and connections on query tool tab= s. > But for server mode do we need to restore the query tool tabs and > workspace? Because we see most of the desktop applications have this > feature. > 2. I came across one issue reported by one user i.e > https://github.com/pgadmin-org/pgadmin4/issues/6666, where pgAdmin > crashed due to long SQL scripts that can be in Megabytes stored as que= ry > history. We fixed it by giving MAX_QUERY_LENGTH to 1000000, and > checking if any query length is below the value then it gets stored in= the > database as query history else not. Should we go with storing the work= space > and query tool details in SQLite DB or use a file system to store the > details and retrieve the content accordingly? > > > Please let me know your suggestions on this. > > Thanks > Anil > -- > > > > *Anil Sahoo* > > Software Engineer > > www.enterprisedb.com > > Power to Postgres > > > > > > > > On Tue, Aug 20, 2024 at 10:14=E2=80=AFAM Aditya Toshniwal < > aditya.toshniwal@enterprisedb.com> wrote: > >> Hi Anil, >> >> There can be multiple query tools open with large files. Not entirely >> sure if storing in SQLite DB is a good idea. >> External databases won't come in the picture as 99.99% users will not us= e >> external DB for desktop app. We're only doing this for desktop app. >> And also consider the case where a SQL file is opened with some unsaved >> changes. >> >> On Tue, Aug 20, 2024 at 9:11=E2=80=AFAM Anil Sahoo >> wrote: >> >>> Hi Aditya, >>> >>> As we are already storing the query history in the pgAdmin 4's database >>> file. >>> I am planning to store the information the same way. That can be an >>> internal database file like SQLite or external database. >>> >>> Let me know if you all have any suggestions on this. >>> >>> Thanks >>> Anil >>> -- >>> >>> >>> >>> *Anil Sahoo* >>> >>> Software Engineer >>> >>> www.enterprisedb.com >>> >>> Power to Postgres >>> >>> >>> >>> >>> >>> >>> >>> On Mon, Aug 19, 2024 at 11:40=E2=80=AFAM Aditya Toshniwal < >>> aditya.toshniwal@enterprisedb.com> wrote: >>> >>>> Hi Anil, >>>> >>>> On Mon, Aug 12, 2024 at 3:02=E2=80=AFPM Anil Sahoo >>>> wrote: >>>> >>>>> Hi, >>>>> >>>>> Yes, We will store the details that are needed to re-establish the >>>>> connection. >>>>> >>>> >>>> How/Where are you planning to store the information? Query text could >>>> be large. >>>> >>>>> >>>>> Regards >>>>> Anil >>>>> -- >>>>> >>>>> >>>>> >>>>> *Anil Sahoo* >>>>> >>>>> Software Engineer >>>>> >>>>> www.enterprisedb.com >>>>> >>>>> Power to Postgres >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> On Mon, Aug 12, 2024 at 2:08=E2=80=AFPM Dave Page = wrote: >>>>> >>>>>> Hi >>>>>> >>>>>> On Mon, 12 Aug 2024 at 06:50, Anil Sahoo >>>>>> wrote: >>>>>> >>>>>>> Hi Hackers, >>>>>>> >>>>>>> >>>>>>> This feature #3319 >>>>>>> , demands the >>>>>>> Workspace and the Query tool panel to be saved before exiting the >>>>>>> application and on restart it will show earlier opened panels. >>>>>>> >>>>>>> >>>>>>> We are already saving the Browser layout, Query tool layout and the >>>>>>> Object explorer tree state but to save the contents of panels we wi= ll >>>>>>> initially start with the Query tool. The below implementation will = be done, >>>>>>> >>>>>>> 1. Store the query tool panels and the list of connections >>>>>>> present in each query tool panel and the active connection >>>>>>> 2. Store the query that is written in the editor >>>>>>> 3. Store the contents of scratch pad >>>>>>> >>>>>>> The main reason that this has never been worked on is that there is >>>>>> no way to restore the state of a connection to what it was and be su= re >>>>>> we've got it right. How do you propose to handle that? I assume in a >>>>>> similar way to the warnings we give if a connection has to be >>>>>> re-established? >>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> We will use debouncing to store the workspace data and all other >>>>>>> data related to panels in the pgAdmin 4's configured database file.= Through >>>>>>> debouncing we will be able to call the API at certain intervals of = user >>>>>>> interaction, and it will update the stored data related to workspac= e and >>>>>>> all other panels. >>>>>>> >>>>>> >>>>>> OK. >>>>>> >>>>>> -- >>>>>> Dave Page >>>>>> pgAdmin: https://www.pgadmin.org >>>>>> PostgreSQL: https://www.postgresql.org >>>>>> EDB: https://www.enterprisedb.com >>>>>> >>>>>> PGDay UK 2024, 11th September, London: https://2024.pgday.uk/ >>>>>> >>>>>> >>>> >>>> -- >>>> Thanks, >>>> Aditya Toshniwal >>>> pgAdmin Hacker | Sr. Software Architect | *enterprisedb.com* >>>> >>>> "Don't Complain about Heat, Plant a TREE" >>>> >>> >> >> -- >> Thanks, >> Aditya Toshniwal >> pgAdmin Hacker | Sr. Software Architect | *enterprisedb.com* >> >> "Don't Complain about Heat, Plant a TREE" >> > --=20 Thanks, Aditya Toshniwal pgAdmin Hacker | Sr. Staff SDE II | *enterprisedb.com* "Don't Complain about Heat, Plant a TREE" --000000000000ff3135062bcd076d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi=C2=A0Anil/Dave,

Why not use browser localStorage for sa= ving this information? It persists when the browser closes and is based on = the URL. It is safer to store at the user's machine than on our server.= =C2=A0
For Electron also it should work.
This will reduce load on the pgAdm= in server.

=
On Wed, Aug 28, 2024 at 12:50=E2=80= =AFPM Anil Sahoo <anil.sa= hoo@enterprisedb.com> wrote:

Hi Hackers,


We are going to store the below details

  1. List of Query tools opened
  2. List of connections present in each query to= ol
  3. Each connection=E2=80=99s details that are r= equired to make the connection once the application restarts
  4. Active connection details of each query tool= opened
  5. Store the query that is written in the edito= r that may or may not be executed
  6. Store the contents of the scratch pad=
  7. Store the file which is opened in the query = tool with any unsaved changes

Some questions that I have are mentioned belo= w,

  1. For desktop mode the application is opened w= ith some query tools and the user closes the application and on restarts th= e tabs will open as it is and will restore the workspace and connections on= query tool tabs. But for server mode do we need to restore the query tool = tabs and workspace? Because we see most of the desktop applications have th= is feature.=C2=A0
  2. I came across one issue reported by one user= i.e https://github.com/pgadmi= n-org/pgadmin4/issues/6666, where pgAdmin crashed due to long SQ= L scripts that can be in Megabytes stored as query history.=C2=A0 We fixed it by giving MAX_QUERY_LENGTH=C2=A0 to 1000000, a= nd checking if any query length is below the value then it gets stored in t= he database as query history else not. Should we go with storing the worksp= ace and query tool details in SQLite DB or use a file system to store the d= etails and retrieve the content accordingly?

Please let me know your suggesti= ons on this.

<= /div>
Thanks
Anil
--
<= table style=3D"border:none;border-collapse:collapse">

An= il Sahoo

Software Engineer<= /font>

Power to Postgres

<= /span>=C2=A0 =C2=A0 =C2= =A0 = =C2=A0 =C2=A0



On Tue, Aug 20, 2024 at 10:14=E2=80=AFAM Aditya Tos= hniwal <aditya.toshniwal@enterprisedb.com> wrote:
Hi Anil,

There can= be multiple query tools open with large files. Not entirely sure if storin= g in SQLite DB is a good idea.
External databases won't come in the pic= ture as 99.99% users will not use external DB for desktop app. We're on= ly doing this for desktop app.
And also consider the case where a SQL file = is opened with some unsaved changes.

On Tue, Aug 20, 2024 at 9:11=E2= =80=AFAM Anil Sahoo <anil.sahoo@enterprisedb.com> wrote:
Hi Aditya,
As we are already storing the query history in the pgAdmin 4&#= 39;s database file.
I am planning to store the information the sa= me way. That can be an internal database file like SQLite or external datab= ase.=C2=A0

Let me know if you all have any sug= gestions on this.

Thanks
Anil
= --

<= col width=3D"88">

Anil Sahoo

Software Enginee= r

www.enterprisedb.com

Power to Postgres

=

=

= =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0



=
On Mon, Aug 19, 2024 at 11:40=E2=80= =AFAM Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
=
Hi=C2=A0Anil,

On Mon, Aug 12, 2024 at 3:02=E2=80=AFPM Anil = Sahoo <= anil.sahoo@enterprisedb.com> wrote:
Hi,

Yes, We will store t= he details that are needed to re-establish the connection.

How/Where are you planning=C2=A0to store the information? Query= text could be large.

Regards
Anil
--
=

Anil Sahoo=

Software Engineer

www.enterp= risedb.com

Power to Postgres

=

=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 <= /span> =C2=A0 =C2= =A0



On Mon, Aug 12, 2024 at 2:08=E2=80=AFPM Dave Page <dpage@pgadmin.org>= ; wrote:
Hi

On Mon, 12 Aug 2024 at 06:50, Anil Sahoo <anil.sahoo@enterprisedb= .com> wrote:

Hi Hackers,


This feature=C2=A0#3319, demands the Wor= kspace and the Query tool panel to be saved before exiting the application = and on restart it will show earlier opened panels.


We are already saving the Browser layout, Query tool layout and the= Object explorer tree state but to save the contents of panels we will init= ially start with the Query tool. The below implementation will be done,

  1. Store the query tool panels and the list of connections present in= each query tool panel and the active connection
  2. Store the query that is written in the editor
  3. Store the contents of scratch pad
The main reason that this has never been worked on is that there is= no way to restore the state of a connection to what it was and be sure we&= #39;ve got it right. How do you propose to handle that? I assume in a simil= ar way to the warnings we give if a connection has to be re-established?=C2= =A0


We will use debouncing to store the workspace data and all other da= ta related to panels in the pgAdmin 4's configured database file. Throu= gh debouncing we will be able to call the API at certain intervals of user = interaction, and it will update the stored data related to workspace and al= l other panels.


OK.=C2=A0<= /div>

-- =
Dave PagepgAdmin: https://w= ww.pgadmin.org
PostgreSQL: https://www.postgresql.org

PGDay UK 2024, 11th September, Londo= n: https://2024.pgday.= uk/



--
Thanks,
Aditya Toshniwal
pgAdmin Hacker=C2=A0| Sr. Software Architect=C2=A0| enterprisedb.com

--
Thanks,
Aditya Toshniwal
pgAdmin Hacker=C2=A0| Sr. Software Architect=C2=A0| enterprisedb.com

--
Thanks,
Aditya Toshniw= al
pgAdmin Hacker=C2=A0| Sr. Staff SDE II=C2= =A0| enterprisedb.com
"Don't Complain about Heat, Plant a TREE"
--000000000000ff3135062bcd076d--