Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hcVrK-0008Rq-4U for pgadmin-hackers@arkaria.postgresql.org; Sun, 16 Jun 2019 14:10:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hcVrI-0007q7-Rv for pgadmin-hackers@arkaria.postgresql.org; Sun, 16 Jun 2019 14:10:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hcVrI-0007i0-Ah for pgadmin-hackers@lists.postgresql.org; Sun, 16 Jun 2019 14:10:12 +0000 Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hcVrF-0006Of-3n for pgadmin-hackers@postgresql.org; Sun, 16 Jun 2019 14:10:10 +0000 Received: by mail-qk1-x731.google.com with SMTP id a27so4680857qkk.5 for ; Sun, 16 Jun 2019 07:10:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=kYNpp9yzLQ0vwNpn4EYE9/DZr810HLY/d9BR8EnWCps=; b=SOdOnEh1LauQxlfKqgQdjvdhUdkV6iGPXSOlhJ4ovGeuxqml5eNWsQjyZEd6JAh27T 19RO+5fJglXEyC+Dt9jETY/qYE8NkJ6EjFF8KEoyQg8SVOx2P/7MnOJ4c2gFecoXMDsX TTsaIi1/iEvkXGNABhwubooWRPtgIQunIEMJpFIqXIPTgI5U3f7iH1pPTPnBB9buG59K Q7hJIf4I9wVvgnzLrRMC+jXMZ4FsYEuFhbKGUTcPBqfa1Kt85OS3V2mEi3TpOhGG7dYX 6y6SjRUvfqfXvnlUgxVorJNWQOsgA1xgoQzbU4OeBbOVaTWwbwTr8D/8W2ePj2xWcREZ EMMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=kYNpp9yzLQ0vwNpn4EYE9/DZr810HLY/d9BR8EnWCps=; b=Sb37nCWj6uxa4jQXsMCeS8LEaL9q7upEfEbYluxNAdTbbVMm1OTe0QuNp3qf48xw6o 1OgKi0dfltREYwLtX/1TkD3q+oBsadYcfLmsacnljL/TPDssI6+4Xphg4Uv9ygaYcyqo nqDF0+nWpqcIuHHR6c5UBsJNO5cK52FvGO8djdr/el8oMJAP0Iz8snMdEiEJBZI+TeNl /TSPgWGF4m32XVd9noUMlfjJ4mxN7dij2VSkaqnmxiroHQTZ9UXv5sgKUXGjU97L9X4J 4/n8xQ1RB8SLIFipuXKGg/G2EKDIu+ZWRBz3KSQrmSigM2C87yqRHP0QC9Cu9ZCWFb+w BIVQ== X-Gm-Message-State: APjAAAXvNqWOxIn0OhLhVZsgyxG4gV033RYL1ckMP9wZuJ13PPrPbKD5 +yUndihu6rfxUDJwr4ic7gc8j6e9R4Z4nCyQCjTLBiYd X-Google-Smtp-Source: APXvYqycFZ/MZa/ot3AVg5CG0rgYykKY4sqrCf4S2IKMQpTXwMtHmhx5quD/yGkrtLbw0Jhkfx3rjjmfvHMhWFBlpK4= X-Received: by 2002:a37:4e17:: with SMTP id c23mr76522941qkb.34.1560694207516; Sun, 16 Jun 2019 07:10:07 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Yosry Muhammad Date: Sun, 16 Jun 2019 16:09:55 +0200 Message-ID: Subject: Re: [GSoC][Patch] Automatic Mode Detection V1 To: pgadmin-hackers@postgresql.org Content-Type: multipart/mixed; boundary="000000000000d7ab81058b716f9f" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000d7ab81058b716f9f Content-Type: multipart/alternative; boundary="000000000000d7ab7e058b716f9d" --000000000000d7ab7e058b716f9d Content-Type: text/plain; charset="UTF-8" This is a patch fixing a problem with the above patch that happened when: - primary key columns are renamed. - other columns are renamed to be like primary key columns. This problem happened mainly because the primary keys are identified in the front-end by their names. This can be handled in a better way in a future update where columns that are primary keys are identified by the backend and sent to the frontend instead. Also, renamed columns can be handled better by making them read-only in a future update (now they are editable but they cannot be updated as a column with the new name does not exist - it produces an error message to the user). Waiting for your feedback. Thanks ! On Sat, Jun 15, 2019 at 8:48 AM Yosry Muhammad wrote: > Dear all, > > This is my first patch of my GSoC project, query tool automatic mode > detection. > > In this patch, the initial (basic) version of the project is implemented. > In this version, query resultsets are updatable if and only if: > - All the columns belong to a single table > - No duplicate columns are available > - All the primary keys of the table are available > > Inserts, updates and deletes work automatically when the resultset is > updatable. > > The 'save' button in the query tool works automatically to save the > changes in the resultset if the query is the updatable, and saves the query > to a file otherwise. The 'save as' button stays as is. > > I will work on improving and adding features to this version throughout my > work during the summer according to what has the highest priorities > (supporting duplicate columns or columns produced by functions or > aggregations as read-only columns in the results seems like a good next > move). > > Please give me your feedback of the changes I made, and any hints or > comments that will improve my code in any aspect. > > I also have a couple of questions, > - Should the save button in the query tool work the way I am using it now? > or should there be a new dedicated button for saving the query to a file? > > - What documentations or unit tests should I write? any guidelines here > would be appreciated. > > Thanks a lot! > > > -- > *Yosry Muhammad Yosry* > > Computer Engineering student, > The Faculty of Engineering, > Cairo University (2021). > Class representative of CMP 2021. > https://www.linkedin.com/in/yosrym93/ > -- *Yosry Muhammad Yosry* Computer Engineering student, The Faculty of Engineering, Cairo University (2021). Class representative of CMP 2021. https://www.linkedin.com/in/yosrym93/ --000000000000d7ab7e058b716f9d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
This is a patch fixing a problem with the above patch= that happened when:
- primary key columns are renamed.
- other columns are renamed to be like primary key columns.

