[pgAdmin4][Patch] - RM 4555 - RE-SQL for Exclusion Constraint

2019-08-05 Thread Khushboo Vashi
Hi,

Please find the attached patch for the RE-SQL tests of the Exclusion
constraint node with some bug fixes in SQL.

Thanks,
Khushboo


RM_4555.patch
Description: Binary data


pgAdmin 4 commit: Ensure triggers should be updated properly for EPAS s

2019-08-05 Thread Akshay Joshi
Ensure triggers should be updated properly for EPAS server. Fixes #4559

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=b5c8c85c90b369aff0c613db32cedfc3a9667516
Author: Aditya Toshniwal 

Modified Files
--
docs/en_US/release_notes_4_12.rst  | 3 ++-
web/pgadmin/static/js/tree/tree.js | 7 +--
2 files changed, 7 insertions(+), 3 deletions(-)



Re: [pgAdmin][RM4559] Updating a trigger on EPAS server throws browser error

2019-08-05 Thread Akshay Joshi
Thanks patch applied.

On Mon, Aug 5, 2019 at 12:25 PM Aditya Toshniwal <
aditya.toshni...@enterprisedb.com> wrote:

> Hi Hackers,
>
> Attached is the patch to fix the issue where tree node path is not updated
> for EPAS triggers when trigger OID changes.
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB India | Pune
> "Don't Complain about Heat, Plant a TREE"
>


-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*


Re: [pgAdmin4][Patch] - RM 4555 - RE-SQL for Exclusion Constraint

2019-08-05 Thread Akshay Joshi
Hi Khushboo

Test case are working fine, some minor review comments:

   - Scenario name "Create/Alter Exclusion Constraint" repeating twice
   instead of that it should be more understandable.
   - File name should not be like "create/alter_exclusion_constraint_1.sql"
   it should be like 'alter_comment.sql'.


On Mon, Aug 5, 2019 at 12:30 PM Khushboo Vashi <
khushboo.va...@enterprisedb.com> wrote:

> Hi,
>
> Please find the attached patch for the RE-SQL tests of the Exclusion
> constraint node with some bug fixes in SQL.
>
> Thanks,
> Khushboo
>


-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*


pgAdmin 4 commit: Update Chinese translation.

2019-08-05 Thread Dave Page
Update Chinese translation.

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=efbad77dbe0298d2942e7ddc8eaf7bbd4d2899ca
Author: Ma Yanhong 

Modified Files
--
.../translations/zh/LC_MESSAGES/messages.mo| Bin 139372 -> 139465 bytes
.../translations/zh/LC_MESSAGES/messages.po| 704 +++--
2 files changed, 365 insertions(+), 339 deletions(-)



Re: [pgAdmin4][Patch] - RM 4555 - RE-SQL for Exclusion Constraint

2019-08-05 Thread Khushboo Vashi
Hi Akshay,

Please find the attached updated patch.

On Mon, Aug 5, 2019 at 1:20 PM Akshay Joshi 
wrote:

> Hi Khushboo
>
> Test case are working fine, some minor review comments:
>
>- Scenario name "Create/Alter Exclusion Constraint" repeating twice
>instead of that it should be more understandable.
>- File name should not be like
>"create/alter_exclusion_constraint_1.sql" it should be like
>'alter_comment.sql'.
>
>
> Fixed.

Thanks,
Khushboo

> On Mon, Aug 5, 2019 at 12:30 PM Khushboo Vashi <
> khushboo.va...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> Please find the attached patch for the RE-SQL tests of the Exclusion
>> constraint node with some bug fixes in SQL.
>>
>> Thanks,
>> Khushboo
>>
>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
>
> *Sr. Software Architect*
> *EnterpriseDB Software India Private Limited*
> *Mobile: +91 976-788-8246*
>


RM_4555_v1.patch
Description: Binary data


pgAdmin 4 commit: Add Reverse Engineered SQL tests for Exclusion Constr

2019-08-05 Thread Akshay Joshi
Add Reverse Engineered SQL tests for Exclusion Constraint. Fixes #4555

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=f8afe2ef940be607e8b6e87b62875b17e1b0c2c2
Author: Khushboo Vashi 