This problem happened mainly because the primary keys = are identified in the front-end by their names. This can be handled in a be= tter way in a future update where columns that are primary keys are identif= ied by the backend and sent to the frontend instead.
Also, r= enamed columns can be handled better by making them read-only in a future u= pdate (now they are editable but they cannot be updated as a column with th= e new name does not exist - it produces an error message to the user).

Waiting for your feedback. Thanks !
On Sat, J= un 15, 2019 at 8:48 AM Yosry Muhammad <yosrym93@gmail.com> wrote:
Dear all,

=
This is my first patch of my GSoC project, query tool automatic mode d= etection.

In this patch, the initial (basic) versi= on of the project is implemented. In this version, query resultsets are upd= atable if and only if:
- All the columns belong to a single table=
- No duplicate columns are available
- All the primary= keys of the table are available

Inserts, updates = and deletes work automatically when the resultset is updatable.

The 'save' button in the query tool works automat= ically to save the changes in the resultset if the query is the updatable, = and saves the query to a file otherwise. The 'save as' button stays= as is.

I will work on improving and adding fe= atures to this version throughout my work during the summer according to wh= at has the highest priorities (supporting duplicate columns or columns prod= uced by functions or aggregations as read-only columns in the results seems= like a good next move).

Please give me your feedb= ack of the changes I made, and any hints or comments that will improve my c= ode in any aspect.

I also have a couple of questio= ns,
- Should the save button in the query tool work the way I am = using it now? or should there be a new dedicated button for saving the quer= y to a file?

- What documentations or unit tests s= hould I write? any guidelines here would be appreciated.

Thanks a lot!


--
Yosry Muhammad Yosry

Computer Engineering student,
The Fac= ulty of Engineering,
Cairo University (= 2021).
Class representative of CMP 2021= .