Modified Files
--
docs/en_US/release_notes_4_12.rst  |   1 +
.../tests/11_plus/alter_exclusion_constraint.sql   |  14 +++
.../tests/11_plus/create_exclusion_constraint.sql  |  15 +++
.../tests/11_plus/msql_exclusion_constraint.sql|   6 ++
.../exclusion_constraint/tests/11_plus/test.json   |  81 ++
.../tests/default/alter_exclusion_constraint.sql   |  13 +++
.../tests/default/alter_without_fillfactor.sql |  10 ++
.../tests/default/create_exclusion_constraint.sql  |  13 +++
.../tests/default/create_without_fillfactor.sql|  11 ++
.../tests/default/msql_exclusion_constraint.sql|   6 ++
.../tests/default/msql_without_fillfactor.sql  |   6 ++
.../exclusion_constraint/tests/default/test.json   | 120 +
.../exclusion_constraint/sql/11_plus/create.sql|   8 +-
.../sql/11_plus/properties.sql |   2 +-
.../exclusion_constraint/sql/default/create.sql|   1 +
.../sql/default/properties.sql |   2 +-
.../exclusion_constraint/sql/default/update.sql|   6 +-
17 files changed, 308 insertions(+), 7 deletions(-)



Re: [pgAdmin4][Patch] - RM 4555 - RE-SQL for Exclusion Constraint

2019-08-05 Thread Akshay Joshi
Thanks patch applied.

On Mon, Aug 5, 2019 at 2:00 PM Khushboo Vashi <
khushboo.va...@enterprisedb.com> wrote:

> Hi Akshay,
>
> Please find the attached updated patch.
>
> On Mon, Aug 5, 2019 at 1:20 PM Akshay Joshi 
> wrote:
>
>> Hi Khushboo
>>
>> Test case are working fine, some minor review comments:
>>
>>- Scenario name "Create/Alter Exclusion Constraint" repeating twice
>>instead of that it should be more understandable.
>>- File name should not be like
>>"create/alter_exclusion_constraint_1.sql" it should be like
>>'alter_comment.sql'.
>>
>>
>> Fixed.
>
> Thanks,
> Khushboo
>
>> On Mon, Aug 5, 2019 at 12:30 PM Khushboo Vashi <
>> khushboo.va...@enterprisedb.com> wrote:
>>
>>> Hi,
>>>
>>> Please find the attached patch for the RE-SQL tests of the Exclusion
>>> constraint node with some bug fixes in SQL.
>>>
>>> Thanks,
>>> Khushboo
>>>
>>
>>
>> --
>> *Thanks & Regards*
>> *Akshay Joshi*
>>
>> *Sr. Software Architect*
>> *EnterpriseDB Software India Private Limited*
>> *Mobile: +91 976-788-8246*
>>
>

-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*


JavaScript Errors in the Query Tool Leads to a False Message

2019-08-05 Thread Yosry Muhammad
Hi Hackers,

I have noticed a strange behavior in the JS code of the Query Tool. When a
JS error occurs at any point during the execution of a query, the code is
traced back to the last ajax call and goes to the catch portion (as if the
ajax call failed). This leads to a "Not connected to the server" error
message to the user, which is wrong.

I noticed this behavior before when fixing the bug where "Not connected to
the server" message appeared when the user queries a column with no
columns, which was due to a JS error being mistakenly identified as an ajax
error.

Does anybody have any idea why this happens? This doesn't seem right.

Thanks.
*Yosry Muhammad Yosry*

Computer Engineering student,
The Faculty of Engineering,
Cairo University (2021).
Class representative of CMP 2021.
https://www.linkedin.com/in/yosrym93/


[GSoC] Query History Integration with updatable query resultsets and improvements

2019-08-05 Thread Yosry Muhammad
Hi Dave and Hackers,

Please find attached a work-in-progress patch with the following
modifications to the query history:

1- Queries generated by pgAdmin in Save Data operations are now recorded in
query history. This includes transaction control commands such as 'COMMIT,
ROLLBACK, SAVEPOINT, etc.'

2- Queries are now recorded in a correct (mogrified) form after parameters
injection - as opposed to older versions < 4.10. They also appear with the
correct start time (they used to appear with the start time of the
previously executed query - a bug I found).

3- Save Data Queries are visually distinguishable in the query history.

4- Save Data Queries can be shown/hidden from history using a button.

5- Query Tool and View Data now share a common history - this makes more
sense now as data changes can be done from both modes. I had a thought to
remove the Query History from View Data mode entirely, but I thought it
might be useful for some users? I don't know.

I am done with all the functionality code, what is left is the design of
the toggling button/checkbox. For now, I am using an empty button at the
end of the toolbar (next to download button) for experimental purposes.

Do you think a button or a checkbox is more appropriate? If a button, I
would need a design to use. If a checkbox, I am going to need more help as
I am not so good with the design parts. Where should it be placed ( I am
thinking above the list of history entries) ? How should it be styled?

For now, I will start working on tests and documentation updates for this.
Looking forward to your feedback and comments !

P.S I have done a lot of refactoring especially in save_data_changes.py, I
would really appreciate it if someone reviewed these changes.