--
--000000000000d7ab7e058b716f9d-- --000000000000d7ab81058b716f9f Content-Type: text/x-patch; charset="US-ASCII"; name="query_tool_automatic_mode_switch_v1_fix1.patch" Content-Disposition: attachment; filename="query_tool_automatic_mode_switch_v1_fix1.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jwz10tm50 ZGlmZiAtLWdpdCBhL3dlYi9wZ2FkbWluL3Rvb2xzL3NxbGVkaXRvci91dGlscy9pc19xdWVyeV9y ZXN1bHRzZXRfdXBkYXRhYmxlLnB5IGIvd2ViL3BnYWRtaW4vdG9vbHMvc3FsZWRp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GZvciByb3cgaW4g cmVzdWx0Wydyb3dzJ106CiAgICAgICAgICAgICBwcmltYXJ5X2tleXNbcm93WydhdHRuYW1lJ11d ID0gcm93Wyd0eXBuYW1lJ10KLSAgICAgICAgICAgIHByaW1hcnlfa2V5c19jb2x1bW5fbnVtYmVy cy5hcHBlbmQocm93WydhdHRudW0nXSkKKyAgICAgICAgICAgIHByaW1hcnlfa2V5c19jb2x1bW5z LmFwcGVuZCh7CisgICAgICAgICAgICAgICAgJ25hbWUnOiByb3dbJ2F0dG5hbWUnXSwKKyAgICAg ICAgICAgICAgICAnY29sdW1uX251bWJlcic6IHJvd1snYXR0bnVtJ10KKyAgICAgICAgICAgIH0p CiAgICAgICAgICAgICBwa19uYW1lcy5hcHBlbmQocm93WydhdHRuYW1lJ10pCiAKLSAgICAgICAg YWxsX3ByaW1hcnlfa2V5c19leGlzdCA9IGFsbChlbGVtIGluIGNvbHVtbl9udW1iZXJzCi0gICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIGVsZW0gaW4gcHJpbWFyeV9rZXlz X2NvbHVtbl9udW1iZXJzKQotICAgIGVsc2U6Ci0gICAgICAgIHJldHVybiBGYWxzZSwgTm9uZSwg Tm9uZSwgTm9uZQorICAgICAgICAjIENoZWNrIHRoYXQgYWxsIHByaW1hcnkga2V5cyBleGlzdCBh bmQgdGhhdCBhbGwgb2YgdGhlbSBhcmUgbm90IHJlbmFtZWQKKyAgICAgICAgIyBhbmQgb3RoZXIg Y29sdW1ucyBhcmUgbm90IHJlbmFtZWQgdG8gcHJpbWFyeSBrZXkgbmFtZXMKKyAgICAgICAgZm9y IHBrIGluIHByaW1hcnlfa2V5c19jb2x1bW5zOgorICAgICAgICAgICAgcGtfZXhpc3RzID0gRmFs c2UKKyAgICAgICAgICAgIGZvciBjb2wgaW4gY29sdW1uczoKKyAgICAgICAgICAgICAgICBpZiBj b2xbJ2NvbHVtbl9udW1iZXInXSA9PSBwa1snY29sdW1uX251bWJlciddOgorICAgICAgICAgICAg ICAgICAgICBwa19leGlzdHMgPSBUcnVlCisgICAgICAgICAgICAgICAgICAgIGlmIGNvbFsnZGlz cGxheV9uYW1lJ10gIT0gcGtbJ25hbWUnXTogICMgSWYgdGhlIHByaW1hcnkga2V5IGNvbHVtbiBp cyByZW5hbWVkCisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRmFsc2UsIE5vbmUsIE5v bmUsIE5vbmUKKyAgICAgICAgICAgICAgICAjIElmIHRoZSBjb2x1bW4gaXMgbm90IHRoZSBwcmlt YXJ5IGtleSBidXQgaXQgaXMgcmVuYW1lZCB0byBpdHMgbmFtZQorICAgICAgICAgICAgICAgIGVs aWYgY29sWydkaXNwbGF5X25hbWUnXSA9PSBwa1snbmFtZSddOgorICAgICAgICAgICAgICAgICAg ICByZXR1cm4gRmFsc2UsIE5vbmUsIE5vbmUsIE5vbmUKKworICAgICAgICAgICAgaWYgbm90IHBr X2V4aXN0czoKKyAgICAgICAgICAgICAgICByZXR1cm4gRmFsc2UsIE5vbmUsIE5vbmUsIE5vbmUK IAotICAgIGlmIGFsbF9wcmltYXJ5X2tleXNfZXhpc3Q6CisgICAgICAgICMgSWYgdGhlIGZvciBs b29wIGV4aXRlZCB3aXRob3V0IHJldHVybmluZyBmcm9tIHRoZSBmdW5jdGlvbiB0aGVuCisgICAg ICAgICMgYWxsIHByaW1hcnkga2V5cyBleGlzdCB3aXRob3V0IGJlaW5nIHJlbmFtZWQKICAgICAg ICAgcmV0dXJuIFRydWUsIHByaW1hcnlfa2V5cywgcGtfbmFtZXMsIHRhYmxlX29pZAogICAgIGVs c2U6CiAgICAgICAgIHJldHVybiBGYWxzZSwgTm9uZSwgTm9uZSwgTm9uZQo= --000000000000d7ab81058b716f9f--