Thanks!
-- 
*Yosry Muhammad Yosry*

Computer Engineering student,
The Faculty of Engineering,
Cairo University (2021).
Class representative of CMP 2021.
https://www.linkedin.com/in/yosrym93/
diff --git a/web/pgadmin/static/js/sqleditor/history/history_collection.js b/web/pgadmin/static/js/sqleditor/history/history_collection.js
index a1654fdc..f8380598 100644
--- a/web/pgadmin/static/js/sqleditor/history/history_collection.js
+++ b/web/pgadmin/static/js/sqleditor/history/history_collection.js
@@ -30,6 +30,10 @@ export default class HistoryCollection {
 this.onResetHandler(this.historyList);
   }
 
+  toggleSaveDataEntries() {
+this.toggleSaveDataEntriesHandler();
+  }
+
   onAdd(onAddHandler) {
 this.onAddHandler = onAddHandler;
   }
@@ -37,4 +41,8 @@ export default class HistoryCollection {
   onReset(onResetHandler) {
 this.onResetHandler = onResetHandler;
   }
+
+  onToggleSaveDataEntries(toggleSaveDataEntriesHandler) {
+this.toggleSaveDataEntriesHandler = toggleSaveDataEntriesHandler;
+  }
 }
diff --git a/web/pgadmin/static/js/sqleditor/history/query_history.js b/web/pgadmin/static/js/sqleditor/history/query_history.js
index d0091596..525cfc39 100644
--- a/web/pgadmin/static/js/sqleditor/history/query_history.js
+++ b/web/pgadmin/static/js/sqleditor/history/query_history.js
@@ -13,6 +13,7 @@ export default class QueryHistory {
 this.onCopyToEditorHandler = ()=>{};
 this.histCollection.onAdd(this.onAddEntry.bind(this));
 this.histCollection.onReset(this.onResetEntries.bind(this));
+this.histCollection.onToggleSaveDataEntries(this.onToggleSaveDataEntries.bind(this));
   }
 
   focus() {
@@ -54,6 +55,10 @@ export default class QueryHistory {
 }
   }
 
+  onToggleSaveDataEntries() {
+this.queryHistEntries.toggleSaveDataEntries();
+  }
+
   render() {
 if (this.histCollection.length() == 0) {
   this.parentNode.empty()
diff --git a/web/pgadmin/static/js/sqleditor/history/query_history_details.js b/web/pgadmin/static/js/sqleditor/history/query_history_details.js
index afd75101..626e89b5 100644
--- a/web/pgadmin/static/js/sqleditor/history/query_history_details.js
+++ b/web/pgadmin/static/js/sqleditor/history/query_history_details.js
@@ -96,10 +96,13 @@ export default class QueryHistoryDetails {
 
   updateQueryMetaData() {
 let itemTemplate = (data, description) => {
-  return `
-${data}
-${description}
-`;
+  if(data)
+return `
+  ${data}
+  ${description}
+  `;
+  else
+return '';
 };
 
 this.$metaData.empty().append(
@@ -134,8 +137,23 @@ export default class QueryHistoryDetails {
 }
   }
 
+  updateInfoMessage() {
+if (this.entry.info) {
+  this.$infoMsgBlock.removeClass('d-none');
+  this.$infoMsgBlock.empty().append(
+`
+${this.entry.info}
+`
+  );
+} else {
+  this.$infoMsgBlock.addClass('d-none');
+  this.$infoMsgBlock.empty();
+}
+  }
+
   selectiveRender() {
 this.updateErrorMessage();
+this.updateInfoMessage();
 this.updateCopyButton(false);
 this.updateQueryMetaData();
 this.query_codemirror.setValue(this.entry.query);
@@ -1

Re: JavaScript Errors in the Query Tool Leads to a False Message

2019-08-05 Thread Avin Kavish
Is there a way to reproduce this? i.e force a js error during query
execution? One reason I can think of is using $.ajax({ async: false }) so
the ajax request gets handled on the main thread and anything that throws
on to the main thread gets caught.

On Tue, Aug 6, 2019 at 4:07 AM Yosry Muhammad  wrote:

> Hi Hackers,
>
> I have noticed a strange behavior in the JS code of the Query Tool. When a
> JS error occurs at any point during the execution of a query, the code is
> traced back to the last ajax call and goes to the catch portion (as if the
> ajax call failed). This leads to a "Not connected to the server" error
> message to the user, which is wrong.
>
> I noticed this behavior before when fixing the bug where "Not connected to
> the server" message appeared when the user queries a column with no
> columns, which was due to a JS error being mistakenly identified as an ajax
> error.
>
> Does anybody have any idea why this happens? This doesn't seem right.
>
> Thanks.
> *Yosry Muhammad Yosry*
>
> Computer Engineering student,
> The Faculty of Engineering,
> Cairo University (2021).
> Class representative of CMP 2021.
> https://www.linkedin.com/in/yosrym93/
>


Re: JavaScript Errors in the Query Tool Leads to a False Message

2019-08-05 Thread Aditya Toshniwal
Hi Yosry,

Yes, I have experienced the same but missed to log a bug. You can log a bug
so that someone can work on it.
To simulate the issue, just add some JS code that will cause error.

On Tue, Aug 6, 2019 at 10:06 AM Avin Kavish  wrote:

> Is there a way to reproduce this? i.e force a js error during query
> execution? One reason I can think of is using $.ajax({ async: false }) so
> the ajax request gets handled on the main thread and anything that throws
> on to the main thread gets caught.
>
> On Tue, Aug 6, 2019 at 4:07 AM Yosry Muhammad  wrote:
>
>> Hi Hackers,
>>
>> I have noticed a strange behavior in the JS code of the Query Tool. When
>> a JS error occurs at any point during the execution of a query, the code is
>> traced back to the last ajax call and goes to the catch portion (as if the
>> ajax call failed). This leads to a "Not connected to the server" error
>> message to the user, which is wrong.
>>
>> I noticed this behavior before when fixing the bug where "Not connected
>> to the server" message appeared when the user queries a column with no
>> columns, which was due to a JS error being mistakenly identified as an ajax
>> error.
>>
>> Does anybody have any idea why this happens? This doesn't seem right.
>>
>> Thanks.
>> *Yosry Muhammad Yosry*
>>
>> Computer Engineering student,
>> The Faculty of Engineering,
>> Cairo University (2021).
>> Class representative of CMP 2021.
>> https://www.linkedin.com/in/yosrym93/
>>
>

-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"


Re: JavaScript Errors in the Query Tool Leads to a False Message

2019-08-05 Thread Yosry Muhammad
Yes, if you undo this commit:

https://redmine.postgresql.org/projects/pgadmin4/repository/revisions/97e39699ead1005a4a5ef8e986d980df8f743db9

This was a fix of a bug that occurred when querying a table with no
columns. It displayed the same error mentioned in the original email and
was due to a JS error.

You can either checkout a previous commit or simply undo the difference in
sqleditor.js manually, it is only 2 lines of code. Then try querying a
table with no columns.

Your explanation seems legit to me but I am no expert in JS.

On Tue, Aug 6, 2019, 6:36 AM Avin Kavish  wrote:

> Is there a way to reproduce this? i.e force a js error during query
> execution? One reason I can think of is using $.ajax({ async: false }) so
> the ajax request gets handled on the main thread and anything that throws
> on to the main thread gets caught.
>
> On Tue, Aug 6, 2019 at 4:07 AM Yosry Muhammad  wrote:
>
>> Hi Hackers,
>>
>> I have noticed a strange behavior in the JS code of the Query Tool. When
>> a JS error occurs at any point during the execution of a query, the code is
>> traced back to the last ajax call and goes to the catch portion (as if the
>> ajax call failed). This leads to a "Not connected to the server" error
>> message to the user, which is wrong.
>>
>> I noticed this behavior before when fixing the bug where "Not connected
>> to the server" message appeared when the user queries a column with no
>> columns, which was due to a JS error being mistakenly identified as an ajax
>> error.
>>
>> Does anybody have any idea why this happens? This doesn't seem right.
>>
>> Thanks.
>> *Yosry Muhammad Yosry*
>>
>> Computer Engineering student,
>> The Faculty of Engineering,
>> Cairo University (2021).
>> Class representative of CMP 2021.
>> https://www.linkedin.com/in/yosrym93/
>>
>


Re: JavaScript Errors in the Query Tool Leads to a False Message

2019-08-05 Thread Yosry Muhammad
On Tue, Aug 6, 2019, 6:42 AM Aditya Toshniwal <
aditya.toshni...@enterprisedb.com> wrote:

> Hi Yosry,
>
> Yes, I have experienced the same but missed to log a bug. You can log a
> bug so that someone can work on it.
> To simulate the issue, just add some JS code that will cause error.
>
>>
>>
Will do.


[pgAdmin][RM4560] Allow RE-SQL test cases to be run for a module using --modules

2019-08-05 Thread Aditya Toshniwal
Hi Hackers,

Attached patch will allow to RE-SQL to run for certain modules using a
command line flag --modules foo,bar.
Added the info to README.

Kindly review.

-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"


RM4560.patch
Description: Binary data