Re: [pgadmin-hackers] [pgAdmin4][PATCH] Fix handling of double precision[] type

2017-06-15 Thread Murtuza Zabuawala
HI Dave,

Please find the patch for the added feature test for handling of RM#1928
datatype issue, other misc changes are for PEP-8.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Thu, Jun 8, 2017 at 7:21 PM, Dave Page <dp...@pgadmin.org> wrote:

> Thanks, applied.
>
> Can you update the data types feature test to cover this case please?
>
> Thanks.
>
> On Thu, Jun 8, 2017 at 6:51 AM, Murtuza Zabuawala
> <murtuza.zabuaw...@enterprisedb.com> wrote:
> > Hi,
> >
> > PFA patch to fix the handling of  double precision[] type.
> > RM#1928
> >
> > Steps to re-produce: Below given query fails to render result in Query
> tool,
> > SELECT ARRAY[1, 'nan', 3]::float[];
> >
> > --
> > Regards,
> > Murtuza Zabuawala
> > EnterpriseDB: http://www.enterprisedb.com
> > The Enterprise PostgreSQL Company
> >
> >
> > --
> > Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgadmin-hackers
> >
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
diff --git a/web/pgadmin/feature_tests/pg_datatype_validation_test.py 
b/web/pgadmin/feature_tests/pg_datatype_validation_test.py
index 69b12f3..b883aac 100644
--- a/web/pgadmin/feature_tests/pg_datatype_validation_test.py
+++ b/web/pgadmin/feature_tests/pg_datatype_validation_test.py
@@ -53,11 +53,14 @@ class PGDataypeFeatureTest(BaseFeatureTest):
 test_utils.drop_database(connection, "acceptance_test_db")
 
 def _connects_to_server(self):
-self.page.find_by_xpath("//*[@class='aciTreeText' and 
.='Servers']").click()
+self.page.find_by_xpath(
+"//*[@class='aciTreeText' and .='Servers']"
+).click()
 self.page.driver.find_element_by_link_text("Object").click()
 ActionChains(self.page.driver) \
-
.move_to_element(self.page.driver.find_element_by_link_text("Create")) \
-.perform()
+.move_to_element(
+self.page.driver.find_element_by_link_text("Create")
+).perform()
 self.page.find_by_partial_link_text("Server...").click()
 
 server_config = self.server
@@ -65,8 +68,12 @@ class PGDataypeFeatureTest(BaseFeatureTest):
 self.page.find_by_partial_link_text("Connection").click()
 self.page.fill_input_by_field_name("host", server_config['host'])
 self.page.fill_input_by_field_name("port", server_config['port'])
-self.page.fill_input_by_field_name("username", 
server_config['username'])
-self.page.fill_input_by_field_name("password", 
server_config['db_password'])
+self.page.fill_input_by_field_name(
+"username", server_config['username']
+)
+self.page.fill_input_by_field_name(
+"password", server_config['db_password']
+)
 self.page.find_by_xpath("//button[contains(.,'Save')]").click()
 
 def _schema_node_expandable(self):
@@ -77,15 +84,21 @@ class PGDataypeFeatureTest(BaseFeatureTest):
 self.page.toggle_open_tree_item('public')
 
 def _check_datatype(self):
-query = """SELECT -32767::smallint, 32767::smallint, 
-2147483647::integer, 2147483647::integer,
-9223372036854775807::bigint, 
9223372036854775807::bigint,922337203685.4775807::decimal, 
92203685.477::decimal,
-922337203685.922337203685::numeric,-92233720368547758.08::numeric;"""
-# TODO :: Currently there is an issue with ARRAY[1, 2, 'nan']::float[] 
== "1, 2, 'nan'" datatype,
-# so ignoring this, will add once the issue will be fixed.
-
-expected_output = ['-32767', '32767', '-2147483647', '2147483647', 
'9223372036854775807', '9223372036854775807',
-   '922337203685.4775807', '92203685.477', 
'922337203685.922337203685', '-92233720368547758.08'
-   ]
+query = "SELECT -32767::smallint, 32767::smallint," \
+"-2147483647::integer, 2147483647::integer," \
+"9223372036854775807::bigint, 9223372036854775807::bigint," \
+"922337203685.4775807::decimal, 92203685.477::decimal," \
+"922337203685.922337203685::numeric, " \
+"-92233720368547758.08::numeric," \
+"ARRAY[1, 2, 3]::float[], ARRAY['nan', 'nan', 'nan']::float[];"
+
+expected_output = [
+'-32767', '32767', '-214748

[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in Grant wizard

2017-06-15 Thread Murtuza Zabuawala
Hi,

PFA minor patch to fix the issue in Grant wizard, In IE browser grant
wizard do not close if user tries to close it by clicking Cancel button or
Close button.
RM#2142

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/tools/grant_wizard/templates/grant_wizard/js/grant_wizard.js 
b/web/pgadmin/tools/grant_wizard/templates/grant_wizard/js/grant_wizard.js
index fd0a4e5..f79fb2f 100644
--- a/web/pgadmin/tools/grant_wizard/templates/grant_wizard/js/grant_wizard.js
+++ b/web/pgadmin/tools/grant_wizard/templates/grant_wizard/js/grant_wizard.js
@@ -976,7 +976,7 @@ define([
   // Clear html dom elements of CodeMirror sql tab
   self.sqlControl.unbind(); // Unbind all local event 
bindings
   var cmElem = 
self.sqlControl.sqlCtrl.getWrapperElement();
-  cmElem.remove();
+  $(cmElem).remove();
   self.sqlControl.sqlCtrl = undefined;
 }
 

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] CREATE Script do not display properly on panel resize

2017-06-12 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue where SQL Panel in query tool displays truncated
sql on resize.
RM#2078

Steps to re-produce the issue:
1) Create table provided by user from RM.
2) Right click on newly created table
3) Select 'Script' -> 'CREATE Script'
4) Drag the splitter down side to maximise SQL Panel area.
*** Do not click on SQL area ***
5) You will see truncated sql.
--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js 
b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
index da24f77..ea8fedb 100644
--- a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
@@ -176,6 +176,16 @@ define([
 scrollbarStyle: 'simple'
 });
 
+// Refresh Code mirror on SQL panel resize to
+// display its value properly
+sql_panel_obj.on(wcDocker.EVENT.RESIZE_ENDED, function() {
+  setTimeout(function() {
+if(self && self.query_tool_obj) {
+  self.query_tool_obj.refresh();
+}
+  }, 200);
+});
+
 // Create panels for 'Data Output', 'Explain', 'Messages' and 'History'
 var data_output = new pgAdmin.Browser.Panel({
   name: 'data_output',

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in displaying Trigger SQL

2017-06-12 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue in Table node where it was not displaying
reversed engineered sql for Trigger(s) properly, if trigger function
associated with that trigger has parameters.
RM#2043

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
index 99f0ddc..b80bfd4 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
@@ -2132,6 +2132,48 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 else:
 return None
 
+def get_trigger_function_schema(self, data):
+"""
+This function will return trigger function with schema name
+"""
+# If language is 'edbspl' then trigger function should be
+# 'Inline EDB-SPL' else we will find the trigger function
+# with schema name.
+if data['lanname'] == 'edbspl':
+data['tfunction'] = 'Inline EDB-SPL'
+else:
+SQL = render_template(
+"/".join(
+[self.trigger_template_path,'get_triggerfunctions.sql']
+),
+tgfoid=data['tgfoid'],
+show_system_objects=self.blueprint.show_system_objects
+)
+
+status, result = self.conn.execute_dict(SQL)
+if not status:
+return internal_server_error(errormsg=res)
+
+# Update the trigger function which we have fetched with
+# schema name
+if 'rows' in result and len(result['rows']) > 0 and \
+'tfunctions' in result['rows'][0]:
+data['tfunction'] = result['rows'][0]['tfunctions']
+return data
+
+def _format_args(self, args):
+"""
+This function will format arguments.
+
+Args:
+args: Arguments
+
+Returns:
+Formated arguments for function
+"""
+formatted_args = ["'{0}'".format(arg) for arg in args]
+return ', '.join(formatted_args)
+
 def get_sql(self, did, scid, tid, data):
 """
 This function will generate create/update sql from model data
@@ -2658,9 +2700,11 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 data['schema'] = schema
 data['table'] = table
 
-if data['tgnargs'] > 1:
-# We know that trigger has more than 1 arguments, let's join 
them
-data['tgargs'] = ', '.join(data['tgargs'])
+data = self.get_trigger_function_schema(data)
+
+if len(data['custom_tgargs']) > 1:
+# We know that trigger has more than 1 argument, let's join 
them
+data['tgargs'] = self._format_args(data['custom_tgargs'])
 
 if len(data['tgattr']) > 1:
 columns = ', '.join(data['tgattr'].split(' '))
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
index a3a26d7..5cbcc4d 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
@@ -528,7 +528,7 @@ class TriggerView(PGChildNodeView):
 Returns:
 Formated arguments for function
 """
-formatted_args = ["{0}".format(arg) for arg in args]
+formatted_args = ["'{0}'".format(arg) for arg in args]
 return ', '.join(formatted_args)
 
 

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][PATCH] Consolidating gray colors in the application

2017-06-08 Thread Murtuza Zabuawala
Hi Shirley,

The new UI looks awesome :)

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Thu, Jun 8, 2017 at 6:58 PM, Shirley Wang <sw...@pivotal.io> wrote:

> Hi Murtuza,
>
> This was before we had checkboxes removed and added column and row
> highlighting. Try looking at this now with the query results grid updates
> and let me know what you think.
>
>
> On Thu, Jun 8, 2017 at 1:19 AM Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>> Hello,
>>
>> I think we could have use some different grey colour shade for SlickGrid
>> headers from wcDocker panel, It does not look bad but as a end user I'm not
>> able to differentiate between them now, please refer screenshot attached.
>>
>> Is this expected with new design style?
>>
>> [image: Inline image 1]
>>
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On Wed, Jun 7, 2017 at 9:01 PM, Dave Page <dp...@pgadmin.org> wrote:
>>
>>> Thanks, applied.
>>>
>>> On Wed, Jun 7, 2017 at 3:48 PM, Surinder Kumar
>>> <surinder.ku...@enterprisedb.com> wrote:
>>> > Hi
>>> >
>>> > I have used classes 'bg-gray-2 border-gray-3' for styling header and
>>> footer
>>> > of properties panel which are also used in other places.
>>> >
>>> > Please find attached patch.
>>> >
>>> >
>>> > On Wed, Jun 7, 2017 at 6:59 PM, Robert Eckhardt <reckha...@pivotal.io>
>>> > wrote:
>>> >>
>>> >> Thank you.
>>> >>
>>> >> -- Rob
>>> >>
>>> >> On Wed, Jun 7, 2017 at 9:28 AM, Surinder Kumar
>>> >> <surinder.ku...@enterprisedb.com> wrote:
>>> >>>
>>> >>> Sure I will send.
>>> >>>
>>> >>> On Wed, Jun 7, 2017 at 6:54 PM, Dave Page <dp...@pgadmin.org> wrote:
>>> >>>>
>>> >>>> On Wed, Jun 7, 2017 at 2:22 PM, Surinder Kumar
>>> >>>> <surinder.ku...@enterprisedb.com> wrote:
>>> >>>> > Hi
>>> >>>> >
>>> >>>> > With the latest pull, I found:
>>> >>>> > The header color of Properties panel disappears and background
>>> color
>>> >>>> > of
>>> >>>> > footer area in Edit Properties panel is changed.
>>> >>>>
>>> >>>> Oh, I missed that :-(. Can you come up with a quick fix using the
>>> new
>>> >>>> classes?
>>> >>>>
>>> >>>> --
>>> >>>> Dave Page
>>> >>>> Blog: http://pgsnake.blogspot.com
>>> >>>> Twitter: @pgsnake
>>> >>>>
>>> >>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> >>>> The Enterprise PostgreSQL Company
>>> >>>
>>> >>>
>>> >>
>>> >
>>>
>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>>
>>> --
>>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>>> To make changes to your subscription:
>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>
>>
>>
>> --
>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>
>


[pgadmin-hackers] [pgAdmin4][PATCH] Fix handling of double precision[] type

2017-06-07 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the handling of  double precision[] type.
RM#1928

Steps to re-produce: Below given query fails to render result in Query tool,
SELECT ARRAY[1, 'nan', 3]::float[];

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py 
b/web/pgadmin/utils/driver/psycopg2/__init__.py
index 502cee4..4f9ee68 100644
--- a/web/pgadmin/utils/driver/psycopg2/__init__.py
+++ b/web/pgadmin/utils/driver/psycopg2/__init__.py
@@ -62,10 +62,16 @@ psycopg2.extensions.register_type(
 (
 # To cast bytea and interval type
 17, 1186,
-# to cast int4range, int8range, numrange tsrange, tstzrange, 
daterange
-3904,3926, 3906, 3908, 3910, 3912, 3913,
+
+# to cast int4range, int8range, numrange tsrange, tstzrange,
+# daterange
+3904, 3926, 3906, 3908, 3910, 3912, 3913,
+
 # date, timestamp, timestamptz, bigint, double precision, bigint[]
-1700, 1082, 1114, 1184, 20, 701, 1016
+1700, 1082, 1114, 1184, 20, 701, 1016,
+
+# double precision[]
+1022
  ),
 'TYPECAST_TO_STRING', psycopg2.STRING)
 )

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4] To fix the error "ValueError: too many values to unpack" while polling

2017-06-07 Thread Murtuza Zabuawala
Hi,

PFA minor patch to fix the issue in query tool result polling causing
exception,
*ValueError: too many values to unpack*
RM#2470

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py 
b/web/pgadmin/utils/driver/psycopg2/__init__.py
index 502cee4..1331b26 100644
--- a/web/pgadmin/utils/driver/psycopg2/__init__.py
+++ b/web/pgadmin/utils/driver/psycopg2/__init__.py
@@ -1234,7 +1234,7 @@ Failed to reset the connection to the server due to 
following error:
 if not cur:
 return False, gettext(
 "Cursor could not be found for the async connection."
-), None
+)
 
 current_app.logger.log(
 25,

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4] To fix issues in pgAgent's modules

2017-06-07 Thread Murtuza Zabuawala
Hi,

Please find attached patch to fix the issues in pgAgent's Schedule and Step
module.

1) Error on clicking SQL panel when Schedule OR Step node is selected in
browser.
RM#1888

2) Error while dropping Schedule OR Step node.
RM#1889

3) Newly created Schedule/Step node was not displaying in browser.
RM#1890

Other misc changes are for PEP-8.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py 
b/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py
index 912ed02..bd6e248 100644
--- a/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py
@@ -345,7 +345,7 @@ SELECT EXISTS(
 status, res = self.conn.execute_dict(
 render_template(
 "/".join([self.template_path, 'nodes.sql']),
-jid=res, conn=self.conn
+jid=jid, conn=self.conn
 )
 )
 
diff --git 
a/web/pgadmin/browser/server_groups/servers/pgagent/schedules/__init__.py 
b/web/pgadmin/browser/server_groups/servers/pgagent/schedules/__init__.py
index 51ae632..fefcc49 100644
--- a/web/pgadmin/browser/server_groups/servers/pgagent/schedules/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/pgagent/schedules/__init__.py
@@ -12,7 +12,7 @@
 import json
 from functools import wraps
 
-from flask import render_template, make_response, request
+from flask import render_template, make_response, request, jsonify
 from flask_babel import gettext
 from pgadmin.browser.collection import CollectionNodeModule
 from pgadmin.browser.utils import PGChildNodeView
@@ -64,7 +64,8 @@ class JobScheduleModule(CollectionNodeModule):
 @property
 def script_load(self):
 """
-Load the module script for language, when any of the database nodes 
are initialized.
+Load the module script for schedule, when any of the pga_job
+nodes are initialized.
 
 Returns: node type of the server module.
 """
@@ -78,9 +79,9 @@ class JobScheduleView(PGChildNodeView):
 """
 class JobScheduleView(PGChildNodeView)
 
-A view class for JobSchedule node derived from PGChildNodeView. This 
class is
-responsible for all the stuff related to view like updating language
-node, showing properties, showing sql in sql pane.
+A view class for JobSchedule node derived from PGChildNodeView.
+This class is responsible for all the stuff related to view like
+updating schedule node, showing properties, showing sql in sql pane.
 
 Methods:
 ---
@@ -97,20 +98,28 @@ class JobScheduleView(PGChildNodeView):
 manager,conn & template_path properties to self
 
 * list()
-  - This function is used to list all the language nodes within that 
collection.
+  - This function is used to list all the schedule nodes within that
+  collection.
 
 * nodes()
-  - This function will used to create all the child node within that 
collection.
-Here it will create all the language node.
+  - This function will used to create all the child node within that
+  collection. Here it will create all the schedule node.
 
 * properties(gid, sid, jid, jscid)
-  - This function will show the properties of the selected language node
+  - This function will show the properties of the selected schedule node
 
 * update(gid, sid, jid, jscid)
-  - This function will update the data for the selected language node
+  - This function will update the data for the selected schedule node
 
 * msql(gid, sid, jid, jscid)
-  - This function is used to return modified SQL for the selected language 
node
+  - This function is used to return modified SQL for the
+  selected schedule node
+
+* sql(gid, sid, jid, jscid)
+  - Dummy response for sql panel
+
+* delete(gid, sid, jid, jscid)
+  - Drops job schedule
 """
 
 node_type = blueprint.node_type
@@ -126,18 +135,20 @@ class JobScheduleView(PGChildNodeView):
 
 operations = dict({
 'obj': [
-{'get': 'properties', 'put': 'update'},
+{'get': 'properties', 'put': 'update', 'delete': 'delete'},
 {'get': 'list', 'post': 'create'}
 ],
 'nodes': [{'get': 'nodes'}, {'get': 'nodes'}],
 'msql': [{'get': 'msql'}, {'get': 'msql'}],
+'sql': [{'get': 'sql'}],
 'module.js': [{}, {}, {'get': 'module_js'}]
 })
 
 def _init_(self, **kwargs):
 """
 Method is used to initialize the JobScheduleView and its base view.
-Initialize all the variables create/used dynamically like conn, 
template_path.
+Initialize all the variables create/used dynamically like conn,
+template_path.
 
  

[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in Synonym node EPAS9.2

2017-06-05 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue in Synonym node for EPAS9.2+ where Packages are
not displaying as a  target objects.
RM#1813

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/sql/9.2_plus/get_objects.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/sql/9.2_plus/get_objects.sql
new file mode 100644
index 000..0ae7aec
--- /dev/null
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/sql/9.2_plus/get_objects.sql
@@ -0,0 +1,56 @@
+{###}
+{### If Target Type is Function ###}
+{###}
+{% if trgTyp == 'f' %}
+SELECT DISTINCT proname AS name
+FROM pg_proc p, pg_namespace n
+WHERE p.pronamespace = n.oid AND
+n.nspname = {{  trgSchema|qtLiteral }} AND
+p.protype  = '0'
+ORDER BY proname;
+{###}
+{### If Target Type is Procedure ###}
+{###}
+{% elif trgTyp == 'p' %}
+SELECT DISTINCT proname AS name
+FROM pg_proc p, pg_namespace n
+WHERE p.pronamespace = n.oid AND
+n.nspname = {{  trgSchema|qtLiteral }} AND
+p.protype  = '1'
+ORDER BY proname;
+{###}
+{### If Target Type is Synonym ###}
+{###}
+{% elif trgTyp == 's' %}
+SELECT synname AS name
+FROM pg_synonym
+ORDER BY synname;
+{###}
+{### If Target Type is Package ###}
+{###}
+{% elif trgTyp == 'P' %}
+SELECT nspname AS name
+FROM pg_namespace
+WHERE nspparent IN (
+SELECT oid
+FROM pg_namespace
+WHERE nspname = {{ trgSchema|qtLiteral }} LIMIT 1
+   )
+  AND nspobjecttype = 0
+ORDER BY nspname;
+{% else %}
+{###}
+{### If Target Type is Table/View/M.View/Sequnce ###}
+{###}
+SELECT relname AS name
+FROM pg_class c, pg_namespace n
+WHERE c.relnamespace = n.oid AND
+n.nspname = {{  trgSchema|qtLiteral }} AND
+{% if trgTyp == 'v' %}
+{# If view is select then we need to fetch both view and materialized view #}
+ (c.relkind = 'v' OR c.relkind = 'm')
+{% else %}
+c.relkind = {{ trgTyp|qtLiteral }}
+{% endif %}
+ORDER BY relname;
+{% endif %}
\ No newline at end of file
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/sql/9.2_plus/properties.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/sql/9.2_plus/properties.sql
new file mode 100644
index 000..ec2724a
--- /dev/null
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/sql/9.2_plus/properties.sql
@@ -0,0 +1,31 @@
+SELECT synname AS name, pg_get_userbyid(synowner) AS owner,
+  synobjschema, synobjname,  ns.nspname as schema,
+  COALESCE(
+  (SELECT relkind
+  FROM pg_class c, pg_namespace n
+  WHERE c.relnamespace = n.oid
+AND n.nspname = synobjschema
+AND c.relname = synobjname),
+  -- For Function/Procedure
+  (SELECT CASE WHEN p.protype = '0' THEN 'f'::"char" ELSE 'p'::"char" END
+  FROM pg_proc p, pg_namespace n
+WHERE p.pronamespace = n.oid
+  AND n.nspname = synobjschema
+  AND p.proname = synobjname LIMIT 1),
+  -- For Package
+  (SELECT CASE WHEN count(*) > 0 THEN 'P'::"char" END
+  FROM pg_namespace
+WHERE nspparent IN (SELECT oid
+   FROM pg_namespace
+WHERE nspname = synobjschema LIMIT 1)
+  AND nspname = synobjname
+  AND nspobjecttype = 0),
+  -- Default s = Synonym
+  's') AS targettype,
+  CASE WHEN ns.nspname = 'public' THEN true ELSE false END AS is_public_synonym
+FROM pg_synonym s  JOIN pg_namespace ns ON s.synnamespace = ns.oid
+ WHERE s.synnamespace={{scid}}::oid
+ {% if syid %}
+   AND s.synname={{ syid|qtLiteral }}
+ {% endif %}
+ORDER BY synname;
\ No newline at end of file

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in procedure debugging in EPAS

2017-06-05 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue where debugger module is not throwing proper
error for unsupported argument mode type in procedure.
RM#1466

@Neel,
Can you please do quick review of this patch?

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/tools/debugger/__init__.py 
b/web/pgadmin/tools/debugger/__init__.py
index 2c0dbc4..79e5eae 100644
--- a/web/pgadmin/tools/debugger/__init__.py
+++ b/web/pgadmin/tools/debugger/__init__.py
@@ -197,6 +197,15 @@ def init_function(node_type, sid, did, scid, fid, 
trid=None):
 elif ppas_server and 
r_set['rows'][0]['prosrc'].lstrip().startswith('$__EDBwrapped__$'):
 ret_status = False
 msg = gettext("EDB Advanced Server wrapped functions cannot be 
debugged.")
+# We cannot debug if PPAS and argument mode is VARIADIC
+elif ppas_server and r_set['rows'][0]['lanname'] == 'edbspl' and \
+r_set['rows'][0]['proargmodes'] is not None and \
+'v' in r_set['rows'][0]['proargmodes']:
+ret_status = False
+msg = gettext(
+"An 'edbspl' target with a variadic argument is not supported"
+" and cannot be debugged."
+)
 else:
 # If user is super user then we should check debugger library is 
loaded or not
 if user['is_superuser']:

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] To make $ quoting consistent

2017-06-02 Thread Murtuza Zabuawala
Hi,

PFA patch to make to $ quoting consistent. in Function node
RM#1525

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/create.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/create.sql
index 9435039..8676b33 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/create.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/create.sql
@@ -33,9 +33,9 @@ CREATE{% if query_type is defined %}{{' OR REPLACE'}}{% endif 
%} FUNCTION {{ con
 AS {% if data.lanname == 'c' %}
 {{ data.probin|qtLiteral }}, {{ data.prosrc_c|qtLiteral }}
 {% else %}
-$function$
+$BODY$
 {{ data.prosrc }}
-$function${% endif -%};
+$BODY${% endif -%};
 {% if data.funcowner %}
 
 ALTER FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) 
}}({{data.func_args_without}})
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/update.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/update.sql
index 64cd0a2..6f6ba19 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/update.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/update.sql
@@ -36,9 +36,9 @@ CREATE OR REPLACE FUNCTION {{ 
conn|qtIdent(o_data.pronamespace, name) }}({% if d
 
 AS {% if 'probin' in data or 'prosrc_c' in data %}
 {% if 'probin' in data %}{{ data.probin|qtLiteral }}{% else %}{{ 
o_data.probin|qtLiteral }}{% endif %}, {% if 'prosrc_c' in data %}{{ 
data.prosrc_c|qtLiteral }}{% else %}{{ o_data.prosrc_c|qtLiteral }}{% endif 
%}{% elif 'prosrc' in data %}
-$function${{ data.prosrc }}$function${% elif o_data.lanname == 'c' %}
+$BODY${{ data.prosrc }}$BODY${% elif o_data.lanname == 'c' %}
 {{ o_data.probin|qtLiteral }}, {{ o_data.prosrc_c|qtLiteral }}{% else %}
-$function${{ o_data.prosrc }}$function${% endif -%};
+$BODY${{ o_data.prosrc }}$BODY${% endif -%};
 {% endif -%}
 
 {% if data.funcowner %}
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/create.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/create.sql
index f217afa..74c09c3 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/create.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/create.sql
@@ -33,9 +33,9 @@ CREATE{% if query_type is defined %}{{' OR REPLACE'}}{% endif 
%} FUNCTION {{ con
 AS {% if data.lanname == 'c' %}
 {{ data.probin|qtLiteral }}, {{ data.prosrc_c|qtLiteral }}
 {% else %}
-$function$
+$BODY$
 {{ data.prosrc }}
-$function${% endif -%};
+$BODY${% endif -%};
 {% if data.funcowner %}
 
 ALTER FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) 
}}({{data.func_args_without}})
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/update.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/update.sql
index 4dfeb10..402c641 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/update.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/update.sql
@@ -37,9 +37,9 @@ CREATE OR REPLACE FUNCTION {{ 
conn|qtIdent(o_data.pronamespace, name) }}({% if d
 
 AS {% if 'probin' in data or 'prosrc_c' in data %}
 {% if 'probin' in data %}{{ data.probin|qtLiteral }}{% else %}{{ 
o_data.probin|qtLiteral }}{% endif %}, {% if 'prosrc_c' in data %}{{ 
data.prosrc_c|qtLiteral }}{% else %}{{ o_data.prosrc_c|qtLiteral }}{% endif 
%}{% elif 'prosrc' in data %}
-$function${{ data.prosrc }}$function${% elif o_data.lanname == 'c' %}
+$BODY${{ data.prosrc }}$BODY${% elif o_data.lanname == 'c' %}
 {{ o_data.probin|qtLiteral }}, {{ o_data.prosrc_c|qtLiteral }}{% else %}
-$function${{ o_data.prosrc }}$function${% endif -%};
+$BODY${{ o_data.prosrc }}$BODY${% endif -%};
 {% endif -%}
 {% if data.funcowner %}
 
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.6_plus/create.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.6_plus/create.sql
index e1958c8..09022fd 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.6_plus

[pgadmin-hackers] [pgAdmin4][PATCH] To fix the validation in Types node

2017-06-02 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the validation issues with Range & External type in Types
node.
RM#1795

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
index 9c88c63..cb38b5c 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
@@ -907,7 +907,7 @@ class TypeView(PGChildNodeView, DataTypeReader):
 )
 # If type is range then check if subtype is defined or not
 if data and data[arg] == 'r':
-if data['typname'] is None:
+if 'typname' not in data or data['typname'] is None:
 return make_json_response(
 status=410,
 success=0,
@@ -918,7 +918,9 @@ class TypeView(PGChildNodeView, DataTypeReader):
 # If type is external then check if input/output
 # conversion function is defined
 if data and data[arg] == 'b':
-if data['typinput'] is None or \
+if 'typinput' not in data or \
+'typoutput' not in data or \
+data['typinput'] is None or \
 data['typoutput'] is None:
 return make_json_response(
 status=410,
@@ -1224,7 +1226,27 @@ class TypeView(PGChildNodeView, DataTypeReader):
 
 for arg in required_args:
 if arg not in data:
-return " --definition incomplete"
+return "-- definition incomplete"
+
+# Additional checks goes here
+# If type is composite then check if it has two members
+if data and data[arg] == 'c':
+if len(data['composite']) < 2:
+return "-- definition incomplete"
+
+# If type is range then check if subtype is defined or not
+if data and data[arg] == 'r':
+if 'typname' not in data or data['typname'] is None:
+return "-- definition incomplete"
+
+# If type is external then check if input/output
+# conversion function is defined
+if data and data[arg] == 'b':
+if 'typinput' not in data or \
+'typoutput' not in data or \
+data['typinput'] is None or \
+data['typoutput'] is None:
+return "-- definition incomplete"
 
 # Privileges
 if 'typacl' in data and data['typacl'] is not None:
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js
index 4c101fd..775ef2d 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js
@@ -789,42 +789,72 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) 
{
 
   this.errorModel.clear();
 
-  if (_.has(changedAttrs, 'name') &&
-(_.isUndefined(this.get('name'))
-  || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '')) {
+  if (
+_.isUndefined(this.get('name')) ||
+_.isNull(this.get('name')) ||
+String(this.get('name')).replace(/^\s+|\s+$/g, '') == ''
+  ) {
 msg = '{{ _('Name cannot be empty.') }}';
 this.errorModel.set('name', msg);
-  } else if (_.has(changedAttrs, 'schema') &&
-(_.isUndefined(this.get('schema'))
-  || String(this.get('schema')).replace(/^\s+|\s+$/g, '') == '')) {
+return msg;
+  }
+
+  if (
+_.isUndefined(this.get('schema')) ||
+_.isNull(this.get('schema')) ||
+String(this.get('schema')).replace(/^\s+|\s+$/g, '') == ''
+  ) {
 msg = '{{ _('Schema cannot be empty.') }}';
 this.errorModel.set('schema', msg);
-  } else if (_.has(changedAttrs, 'typtype') &&
-(_.isUndefined(this.get('typtype'))
-  || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '')) {
+return msg;
+  }
+
+  if (
+_.isUndefined(this.get('typtype')) ||
+_.isNull(this.get('typtype')) ||
+String(this.get('typtype')).replace(/^\s+|\s+$/g, '') == ''
+  ) {
 msg = '{

[pgadmin-hackers] [pgAdmin4][PATCH] To fix the spacing issue in SQL for Event trigger

2017-06-01 Thread Murtuza Zabuawala
Hi,

PFA minor patch to fix the issue of extra spacing in generated SQL in Event
trigger.
RM#1229

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
 
b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
index 671b6f4..e574d7a 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/__init__.py
@@ -548,6 +548,7 @@ class EventTriggerView(PGChildNodeView):
 if not isinstance(sql, (str, unicode)):
 return sql
 sql = sql.strip('\n').strip(' ')
+sql = re.sub('\n{2,}', '\n\n', sql)
 if sql == '':
 sql = "--modified SQL"
 return make_json_response(
@@ -661,6 +662,7 @@ class EventTriggerView(PGChildNodeView):
 sql_header += "\n"
 
 sql = sql_header + sql
+sql = re.sub('\n{2,}', '\n\n', sql)
 
 return ajax_response(response=sql)
 
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/templates/event_triggers/js/event_trigger.js
 
b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/templates/event_triggers/js/event_trigger.js
index 1291cfb..a5e5d21 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/templates/event_triggers/js/event_trigger.js
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/templates/event_triggers/js/event_trigger.js
@@ -58,10 +58,10 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
   name: undefined,
   eventowner: undefined,
   comment: undefined,
-  enabled: undefined,
+  enabled: "O",
   eventfuncoid: undefined,
   eventfunname: undefined,
-  eventname: undefined,
+  eventname: "DDL_COMMAND_START",
   when: undefined,
   xmin: undefined,
   source: undefined,

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][Patch]: Fixed RM 2324 - PostGIS datatypes not showing up properly on SQL tab.

2017-06-01 Thread Murtuza Zabuawala
On Thu, Jun 1, 2017 at 5:27 PM, Khushboo Vashi <
khushboo.va...@enterprisedb.com> wrote:

> Hi,
>
>
> On Thu, Jun 1, 2017 at 4:57 PM, Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>> Hi Khushboo,
>>
>> Please include Type node and Foreign Table node in your fix :-)
>>
>> I don't think Type node requires this change.
>
> Yes, It do require because user can create composite type from existing
types.
[image: Inline image 1]

> Foreign table changes added in the attached updated patch.
>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On Thu, Jun 1, 2017 at 3:23 PM, Khushboo Vashi <
>> khushboo.va...@enterprisedb.com> wrote:
>>
>>> Hi,
>>>
>>> Please find the attached patch to fix RM #2324 : PostGIS datatypes not
>>> showing up properly on SQL tab.
>>>
>>> Thanks,
>>> Khushboo
>>>
>>>
>>>
>>> --
>>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>>> To make changes to your subscription:
>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>
>>>
>>
>


Re: [pgadmin-hackers] [pgAdmin4][Patch]: Fixed RM 2324 - PostGIS datatypes not showing up properly on SQL tab.

2017-06-01 Thread Murtuza Zabuawala
Hi Khushboo,

Please include Type node and Foreign Table node in your fix :-)

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Thu, Jun 1, 2017 at 3:23 PM, Khushboo Vashi <
khushboo.va...@enterprisedb.com> wrote:

> Hi,
>
> Please find the attached patch to fix RM #2324 : PostGIS datatypes not
> showing up properly on SQL tab.
>
> Thanks,
> Khushboo
>
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>
>


[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in index or exclusion contrarians node

2017-05-31 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue in index or exclusion contrarians node where it
was throwing "can't execute an empty query" error due to incorrect
validation logic for edit mode.
RM#2113

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/templates/exclusion_constraint/js/exclusion_constraint.js
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/templates/exclusion_constraint/js/exclusion_constraint.js
index eee9ad2..5972c51 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/templates/exclusion_constraint/js/exclusion_constraint.js
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/templates/exclusion_constraint/js/exclusion_constraint.js
@@ -24,7 +24,22 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
   },{
 id: 'oper_class', label:'{{ _('Operator class') }}', type:'text',
 node: 'table', url: 'get_oper_class', first_empty: true,
-editable: true,
+editable: function(m) {
+  if (m instanceof Backbone.Collection) {
+return true;
+  } else if ((_.has(m.collection, 'handler') &&
+!_.isUndefined(m.collection.handler) &&
+!_.isUndefined(m.collection.handler.get('oid' {
+return false;
+  } else if (_.has(m.collection, 'handler') &&
+!_.isUndefined(m.collection.handler) &&
+!_.isUndefined(m.collection.handler.get('amname')) &&
+m.collection.handler.get('amname') != 'btree') {
+// Disable if access method is not btree
+return false;
+  }
+  return true;
+},
 select2: {
   allowClear: true, width: 'style', tags: true,
   placeholder: '{{ _("Select the operator class") }}'
@@ -65,6 +80,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
   url: full_url,
   success: function(res) {
 data = res.data;
+self.column.set('options', data);
   },
   error: function() {
 eventHandler.trigger('pgadmin:view:fetch:error', m, 
self.column);
@@ -72,18 +88,6 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
 });
 eventHandler.trigger('pgadmin:view:fetched', m, self.column);
   }
-  /*
-   * Transform the data
-   */
-  transform = self.column.get('transform') || 
self.defaults.transform;
-  if (transform && _.isFunction(transform)) {
-// We will transform the data later, when rendering.
-// It will allow us to generate different data based on the
-// dependencies.
-self.column.set('options', transform.bind(self, data));
-  } else {
-self.column.set('options', data);
-  }
 } else {
   self.column.set('options', []);
 }
@@ -94,49 +98,42 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
 options: {
   onText: 'ASC',
   offText: 'DESC',
-},editable: function(m) {
+},
+editable: function(m) {
   if (m instanceof Backbone.Collection) {
 return true;
-  }
-  else {
-if (m.top.get('amname') === 'btree') {
-  m.set('is_sort_nulls_applicable', true);
-  return true;
-}
-m.set('is_sort_nulls_applicable', false);
-return false;
-  }
-  if ((_.has(m.collection, 'handler') &&
+  } else if ((_.has(m.collection, 'handler') &&
 !_.isUndefined(m.collection.handler) &&
 !_.isUndefined(m.collection.handler.get('oid' {
 return false;
+  } else if (m.top.get('amname') === 'btree') {
+m.set('is_sort_nulls_applicable', true);
+return true;
+  } else {
+m.set('is_sort_nulls_applicable', false);
+return false;
   }
-  return true;
 }
   },{
 id: 'nulls_order', label:'{{ _('NULLs order') }}', type:"switch",
 options: {
   onText: 'FIRST',
   offText: 'LAST',
-},editable: function(m) {
+},
+editable: function(m) {
   if (m instanceof Backbone.Collection) {
 return true;
-  }
-  else {
-if (m.top.get('amname') === 'btree') {
+  } else if ((_.has(m.collection, 'handler') &&
+   

Re: [pgadmin-hackers] [pgAdmin4][Patch] Add property in trigger node to display if trigger is enabled or not

2017-05-30 Thread Murtuza Zabuawala
Hi,

PFA updated patch for the same.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Tue, May 30, 2017 at 9:13 PM, Dave Page <dp...@pgadmin.org> wrote:

> On Mon, May 29, 2017 at 10:31 AM, Murtuza Zabuawala
> <murtuza.zabuaw...@enterprisedb.com> wrote:
> > Hi,
> >
> > PFA attach patch to add property into trigger node to display if trigger
> is
> > enabled or disabled in Properties panel and also in  dialog.
> > RM#2386
>
> The switch is added, but I cannot toggle it from the dialogue. Can you
> fix that please?
>
> > Also used node-list-by-name control instead of muti-select control for
> > listing table columns to simplify the logic.
>
> OK.
>
> Thanks!
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/default/create.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/default/create.sql
index ecb0070..611a593 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/default/create.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/default/create.sql
@@ -11,7 +11,7 @@ CREATE{% if data.is_constraint_trigger %} CONSTRAINT{% endif 
%} TRIGGER {{ conn|
 {% endif %}{% if data.evnt_truncate %}
 {% if or_flag %} OR {% endif %}TRUNCATE{% set or_flag = True %}
 {% endif %}{% if data.evnt_update %}
-{% if or_flag %} OR {% endif %}UPDATE {% if data.columns|length > 0 %}OF {% 
for c in data.columns %}{% if loop.index != 1 %}, {% endif %}{{ 
conn|qtIdent(c.column) }}{% endfor %}{% endif %}
+{% if or_flag %} OR {% endif %}UPDATE {% if data.columns|length > 0 %}OF {% 
for c in data.columns %}{% if loop.index != 1 %}, {% endif %}{{ conn|qtIdent(c) 
}}{% endfor %}{% endif %}
 {% endif %}
 
 ON {{ conn|qtIdent(data.schema, data.table) }}
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/default/update.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/default/update.sql
index 86a7ba1..e400cd6 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/default/update.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/default/update.sql
@@ -14,9 +14,9 @@ CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
 {% if or_flag %} OR {% endif %}TRUNCATE{% set or_flag = True %}
 {% endif %}{% else %} {% if data.evnt_truncate %}
 {% if or_flag %} OR {% endif %}TRUNCATE{% set or_flag = True %} {%endif %} {% 
endif %}{% if data.evnt_update is not defined %}{% if o_data.evnt_update %}
-{% if or_flag %} OR {% endif %}UPDATE {% if o_data.columns|length > 0 %}OF {% 
for c in o_data.columns %}{% if loop.index != 1 %}, {% endif %}{{ 
conn|qtIdent(c.column) }}{% endfor %}{% endif %}
+{% if or_flag %} OR {% endif %}UPDATE {% if o_data.columns|length > 0 %}OF {% 
for c in o_data.columns %}{% if loop.index != 1 %}, {% endif %}{{ 
conn|qtIdent(c) }}{% endfor %}{% endif %}
 {% endif %}{% else %} {% if data.evnt_update %}
-{% if or_flag %} OR {% endif %}UPDATE {% if o_data.columns|length > 0 %}OF {% 
for c in o_data.columns %}{% if loop.index != 1 %}, {% endif %}{{ 
conn|qtIdent(c.column) }}{% endfor %}{% endif %}{% endif %}
+{% if or_flag %} OR {% endif %}UPDATE {% if o_data.columns|length > 0 %}OF {% 
for c in o_data.columns %}{% if loop.index != 1 %}, {% endif %}{{ 
conn|qtIdent(c) }}{% endfor %}{% endif %}{% endif %}
 {% endif %}
 
 ON {{ conn|qtIdent(data.schema, data.table) }}
@@ -44,3 +44,7 @@ COMMENT ON TRIGGER {{ conn|qtIdent(data.name) }} ON {{ 
conn|qtIdent(o_data.nspna
 COMMENT ON TRIGGER {{ conn|qtIdent(data.name) }} ON {{ 
conn|qtIdent(o_data.nspname, o_data.relname) }}
 IS {{data.description|qtLiteral}};
 {% endif %}
+{% if data.is_enable_trigger is defined  and o_data.is_enable_trigger != 
data.is_enable_trigger %}
+ALTER TABLE {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
+{% if data.is_enable_trigger == True %}ENABLE{% else %}DISABLE{% endif %} 
TRIGGER {{ conn|qtIdent(data.name) }};
+{% endif %}
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
index be0404f..a3a26d7 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
@@ -466,7 +466,7 @@ class TriggerView(PGChildNodeView):
 columns

[pgadmin-hackers] [pgAdmin4][Patch] To display proper SQL for Procedure node

2017-05-30 Thread Murtuza Zabuawala
Hi,

PFA patch to fix to display procedure options like IMMUTABLE STRICT
SECURITY DEFINER PARALLEL RESTRICTED in SQL (Reverse Engineered).
RM#2280

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
index e292135..77f21b8 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
@@ -933,6 +933,7 @@ class FunctionView(PGChildNodeView, DataTypeReader):
 args_without_name = []
 cnt = 1
 args_list = []
+vol_dict = {'v': 'VOLATILE', 's': 'STABLE', 'i': 'IMMUTABLE'}
 
 if 'arguments' in resp_data and len(resp_data['arguments']) > 0:
 args_list = resp_data['arguments']
@@ -961,6 +962,10 @@ class FunctionView(PGChildNodeView, DataTypeReader):
 
 if self.node_type == 'procedure':
 object_type = 'procedure'
+if 'provolatile' in resp_data:
+resp_data['provolatile'] = vol_dict.get(
+resp_data['provolatile'], ''
+)
 
 # Get Schema Name from its OID.
 if 'pronamespace' in resp_data:
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.5_plus/create.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.5_plus/create.sql
index 32249f6..b2ed406 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.5_plus/create.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.5_plus/create.sql
@@ -11,10 +11,9 @@ CREATE OR REPLACE PROCEDURE {{ 
conn|qtIdent(data.pronamespace, data.name) }}{% i
 {% if not loop.last %}, {% endif %}
 {% endfor -%}
 ){% endif %}
-{% endif %}
-{% if query_type != 'create' %}
 
-{{ data.provolatile }}{% if data.proleakproof %} LEAKPROOF {% endif %}
+{% endif %}
+{{ data.provolatile }} {% if data.proleakproof %}LEAKPROOF {% endif %}
 {% if data.proisstrict %}STRICT {% endif %}
 {% if data.prosecdef %}SECURITY DEFINER {% endif %}{% if data.procost %}
 
@@ -23,7 +22,7 @@ CREATE OR REPLACE PROCEDURE {{ 
conn|qtIdent(data.pronamespace, data.name) }}{% i
 ROWS {{data.prorows}}{% endif -%}{% if data.variables %}{% for v in 
data.variables %}
 
 SET {{ conn|qtIdent(v.name) }}={{ v.value|qtLiteral }}{% endfor -%}
-{% endif %}{% endif %}
+{% endif %}
 
 AS
 {{ data.prosrc }};
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.6_plus/create.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.6_plus/create.sql
index 4e02ad7..e8075f5 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.6_plus/create.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/ppas/sql/9.6_plus/create.sql
@@ -11,18 +11,20 @@ CREATE OR REPLACE PROCEDURE {{ 
conn|qtIdent(data.pronamespace, data.name) }}{% i
 {% if not loop.last %}, {% endif %}
 {% endfor -%}
 ){% endif %}
-{% endif %}
-{% if query_type != 'create' %}
 
-{{ data.provolatile }}{% if data.proleakproof %} LEAKPROOF {% endif %}
+{% endif %}
+{{ data.provolatile }} {% if data.proleakproof %}LEAKPROOF {% endif %}
 {% if data.proisstrict %}STRICT {% endif %}
 {% if data.prosecdef %}SECURITY DEFINER {% endif %}
 {% if data.proparallel and (data.proparallel == 'r' or data.proparallel == 
's') %}
 {% if data.proparallel == 'r' %}PARALLEL RESTRICTED{% elif data.proparallel == 
's' %}PARALLEL SAFE{% endif %}{% endif %}{% if data.procost %}
+
 COST {{data.procost}}{% endif %}{% if data.prorows %}
+
 ROWS {{data.prorows}}{% endif -%}{% if data.variables %}{% for v in 
data.variables %}
+
 SET {{ conn|qtIdent(v.name) }}={{ v.value|qtLiteral }}{% endfor -%}
-{% endif %}{% endif %}
+{% endif %}
 
 AS
 {{ data.prosrc }};

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][Patch] Add property in trigger node to display if trigger is enabled or not

2017-05-29 Thread Murtuza Zabuawala
Hi,

PFA attach patch to add property into trigger node to display if trigger is
enabled or disabled in Properties panel and also in  dialog.
RM#2386

Also used node-list-by-name control instead of muti-select control for
listing table columns to simplify the logic.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/default/create.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/default/create.sql
index ecb0070..611a593 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/default/create.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/default/create.sql
@@ -11,7 +11,7 @@ CREATE{% if data.is_constraint_trigger %} CONSTRAINT{% endif 
%} TRIGGER {{ conn|
 {% endif %}{% if data.evnt_truncate %}
 {% if or_flag %} OR {% endif %}TRUNCATE{% set or_flag = True %}
 {% endif %}{% if data.evnt_update %}
-{% if or_flag %} OR {% endif %}UPDATE {% if data.columns|length > 0 %}OF {% 
for c in data.columns %}{% if loop.index != 1 %}, {% endif %}{{ 
conn|qtIdent(c.column) }}{% endfor %}{% endif %}
+{% if or_flag %} OR {% endif %}UPDATE {% if data.columns|length > 0 %}OF {% 
for c in data.columns %}{% if loop.index != 1 %}, {% endif %}{{ conn|qtIdent(c) 
}}{% endfor %}{% endif %}
 {% endif %}
 
 ON {{ conn|qtIdent(data.schema, data.table) }}
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/default/update.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/default/update.sql
index 86a7ba1..9b023ef 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/default/update.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/trigger/sql/default/update.sql
@@ -14,9 +14,9 @@ CREATE OR REPLACE TRIGGER {{ conn|qtIdent(data.name) }}
 {% if or_flag %} OR {% endif %}TRUNCATE{% set or_flag = True %}
 {% endif %}{% else %} {% if data.evnt_truncate %}
 {% if or_flag %} OR {% endif %}TRUNCATE{% set or_flag = True %} {%endif %} {% 
endif %}{% if data.evnt_update is not defined %}{% if o_data.evnt_update %}
-{% if or_flag %} OR {% endif %}UPDATE {% if o_data.columns|length > 0 %}OF {% 
for c in o_data.columns %}{% if loop.index != 1 %}, {% endif %}{{ 
conn|qtIdent(c.column) }}{% endfor %}{% endif %}
+{% if or_flag %} OR {% endif %}UPDATE {% if o_data.columns|length > 0 %}OF {% 
for c in o_data.columns %}{% if loop.index != 1 %}, {% endif %}{{ 
conn|qtIdent(c) }}{% endfor %}{% endif %}
 {% endif %}{% else %} {% if data.evnt_update %}
-{% if or_flag %} OR {% endif %}UPDATE {% if o_data.columns|length > 0 %}OF {% 
for c in o_data.columns %}{% if loop.index != 1 %}, {% endif %}{{ 
conn|qtIdent(c.column) }}{% endfor %}{% endif %}{% endif %}
+{% if or_flag %} OR {% endif %}UPDATE {% if o_data.columns|length > 0 %}OF {% 
for c in o_data.columns %}{% if loop.index != 1 %}, {% endif %}{{ 
conn|qtIdent(c) }}{% endfor %}{% endif %}{% endif %}
 {% endif %}
 
 ON {{ conn|qtIdent(data.schema, data.table) }}
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
index be0404f..d3f51af 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/__init__.py
@@ -466,7 +466,7 @@ class TriggerView(PGChildNodeView):
 columns = []
 
 for row in rset['rows']:
-columns.append({'column': row['name']})
+columns.append(row['name'])
 
 return columns
 
@@ -572,7 +572,7 @@ class TriggerView(PGChildNodeView):
 # and convert it to string
 data['tgargs'] = self._format_args(data['custom_tgargs'])
 
-if len(data['tgattr']) > 1:
+if len(data['tgattr']) >= 1:
 columns = ', '.join(data['tgattr'].split(' '))
 data['columns'] = self._column_details(tid, columns)
 
@@ -790,8 +790,8 @@ class TriggerView(PGChildNodeView):
 
 try:
 sql, name = self.get_sql(scid, tid, trid, data)
-if not isinstance(SQL, (str, unicode)):
-return SQL
+if not isinstance(sql, (str, unicode)):
+return sql
 sql = sql.strip('\n').strip(' ')
 
 if sql == '':
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/templates/trigger/js/trigger.js
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/templates/trigger/js/trigger.js
index 3f44e7e..370bbbc 100644
--

Re: [pgadmin-hackers] feature test timeouts

2017-05-29 Thread Murtuza Zabuawala
Hi Dave,

With latest pull, PG data-type test fails on my system,

==
ERROR: runTest (pgadmin.feature_tests.pg_datatype_validation_test.
PGDataypeFeatureTest)
Test checks for PG data-types output
--
Traceback (most recent call last):
  File "/Users/edb/Documents/projects/pgadmin4/web/pgadmin/
feature_tests/pg_datatype_validation_test.py", line 44, in runTest
self._check_datatype()
  File "/Users/edb/Documents/projects/pgadmin4/web/pgadmin/
feature_tests/pg_datatype_validation_test.py", line 97, in _check_datatype
self.page.fill_codemirror_area_with(query)
  File 
"/Users/edb/Documents/projects/pgadmin4/web/regression/feature_utils/pgadmin_page.py",
line 122, in fill_codemirror_area_with
"//pre[contains(@class,'CodeMirror-line')]/../../../*[
contains(@class,'CodeMirror-code')]").click()
  File 
"/Users/edb/Documents/projects/pgadmin4/web/regression/feature_utils/pgadmin_page.py",
line 87, in find_by_xpath
return self.wait_for_element(lambda driver:
driver.find_element_by_xpath(xpath))
  File 
"/Users/edb/Documents/projects/pgadmin4/web/regression/feature_utils/pgadmin_page.py",
line 152, in wait_for_element
return self._wait_for("element to exist", element_if_it_exists)
  File 
"/Users/edb/Documents/projects/pgadmin4/web/regression/feature_utils/pgadmin_page.py",
line 188, in _wait_for
"Timed out waiting for " + waiting_for_message)
  File "/Users/edb/Documents/projects/venv_pg4/lib/python3.
5/site-packages/selenium/webdriver/support/wait.py", line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: Timed out waiting for
element to exist


--
Ran 6 tests in 170.026s

FAILED (errors=1)

==
Test Result Summary
==

PG_95:

5 tests passed
1 test failed:
PGDataypeFeatureTest (Test checks for PG data-types output)
0 tests skipped

==

Please check output in file: /Users/edb/Documents/projects/
pgadmin4/web/regression/regression.log


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Sat, May 27, 2017 at 11:47 PM, Dave Page <dp...@pgadmin.org> wrote:

> Thanks, patch applied.
>
> On Fri, May 26, 2017 at 6:26 PM, George Gelashvili
> <ggelashv...@pivotal.io> wrote:
> > Hello Hackers,
> >
> > We are running tests including feature tests in Circle CI, and have been
> > seeing some flakiness due to what we believe are insufficient wait-for
> > timeouts.
> >
> > This shouldn't increase the overall test time, but only allow waiting
> longer
> > for an element to appear, if needed.
> >
> > We've also split out the app start timeout since that seemed to need more
> > time on CI.
> >
> > Patch attached.
> >
> > Thanks!
> > Joao, Matt, and George
> >
> >
> > --
> > Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgadmin-hackers
> >
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>


[pgadmin-hackers] [pgAdmin4] [PATCH] Allow user to create ENUM type without any label

2017-05-26 Thread Murtuza Zabuawala
Hi,

PFA patch to address below,
1) Allow user to create ENUM type without any labels.
2) Allow user to add new label to existing enum type which do not have any
existing labels.
RM#2426

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
index 031e1b7..9c88c63 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py
@@ -905,16 +905,6 @@ class TypeView(PGChildNodeView, DataTypeReader):
 'Composite types require at least two members.'
 )
 )
-# If type is enum then check if it has minimum one label
-if data and data[arg] == 'e':
-if len(data['enum']) < 1:
-return make_json_response(
-status=410,
-success=0,
-errormsg=gettext(
-'Enumeration types require at least one label.'
-)
-)
 # If type is range then check if subtype is defined or not
 if data and data[arg] == 'r':
 if data['typname'] is None:
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js
index 9a195e6..4c101fd 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js
@@ -241,18 +241,6 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
   }
 }],
 validate: function() {
-  var err = {},
-  errmsg = null;
-
-  if (_.isUndefined(this.get('label') ||
-_.isNull(this.get('label')) ||
-String(this.get('label')).replace(/^\s+|\s+$/g, '') == '')) {
-  errmsg = '{{ _('Please specify the value for label.') }}';
-  this.errorModel.set('label', errmsg)
-  return errmsg;
-  } else {
-this.errorModel.unset('label');
-  }
   return null;
 }
   });
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/sql/default/update.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/sql/default/update.sql
index 7f38e97..3a0a336 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/sql/default/update.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/sql/default/update.sql
@@ -87,7 +87,7 @@ ALTER TYPE {{ conn|qtIdent(o_data.schema, o_data.name) }}
 {% if c_idx == 1 %}
 {# if first new element then add it after old data enum list#}
 ALTER TYPE {{ conn|qtIdent(o_data.schema, o_data.name) }}
-ADD VALUE {{r.label|qtLiteral}} AFTER 
{{o_data.enum[o_enum_len].label|qtLiteral }};
+ADD VALUE {{r.label|qtLiteral}} {% if o_enum_len > 0 %}AFTER 
{{o_data.enum[o_enum_len].label|qtLiteral }}{% endif %};
 {% else %}
 {# if first new element then add it after new data enum list#}
 {% set p_idx = loop.index - 2 %}

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4] [PATCH] To fix issue in UPDATE Script and Primary key order when view data

2017-05-26 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue in table node,
1) In 'UPDATE Script', '?' is missing with last column.
2) If there are multiple primary keys in table then the order of columns is
incorrect in view data ORDER BY clause.
RM#2417

Also fixed minor issue in Materialized view which I found during testing,
we were not passing database id in properties.sql which is required for
Select and Insert script to work.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
index 54bab0d..99f0ddc 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
@@ -2870,9 +2870,9 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 if len(columns) > 0:
 if len(columns) == 1:
 columns = columns[0]
-columns += "=?"
 else:
 columns = "=?, ".join(columns)
+columns += "=?"
 
 sql = u"UPDATE {0}\n\tSET {1}\n\tWHERE ;".format(
 self.qtIdent(self.conn, data['schema'], data['name']),
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
index 0ead437..836018b 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
@@ -1119,7 +1119,7 @@ class ViewNode(PGChildNodeView, VacuumSettings):
 "/".join([
 self.template_path, 'sql/properties.sql'
 ]),
-scid=scid, vid=vid,
+scid=scid, vid=vid, did=did,
 datlastsysoid=self.datlastsysoid
 )
 status, res = self.conn.execute_dict(SQL)
@@ -1180,7 +1180,7 @@ class ViewNode(PGChildNodeView, VacuumSettings):
 "/".join([
 self.template_path, 'sql/properties.sql'
 ]),
-scid=scid, vid=vid,
+scid=scid, vid=vid, did=did,
 datlastsysoid=self.datlastsysoid
 )
 status, res = self.conn.execute_dict(SQL)
diff --git a/web/pgadmin/tools/sqleditor/command.py 
b/web/pgadmin/tools/sqleditor/command.py
index 2bb90c2..9ed9154 100644
--- a/web/pgadmin/tools/sqleditor/command.py
+++ b/web/pgadmin/tools/sqleditor/command.py
@@ -10,7 +10,7 @@
 """ Implemented classes for the different object type used by data grid """
 
 from abc import ABCMeta, abstractmethod
-
+from collections import OrderedDict
 import six
 from flask import render_template
 from flask_babel import gettext
@@ -368,7 +368,7 @@ class TableCommand(GridCommand):
 conn = manager.connection(did=self.did, conn_id=self.conn_id)
 
 pk_names = ''
-primary_keys = dict()
+primary_keys = OrderedDict()
 
 if conn.connected():
 

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4] [PATCH] To fix error in SQL panel

2017-05-25 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue which due to python side validations, at many
places it was assumed that we will always get a row from query result.
RM#2427

*Note:* Almost all the database level nodes are affected by this patch.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


RM_2427.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with Node rename

2017-05-17 Thread Murtuza Zabuawala
Hi Joao,

Yes, this patch is related to browser tree issue, In this patch we have
fixed some issues with 'onUpdateTreeNode' function to handle some corner
cases for server & server-group nodes, Current code for 'onAddTreeNode',
'onUpdateTreeNode', 'onRefreshTreeNode' functions for browser tree is
coupled with their respective inner function calls and recursive in nature
due to aciTree API implementation for making function calls in orderly
manner.

@Ashesh,
Any thoughts on this?

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Tue, May 16, 2017 at 7:07 PM, Joao Pedro De Almeida Pereira <
jdealmeidapere...@pivotal.io> wrote:

> Hello Hackers,
>
> We looked into this patch and it looks like it touches part of the tree
> menu am I correct?
> In our previous conversations with Dave, he mentioned that he wanted to
> replace the tree menu with a more stable version of it. In our perspective,
> every time that we have the opportunity extract functions that are relevant
> to the tree, we should do it and also wrap them with tests so that in the
> future, when the community starts the work of upgrading the tree we could
> have some confidence that our changes are not breaking any functionality.
> Also removing as much code from template files as possible should also be
> a goal that we aim for, because that code becomes testable.
>
> Thanks
> Joao
>
> On Tue, May 16, 2017 at 8:36 AM, Harshal Dhumal <
> harshal.dhu...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> Here is updated patch to fix issue with node rename. In this patch I have
>> fixed issue which I mentioned earlier in this mail thread.
>>
>> @Murtuza, as you know all other scenarios, can you please test this patch
>> once.
>>
>> Thanks,
>>
>>
>>
>> --
>> *Harshal Dhumal*
>> *Sr. Software Engineer*
>>
>> EnterpriseDB India: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On Mon, May 15, 2017 at 2:46 PM, Dave Page <dp...@pgadmin.org> wrote:
>>
>>> OK, that needs fixing then...
>>>
>>>
>>> On Mon, May 15, 2017 at 9:59 AM, Harshal Dhumal <
>>> harshal.dhu...@enterprisedb.com> wrote:
>>>
>>>> Hi Dave,
>>>>
>>>>
>>>> --
>>>> *Harshal Dhumal*
>>>> *Sr. Software Engineer*
>>>>
>>>> EnterpriseDB India: http://www.enterprisedb.com
>>>> The Enterprise PostgreSQL Company
>>>>
>>>> On Mon, May 15, 2017 at 1:43 PM, Dave Page <dp...@pgadmin.org> wrote:
>>>>
>>>>> So is the last patch considered good?
>>>>>
>>>> Except one thing, when user renames server group (note that server
>>>> group should never be expanded before renaming) and then expands it by
>>>> clicking + icon then it's old name gets restored.
>>>>
>>>> Step:
>>>> 1. Load application in browser.
>>>> 2. Do not expand any of the server group.
>>>> 3. Rename Server group (new name gets updated in tree).
>>>> 4. Now expand Server group (old name gets restored in tree).
>>>>
>>>> Note that this happens only when Server groups was never expanded
>>>> before.
>>>>
>>>>
>>>>
>>>>>
>>>>> On Mon, May 15, 2017 at 9:11 AM, Murtuza Zabuawala <
>>>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>>>
>>>>>> Hi Dave,
>>>>>>
>>>>>> Yes, It is existing one only, We did not touch on any part of sorting
>>>>>> algorithm in this patch.
>>>>>>
>>>>>> --
>>>>>> Regards,
>>>>>> Murtuza Zabuawala
>>>>>> EnterpriseDB: http://www.enterprisedb.com
>>>>>> The Enterprise PostgreSQL Company
>>>>>>
>>>>>> On Mon, May 15, 2017 at 1:24 PM, Dave Page <dp...@pgadmin.org> wrote:
>>>>>>
>>>>>>> Ashesh is out this week. As long as new nodes are sorted with the
>>>>>>> same algorithm as existing ones, that's fine.
>>>>>>>
>>>>>>> On Mon, May 15, 2017 at 8:48 AM, Murtuza Zabuawala <
>>>>>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>>>>>
>>>>>>>> Hi Harshal,
>>>>>>>>
>>>>>>>> We are using https://github.com/javve/natural-sort for sorting
>>>

[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in server group node

2017-05-17 Thread Murtuza Zabuawala
Hi,

PFA minor patch to fix the in server group node, If you user creates/update
server group name which is already present in tree then it fails and it
does not provide clear informative error message regarding failure.

Issue found during testing node rename issue :)
RM#2414

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/server_groups/__init__.py 
b/web/pgadmin/browser/server_groups/__init__.py
index 8d28ec4..e337d85 100644
--- a/web/pgadmin/browser/server_groups/__init__.py
+++ b/web/pgadmin/browser/server_groups/__init__.py
@@ -19,9 +19,9 @@ from flask_security import current_user
 from pgadmin.browser import BrowserPluginModule
 from pgadmin.browser.utils import NodeView
 from pgadmin.utils.ajax import make_json_response, gone, \
-make_response as ajax_response
+make_response as ajax_response, bad_request
 from pgadmin.utils.menu import MenuItem
-
+from sqlalchemy import exc
 from pgadmin.model import db, ServerGroup
 
 
@@ -174,6 +174,10 @@ class ServerGroupView(NodeView):
 if u'name' in data:
 servergroup.name = data[u'name']
 db.session.commit()
+except exc.IntegrityError:
+return bad_request(gettext(
+"The specified server group already exists."
+))
 except Exception as e:
 return make_json_response(
 status=410, success=0, errormsg=e.message
@@ -220,18 +224,6 @@ class ServerGroupView(NodeView):
 )
 if data[u'name'] != '':
 try:
-check_sg = ServerGroup.query.filter_by(
-user_id=current_user.id,
-name=data[u'name']).first()
-
-# Throw error if server group already exists...
-if check_sg is not None:
-return make_json_response(
-status=409,
-success=0,
-errormsg=gettext('Server group already exists')
-)
-
 sg = ServerGroup(
 user_id=current_user.id,
 name=data[u'name'])
@@ -248,9 +240,15 @@ class ServerGroupView(NodeView):
 "icon-%s" % self.node_type,
 True,
 self.node_type,
-can_delete=True  # This is user created hence can 
deleted
+# This is user created hence can deleted
+can_delete=True
 )
 )
+except exc.IntegrityError:
+return bad_request(gettext(
+"The specified server group already exists."
+))
+
 except Exception as e:
 return make_json_response(
 status=410,

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in server stats sql (PPAS9.2)

2017-05-16 Thread Murtuza Zabuawala
Hi,

PFA minor patch to fix the in server stats sql where it was fails to
execute because it is not able to concat inet (type) when using with ||
operator.

*Fails:*
select client_addr || ':' || client_port from pg_stat_activity

*Works:*
select client_addr::text || ':' || client_port from pg_stat_activity

Fixes RM#1831

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/templates/servers/sql/9.2_plus/stats.sql
 
b/web/pgadmin/browser/server_groups/servers/templates/servers/sql/9.2_plus/stats.sql
index 0b397f6..189db28 100644
--- 
a/web/pgadmin/browser/server_groups/servers/templates/servers/sql/9.2_plus/stats.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/templates/servers/sql/9.2_plus/stats.sql
@@ -7,7 +7,7 @@ SELECT
 WHEN client_hostname IS NOT NULL AND client_hostname != '' THEN
 client_hostname || ':' || client_port
 WHEN client_addr IS NOT NULL AND client_addr::text != '' THEN
-client_addr || ':' || client_port
+client_addr::text || ':' || client_port
 WHEN client_port = -1 THEN
 'local pipe'
 ELSE
@@ -32,7 +32,7 @@ SELECT
 WHEN client_hostname IS NOT NULL AND client_hostname != '' THEN
 client_hostname || ':' || client_port
 WHEN client_addr IS NOT NULL AND client_addr::text != '' THEN
-client_addr || ':' || client_port
+client_addr::text || ':' || client_port
 WHEN client_port = -1 THEN
 'local pipe'
 ELSE
diff --git 
a/web/pgadmin/browser/server_groups/servers/templates/servers/sql/9.6_plus/stats.sql
 
b/web/pgadmin/browser/server_groups/servers/templates/servers/sql/9.6_plus/stats.sql
index a1dbc37..99bf2f4 100644
--- 
a/web/pgadmin/browser/server_groups/servers/templates/servers/sql/9.6_plus/stats.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/templates/servers/sql/9.6_plus/stats.sql
@@ -7,7 +7,7 @@ SELECT
 WHEN client_hostname IS NOT NULL AND client_hostname != '' THEN
 client_hostname || ':' || client_port
 WHEN client_addr IS NOT NULL AND client_addr::text != '' THEN
-client_addr || ':' || client_port
+client_addr::text || ':' || client_port
 WHEN client_port = -1 THEN
 'local pipe'
 ELSE
@@ -33,7 +33,7 @@ SELECT
 WHEN client_hostname IS NOT NULL AND client_hostname != '' THEN
 client_hostname || ':' || client_port
 WHEN client_addr IS NOT NULL AND client_addr::text != '' THEN
-client_addr || ':' || client_port
+client_addr::text || ':' || client_port
 WHEN client_port = -1 THEN
 'local pipe'
 ELSE
diff --git 
a/web/pgadmin/browser/server_groups/servers/templates/servers/sql/default/stats.sql
 
b/web/pgadmin/browser/server_groups/servers/templates/servers/sql/default/stats.sql
index 54447ba..6255219 100644
--- 
a/web/pgadmin/browser/server_groups/servers/templates/servers/sql/default/stats.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/templates/servers/sql/default/stats.sql
@@ -7,7 +7,7 @@ SELECT
 WHEN client_hostname IS NOT NULL AND client_hostname != '' THEN
 client_hostname || ':' || client_port
 WHEN client_addr IS NOT NULL AND client_addr::text != '' THEN
-client_addr || ':' || client_port
+client_addr::text || ':' || client_port
 WHEN client_port = -1 THEN
 'local pipe'
 ELSE
@@ -32,7 +32,7 @@ SELECT
 WHEN client_hostname IS NOT NULL AND client_hostname != '' THEN
 client_hostname || ':' || client_port
 WHEN client_addr IS NOT NULL AND client_addr::text != '' THEN
-client_addr || ':' || client_port
+client_addr::text || ':' || client_port
 WHEN client_port = -1 THEN
 'local pipe'
 ELSE

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in function node

2017-05-16 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue in function node where it was displaying wrong
query if function returns table.
RM#1851

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/create.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/create.sql
index 3819657..9435039 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/create.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/create.sql
@@ -13,7 +13,7 @@ CREATE{% if query_type is defined %}{{' OR REPLACE'}}{% endif 
%} FUNCTION {{ con
 {% endif -%}
 )
 {% endif -%}
-RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') 
%} {{ data.prorettypename }} {% elif data.proretset %} SETOF {{ 
conn|qtTypeIdent(data.prorettypename) }}{% else %} {{ 
conn|qtTypeIdent(data.prorettypename) }}{% endif %}
+RETURNS{% if data.proretset and (data.prorettypename.startswith('SETOF ') 
or data.prorettypename.startswith('TABLE')) %} {{ data.prorettypename }} {% 
elif data.proretset %} SETOF {{ conn|qtTypeIdent(data.prorettypename) }}{% else 
%} {{ conn|qtTypeIdent(data.prorettypename) }}{% endif %}
 
 LANGUAGE {{ data.lanname|qtLiteral }}
 {% if data.procost %}
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/create.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/create.sql
index 2a9bad3..f217afa 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/create.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/create.sql
@@ -13,7 +13,7 @@ CREATE{% if query_type is defined %}{{' OR REPLACE'}}{% endif 
%} FUNCTION {{ con
 {% endif -%}
 )
 {% endif %}
-RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') 
%} {{ data.prorettypename }} {% elif data.proretset %} SETOF {{ 
conn|qtTypeIdent(data.prorettypename) }}{% else %} {{ 
conn|qtTypeIdent(data.prorettypename) }}{% endif %}
+RETURNS{% if data.proretset and (data.prorettypename.startswith('SETOF ') 
or data.prorettypename.startswith('TABLE')) %} {{ data.prorettypename }} {% 
elif data.proretset %} SETOF {{ conn|qtTypeIdent(data.prorettypename) }}{% else 
%} {{ conn|qtTypeIdent(data.prorettypename) }}{% endif %}
 
 LANGUAGE {{ data.lanname|qtLiteral }}
 {% if data.procost %}
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.6_plus/create.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.6_plus/create.sql
index 9e88fd6..e1958c8 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.6_plus/create.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.6_plus/create.sql
@@ -13,7 +13,7 @@ CREATE{% if query_type is defined %}{{' OR REPLACE'}}{% endif 
%} FUNCTION {{ con
 {% endif -%}
 )
 {% endif %}
-RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') 
%} {{ data.prorettypename }} {% elif data.proretset %} SETOF {{ 
conn|qtTypeIdent(data.prorettypename) }}{% else %} {{ 
conn|qtTypeIdent(data.prorettypename) }}{% endif %}
+RETURNS{% if data.proretset and (data.prorettypename.startswith('SETOF ') 
or data.prorettypename.startswith('TABLE')) %} {{ data.prorettypename }} {% 
elif data.proretset %} SETOF {{ conn|qtTypeIdent(data.prorettypename) }}{% else 
%} {{ conn|qtTypeIdent(data.prorettypename) }}{% endif %}
 
 LANGUAGE {{ data.lanname|qtLiteral }}
 {% if data.procost %}
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/default/create.sql
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/default/create.sql
index 014c1ca..f30187d 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/default/create.sql
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/default/create.sql
@@ -13,7 +13,7 @@ CREATE{% if query_type is defined %}{{' OR REPLACE'}}{% endif 
%} FUNCTION {{ con
 {% endif -%}
 )
 {% endif -%}
-RETURNS{% if data.proretset and data.prorettypename.startswith('SETOF ') 
%} {{ data.prorettypename }} {% elif data.proretset %} SETOF {{ 
conn|qtTypeIdent(data.prorettypename) }}{% else %} {{ 
conn|qtTypeIdent(data.prorettypename) }}{% endif %}
+RETURNS{% if data.proretset

Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in FTS dictonory

2017-05-16 Thread Murtuza Zabuawala
++ Attaching patch.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Tue, May 16, 2017 at 12:20 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA patch to fix the issue in FTS dictionary as below,
> 1) Strip the quotes from the options.
> 2) Template is not shown in properties views if it is not in a system
> schema.
> RM#1126
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


RM_1126.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in FTS dictonory

2017-05-16 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue in FTS dictionary as below,
1) Strip the quotes from the options.
2) Template is not shown in properties views if it is not in a system
schema.
RM#1126

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in table node

2017-05-15 Thread Murtuza Zabuawala
Hi Dave,

As there were no proper steps given in RM to re-produce the issue, I
assumed that user tried to delete schema and then click on the table, hence
he got that error.
So I checked the code notice that validation was missing at a location of
error trace mentioned in RM, it assumed that we always get one row from
database.



--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, May 15, 2017 at 1:57 PM, Dave Page <dp...@pgadmin.org> wrote:

> Hi
>
> On Mon, May 15, 2017 at 7:14 AM, Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>> Hi,
>>
>> PFA minor patch to add object validation in table node for SQL and
>> Properties tab .
>> RM#2395
>>
>
> I don't see how this relates to the issue reported which is related to
> dropping a schema containing a view (from what I can tell), whereas the
> patch is changing the table module.
>
> FWIW, I can't reproduce the reported issue either.
>
> Can you clarify please?
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with Node rename

2017-05-15 Thread Murtuza Zabuawala
Hi Dave,

Yes, It is existing one only, We did not touch on any part of sorting
algorithm in this patch.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, May 15, 2017 at 1:24 PM, Dave Page <dp...@pgadmin.org> wrote:

> Ashesh is out this week. As long as new nodes are sorted with the same
> algorithm as existing ones, that's fine.
>
> On Mon, May 15, 2017 at 8:48 AM, Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>> Hi Harshal,
>>
>> We are using https://github.com/javve/natural-sort for sorting nodes
>> which is implemented by Ashesh.
>>
>> @Ashesh,
>> Any suggestion on this?
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On Mon, May 15, 2017 at 1:07 PM, Harshal Dhumal <
>> harshal.dhu...@enterprisedb.com> wrote:
>>
>>> Hi Murtuza,
>>>
>>> Currently nodes are sorted in case sensitive manner it should be case
>>> insensitive.
>>>
>>>
>>>
>>> See current Server group order is A, Servers, a1, a​2. It should be A,
>>> a1, a2, Servers.
>>> Similarly check sorting order for server and database nodes
>>>
>>>
>>> --
>>> *Harshal Dhumal*
>>> *Sr. Software Engineer*
>>>
>>> EnterpriseDB India: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>> On Fri, May 12, 2017 at 7:08 PM, Murtuza Zabuawala <
>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>
>>>> Hi Ashesh,
>>>>
>>>> Please find updated patch as discussed.
>>>>
>>>> --
>>>> Regards,
>>>> Murtuza Zabuawala
>>>> EnterpriseDB: http://www.enterprisedb.com
>>>> The Enterprise PostgreSQL Company
>>>>
>>>> On Fri, May 12, 2017 at 11:37 AM, Murtuza Zabuawala <
>>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>>
>>>>> Hi Ashesh,
>>>>>
>>>>> As discussed please find updated patch removing hardcoded check for
>>>>> server & server-group node.
>>>>>
>>>>> --
>>>>> Regards,
>>>>> Murtuza Zabuawala
>>>>> EnterpriseDB: http://www.enterprisedb.com
>>>>> The Enterprise PostgreSQL Company
>>>>>
>>>>> On Fri, Apr 28, 2017 at 1:29 PM, Murtuza Zabuawala <
>>>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>>>
>>>>>> Hi Ashesh,
>>>>>>
>>>>>> PFA updated patch for the issue.
>>>>>>
>>>>>> --
>>>>>> Regards,
>>>>>> Murtuza Zabuawala
>>>>>> EnterpriseDB: http://www.enterprisedb.com
>>>>>> The Enterprise PostgreSQL Company
>>>>>>
>>>>>> On Wed, Apr 26, 2017 at 10:29 AM, Ashesh Vashi <
>>>>>> ashesh.va...@enterprisedb.com> wrote:
>>>>>>
>>>>>>>
>>>>>>> On Mon, Apr 24, 2017 at 4:43 PM, Dave Page <dp...@pgadmin.org>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Ashesh, can you review/commit this please? Thanks.
>>>>>>>>
>>>>>>>> On Mon, Apr 24, 2017 at 6:17 AM, Murtuza Zabuawala <
>>>>>>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> PFA minor patch to fix the issue where node rename is not working
>>>>>>>>> properly after 7dd9efd8
>>>>>>>>> <https://redmine.postgresql.org/projects/pgadmin4/repository/revisions/7dd9efd811c7845d9dc985b66f8d33497f2f4bfa>
>>>>>>>>>  commit
>>>>>>>>> .
>>>>>>>>> RM#2355
>>>>>>>>>
>>>>>>>> We should remove the existing node, and then insert at right place
>>>>>>> instead of refreshing the parent.
>>>>>>> Because - that will select the parent node, and not that node, and
>>>>>>> also - it adds overhead of refreshing the whole parent node.
>>>>>>>
>>>>>>> Please send the patch as per our discussion.
>>>>>>>
>>>>>>> -- Thanks, Ashesh
>>>>>>>
>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Regards,
>>>>>>>>> Murtuza Zabuawala
>>>>>>>>> EnterpriseDB: http://www.enterprisedb.com
>>>>>>>>> The Enterprise PostgreSQL Company
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Sent via pgadmin-hackers mailing list (
>>>>>>>>> pgadmin-hackers@postgresql.org)
>>>>>>>>> To make changes to your subscription:
>>>>>>>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Dave Page
>>>>>>>> Blog: http://pgsnake.blogspot.com
>>>>>>>> Twitter: @pgsnake
>>>>>>>>
>>>>>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>>>>>> The Enterprise PostgreSQL Company
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>>>> To make changes to your subscription:
>>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>>
>>>>
>>>
>>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with Node rename

2017-05-15 Thread Murtuza Zabuawala
Hi Harshal,

We are using https://github.com/javve/natural-sort for sorting nodes which
is implemented by Ashesh.

@Ashesh,
Any suggestion on this?

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, May 15, 2017 at 1:07 PM, Harshal Dhumal <
harshal.dhu...@enterprisedb.com> wrote:

> Hi Murtuza,
>
> Currently nodes are sorted in case sensitive manner it should be case
> insensitive.
>
>
>
> See current Server group order is A, Servers, a1, a​2. It should be A,
> a1, a2, Servers.
> Similarly check sorting order for server and database nodes
>
>
> --
> *Harshal Dhumal*
> *Sr. Software Engineer*
>
> EnterpriseDB India: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Fri, May 12, 2017 at 7:08 PM, Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>> Hi Ashesh,
>>
>> Please find updated patch as discussed.
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On Fri, May 12, 2017 at 11:37 AM, Murtuza Zabuawala <
>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>
>>> Hi Ashesh,
>>>
>>> As discussed please find updated patch removing hardcoded check for
>>> server & server-group node.
>>>
>>> --
>>> Regards,
>>> Murtuza Zabuawala
>>> EnterpriseDB: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>> On Fri, Apr 28, 2017 at 1:29 PM, Murtuza Zabuawala <
>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>
>>>> Hi Ashesh,
>>>>
>>>> PFA updated patch for the issue.
>>>>
>>>> --
>>>> Regards,
>>>> Murtuza Zabuawala
>>>> EnterpriseDB: http://www.enterprisedb.com
>>>> The Enterprise PostgreSQL Company
>>>>
>>>> On Wed, Apr 26, 2017 at 10:29 AM, Ashesh Vashi <
>>>> ashesh.va...@enterprisedb.com> wrote:
>>>>
>>>>>
>>>>> On Mon, Apr 24, 2017 at 4:43 PM, Dave Page <dp...@pgadmin.org> wrote:
>>>>>
>>>>>> Ashesh, can you review/commit this please? Thanks.
>>>>>>
>>>>>> On Mon, Apr 24, 2017 at 6:17 AM, Murtuza Zabuawala <
>>>>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> PFA minor patch to fix the issue where node rename is not working
>>>>>>> properly after 7dd9efd8
>>>>>>> <https://redmine.postgresql.org/projects/pgadmin4/repository/revisions/7dd9efd811c7845d9dc985b66f8d33497f2f4bfa>
>>>>>>>  commit
>>>>>>> .
>>>>>>> RM#2355
>>>>>>>
>>>>>> We should remove the existing node, and then insert at right place
>>>>> instead of refreshing the parent.
>>>>> Because - that will select the parent node, and not that node, and
>>>>> also - it adds overhead of refreshing the whole parent node.
>>>>>
>>>>> Please send the patch as per our discussion.
>>>>>
>>>>> -- Thanks, Ashesh
>>>>>
>>>>>>
>>>>>>> --
>>>>>>> Regards,
>>>>>>> Murtuza Zabuawala
>>>>>>> EnterpriseDB: http://www.enterprisedb.com
>>>>>>> The Enterprise PostgreSQL Company
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Sent via pgadmin-hackers mailing list (pgadmin-hack...@postgresql.or
>>>>>>> g)
>>>>>>> To make changes to your subscription:
>>>>>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Dave Page
>>>>>> Blog: http://pgsnake.blogspot.com
>>>>>> Twitter: @pgsnake
>>>>>>
>>>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>>>> The Enterprise PostgreSQL Company
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>
>>
>


[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in table node

2017-05-15 Thread Murtuza Zabuawala
Hi,

PFA minor patch to add object validation in table node for SQL and
Properties tab .
RM#2395


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
index b6bf7ed..aee46c9 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
@@ -1108,6 +1108,10 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 status, res = self.conn.execute_dict(SQL)
 if not status:
 return internal_server_error(errormsg=res)
+
+if len(res['rows']) == 0:
+return gone(gettext("Could not find the object."))
+
 data = res['rows'][0]
 
 data['vacuum_settings_str'] = ""
@@ -1690,8 +1694,7 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 if not status:
 return internal_server_error(errormsg=res)
 data = res['rows'][0]
-# TODO://
-# Find SQL which can enable all or disable all triggers
+
 SQL = render_template("/".join([self.template_path,
 'enable_disable_trigger.sql']),
   data=data, is_enable_trigger=is_enable)
@@ -2494,6 +2497,9 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 if not status:
 return internal_server_error(errormsg=res)
 
+if len(res['rows']) == 0:
+return gone(gettext("Could not find the object."))
+
 data = res['rows'][0]
 
 # Table & Schema declaration so that we can use them in child nodes

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with Node rename

2017-05-12 Thread Murtuza Zabuawala
Hi Ashesh,

Please find updated patch as discussed.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Fri, May 12, 2017 at 11:37 AM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi Ashesh,
>
> As discussed please find updated patch removing hardcoded check for server
> & server-group node.
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Fri, Apr 28, 2017 at 1:29 PM, Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>> Hi Ashesh,
>>
>> PFA updated patch for the issue.
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On Wed, Apr 26, 2017 at 10:29 AM, Ashesh Vashi <
>> ashesh.va...@enterprisedb.com> wrote:
>>
>>>
>>> On Mon, Apr 24, 2017 at 4:43 PM, Dave Page <dp...@pgadmin.org> wrote:
>>>
>>>> Ashesh, can you review/commit this please? Thanks.
>>>>
>>>> On Mon, Apr 24, 2017 at 6:17 AM, Murtuza Zabuawala <
>>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> PFA minor patch to fix the issue where node rename is not working
>>>>> properly after 7dd9efd8
>>>>> <https://redmine.postgresql.org/projects/pgadmin4/repository/revisions/7dd9efd811c7845d9dc985b66f8d33497f2f4bfa>
>>>>>  commit
>>>>> .
>>>>> RM#2355
>>>>>
>>>> We should remove the existing node, and then insert at right place
>>> instead of refreshing the parent.
>>> Because - that will select the parent node, and not that node, and also
>>> - it adds overhead of refreshing the whole parent node.
>>>
>>> Please send the patch as per our discussion.
>>>
>>> -- Thanks, Ashesh
>>>
>>>>
>>>>> --
>>>>> Regards,
>>>>> Murtuza Zabuawala
>>>>> EnterpriseDB: http://www.enterprisedb.com
>>>>> The Enterprise PostgreSQL Company
>>>>>
>>>>>
>>>>> --
>>>>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>>>>> To make changes to your subscription:
>>>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Dave Page
>>>> Blog: http://pgsnake.blogspot.com
>>>> Twitter: @pgsnake
>>>>
>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>> The Enterprise PostgreSQL Company
>>>>
>>>
>>>
>>
>


fix_update_node_v3.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] backports.csv

2017-05-12 Thread Murtuza Zabuawala
Hi Dave,

I am not sure on this.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Fri, May 12, 2017 at 5:32 PM, Dave Page <dp...@pgadmin.org> wrote:

> Hi Murtuza,
>
> Your recent addition of backports.csv to the pgAdmin requirements.txt
> seems to be causing an interesting problem. Whilst it works fine in a
> regular Python environment, in the cut-down environment used by the desktop
> runtime it fails because there is no backports/__init__.py file. This seems
> to be a well-known, but un-fixed issue in which PIP doesn't install the
> file as it should.
>
> Any ideas on how we might fix this? Obviously I can just touch the file
> when building the installers, but that doesn't seem ideal.
>
> Thanks.
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue of menu visibility when node is hidden

2017-05-12 Thread Murtuza Zabuawala
Hi,

Please find updated patch with changes as per comments given by Joao.

@Joao,
Thank you for reviewing the patch.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Thu, May 11, 2017 at 8:19 PM, Joao Pedro De Almeida Pereira <
jdealmeidapere...@pivotal.io> wrote:

> Hi Murtuza,
>
> Since you are adding a new function to the browser.js component, we would
> encourage you to extract the function out of the templated javascript file
> so that it can be tested. A good example of this would be the
> pgadmin/static/js/size_prettify.js.
>
> For this specific function we found one function that is used from
> browser.js, and you can Stub that out using
> createSpyObject(browser, 'get_preference');
>
> We think the object here is not 100% line coverage but 100% of the
> behavior should be covered.
>
> Also, suggest you change the variable name perf to preference. Looks like
> it is a typo.
>
> Regards,
> João & Matt
>
> On Thu, May 11, 2017 at 3:08 AM, Murtuza Zabuawala <
> murtuza.zabuaw...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> PFA patch to fix the issue where user hides the any node from Preference
>> dialog but the menu(both context/object) still appears in pgAdmin4.
>> RM#2225
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>>
>> --
>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>
>>
>
diff --git a/web/pgadmin/browser/templates/browser/js/browser.js 
b/web/pgadmin/browser/templates/browser/js/browser.js
index a663ae8..1f93f0b 100644
--- a/web/pgadmin/browser/templates/browser/js/browser.js
+++ b/web/pgadmin/browser/templates/browser/js/browser.js
@@ -1,6 +1,7 @@
 define('pgadmin.browser',
 ['require', 'jquery', 'underscore', 'underscore.string', 'bootstrap',
-'pgadmin', 'alertify', 'codemirror', 'codemirror/mode/sql/sql', 
'wcdocker',
+'pgadmin', 'alertify', 'codemirror', 'sources/check_node_visibility',
+'codemirror/mode/sql/sql', 'wcdocker',
 'jquery.contextmenu', 'jquery.aciplugin', 'jquery.acitree',
 'pgadmin.alertifyjs', 'pgadmin.browser.messages',
 'pgadmin.browser.menu', 'pgadmin.browser.panel',
@@ -8,7 +9,10 @@ define('pgadmin.browser',
 'pgadmin.browser.node', 'pgadmin.browser.collection'
 
],
-function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
+function(
+  require, $, _, S, Bootstrap, pgAdmin, Alertify,
+  CodeMirror, checkNodeVisibility
+) {
 
   // Some scripts do export their object in the window only.
   // Generally the one, which do no have AMD support.
@@ -593,10 +597,16 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, 
CodeMirror) {
 single: single
   }
 },
+
+// This will hold preference data (Works as a cache object)
+// Here node will be a key and it's preference data will be value
+node_preference_data: {},
+
 // Add menus of module/extension at appropriate menu
 add_menus: function(menus) {
-  var pgMenu = this.menus;
-  var MenuItem = pgAdmin.Browser.MenuItem;
+  var self = this,
+pgMenu = this.menus,
+MenuItem = pgAdmin.Browser.MenuItem;
   _.each(menus, function(m) {
 _.each(m.applies, function(a) {
   /* We do support menu type only from this list */
@@ -604,6 +614,19 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, 
CodeMirror) {
   'context', 'file', 'edit', 'object',
   'management', 'tools', 'help']) >= 0) {
 var menus;
+
+// If current node is not visible in browser tree
+// then return from here
+if(!checkNodeVisibility(self, m.node)) {
+return;
+} else if(_.has(m, 'module') && !_.isUndefined(m.module)) {
+  // If module to which this menu applies is not visible in
+  // browser tree then also we do not display menu
+  if(!checkNodeVisibility(self, m.module.type)) {
+return;
+  }
+}
+
 pgMenu[a] = pgMenu[a] || {};
 if (_.isString(m.node)) {
   menus = pgMenu[a][m.node] = pgMenu[a][m.node] || {};
diff --git a/web/pgadmin/static/js/check_node_visibility.js 
b/web/pgadmin/static/js/check_node_visibility.js
new file mode 100644
index 000..987a395
--- /dev/null
+++ b/web/pgadmin/static/js/check_node_visibility.js
@@ -0,0 +1,53 @@
+//
+//
+// pgAdmin 4 - PostgreSQL Tools
+//
+// Copyright (C) 2013 - 2017, The pgAdmin Development

Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with Node rename

2017-05-12 Thread Murtuza Zabuawala
Hi Ashesh,

As discussed please find updated patch removing hardcoded check for server
& server-group node.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Fri, Apr 28, 2017 at 1:29 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi Ashesh,
>
> PFA updated patch for the issue.
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Wed, Apr 26, 2017 at 10:29 AM, Ashesh Vashi <
> ashesh.va...@enterprisedb.com> wrote:
>
>>
>> On Mon, Apr 24, 2017 at 4:43 PM, Dave Page <dp...@pgadmin.org> wrote:
>>
>>> Ashesh, can you review/commit this please? Thanks.
>>>
>>> On Mon, Apr 24, 2017 at 6:17 AM, Murtuza Zabuawala <
>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> PFA minor patch to fix the issue where node rename is not working
>>>> properly after 7dd9efd8
>>>> <https://redmine.postgresql.org/projects/pgadmin4/repository/revisions/7dd9efd811c7845d9dc985b66f8d33497f2f4bfa>
>>>>  commit
>>>> .
>>>> RM#2355
>>>>
>>> We should remove the existing node, and then insert at right place
>> instead of refreshing the parent.
>> Because - that will select the parent node, and not that node, and also -
>> it adds overhead of refreshing the whole parent node.
>>
>> Please send the patch as per our discussion.
>>
>> -- Thanks, Ashesh
>>
>>>
>>>> --
>>>> Regards,
>>>> Murtuza Zabuawala
>>>> EnterpriseDB: http://www.enterprisedb.com
>>>> The Enterprise PostgreSQL Company
>>>>
>>>>
>>>> --
>>>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>>>> To make changes to your subscription:
>>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>>
>>>>
>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>
>>
>


fix_update_node_v2.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issues with CSV file download

2017-05-11 Thread Murtuza Zabuawala
Hi Dave,

Please find patch to handle non-ascii column names in CSV for Pyhton2.

Thanks to Harshal for pointing out the issue.


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, May 8, 2017 at 6:06 PM, Dave Page <dp...@pgadmin.org> wrote:

> Thanks, patch applied.
>
> On Mon, May 8, 2017 at 1:14 PM, Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>> Hi,
>>
>> Please find the patch to fix the issues in CSV file download feature,
>>
>> 1) To handle non-ascii filenames which we set from table name
>> RM#2314
>>
>> 2) To handle non-ascii query data
>> RM#2353
>>
>> 3) To dump JSON type columns properly in csv
>> RM#2360
>>
>> Please review.
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>>
>> --
>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>
>>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py 
b/web/pgadmin/utils/driver/psycopg2/__init__.py
index 1f7ccce..502cee4 100644
--- a/web/pgadmin/utils/driver/psycopg2/__init__.py
+++ b/web/pgadmin/utils/driver/psycopg2/__init__.py
@@ -42,9 +42,11 @@ if sys.version_info < (3,):
 from StringIO import StringIO
 psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
 psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY)
+IS_PY2 = True
 else:
 from io import StringIO
 import csv
+IS_PY2 = False
 
 _ = gettext
 
@@ -624,7 +626,7 @@ WHERE
 return False, str(cur)
 query_id = random.randint(1, 999)
 
-if sys.version_info < (3,) and type(query) == unicode:
+if IS_PY2 and type(query) == unicode:
 query = query.encode('utf-8')
 
 current_app.logger.log(
@@ -670,7 +672,7 @@ WHERE
 results
 """
 # Only if Python2 and there are columns with JSON type
-if sys.version_info < (3,) and len(json_columns) > 0:
+if IS_PY2 and len(json_columns) > 0:
 temp_results = []
 for row in results:
 res = dict()
@@ -683,6 +685,26 @@ WHERE
 results = temp_results
 return results
 
+def convert_keys_to_unicode(results, conn_encoding):
+"""
+[ This is only for Python2.x]
+We need to convert all keys to unicode as psycopg2
+sends them as string
+
+Args:
+res: Query result set from psycopg2
+conn_encoding: Connection encoding
+
+Returns:
+Result set (With all the keys converted to unicode)
+"""
+new_results = []
+for row in results:
+new_results.append(
+dict([(k.decode(conn_encoding), v) for k, v in 
row.items()])
+)
+return new_results
+
 def gen():
 
 results = cur.fetchmany(records)
@@ -691,17 +713,25 @@ WHERE
 cur.close()
 yield gettext('The query executed did not return any data.')
 return
+
 header = []
 json_columns = []
+conn_encoding = cur.connection.encoding
+
 # json, jsonb, json[], jsonb[]
 json_types = (114, 199, 3802, 3807)
 for c in cur.ordered_description():
 # This is to handle the case in which column name is non-ascii
-header.append(u"" + c.to_dict()['name'])
+column_name = c.to_dict()['name']
+if IS_PY2:
+column_name = column_name.decode(conn_encoding)
+header.append(column_name)
 if c.to_dict()['type_code'] in json_types:
-json_columns.append(
-u"" + c.to_dict()['name']
-)
+json_columns.append(column_name)
+
+if IS_PY2:
+results = convert_keys_to_unicode(results, conn_encoding)
+
 res_io = StringIO()
 
 csv_writer = csv.DictWriter(
@@ -728,6 +758,10 @@ WHERE
 res_io, fieldnames=header, delimiter=u',',
 quoting=csv.QUOTE_NONNUMERIC
 )
+
+if IS_PY2:
+results = convert_keys_to_un

[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue of menu visibility when node is hidden

2017-05-11 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue where user hides the any node from Preference
dialog but the menu(both context/object) still appears in pgAdmin4.
RM#2225

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/templates/browser/js/browser.js 
b/web/pgadmin/browser/templates/browser/js/browser.js
index a663ae8..d9a94f7 100644
--- a/web/pgadmin/browser/templates/browser/js/browser.js
+++ b/web/pgadmin/browser/templates/browser/js/browser.js
@@ -593,17 +593,77 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, 
CodeMirror) {
 single: single
   }
 },
+
+// This will hold preference data (Works as a cache object)
+// Here node will be a key and it's preference data will be value
+node_preference_data: {},
+
+// To check if node is visible in browser tree or not
+is_node_visible: function(node_type) {
+  if(_.isUndefined(node_type) || _.isNull(node_type)) {
+return true;
+  }
+
+  // Target actual node instead of collection.
+  // If node is disabled then there is no meaning of
+  // adding collection node menu
+  if(S.startsWith(node_type, "coll-")) {
+node_type = node_type.replace("coll-", "")
+  }
+
+  // Exclude non-applicable nodes
+  var nodes_not_supported = [
+"server-group", "server", "catalog_object_column"
+  ];
+  if(_.indexOf(nodes_not_supported, node_type) >= 0) {
+return true;
+  }
+
+  var perf;
+  // If we have already fetched preference earlier then pick
+  // it from our cache object
+  if (_.has(this.node_preference_data, node_type)) {
+return this.node_preference_data[node_type].value
+  }
+
+  perf = this.get_preference(
+'browser', 'show_node_' + node_type
+  );
+
+  // Save it for future use, kind of caching
+  if(!_.isUndefined(perf) && !_.isNull(perf)) {
+this.node_preference_data[node_type] = perf;
+return perf.value;
+  } else {
+return true;
+  }
+},
+
 // Add menus of module/extension at appropriate menu
 add_menus: function(menus) {
-  var pgMenu = this.menus;
-  var MenuItem = pgAdmin.Browser.MenuItem;
+  var self = this,
+pgMenu = this.menus,
+MenuItem = pgAdmin.Browser.MenuItem;
   _.each(menus, function(m) {
 _.each(m.applies, function(a) {
   /* We do support menu type only from this list */
   if ($.inArray(a, [
-  'context', 'file', 'edit', 'object',
-  'management', 'tools', 'help']) >= 0) {
+'context', 'file', 'edit', 'object',
+'management', 'tools', 'help']) >= 0) {
 var menus;
+
+// If current node is not visible in browser tree
+// then return from here
+if(!self.is_node_visible(m.node)) {
+return;
+} else if(_.has(m, 'module') && !_.isUndefined(m.module)) {
+  // If module to which this menu applies is not visible in
+  // browser tree then also we do not display menu
+  if(!self.is_node_visible(m.module.type)) {
+return;
+  }
+}
+
 pgMenu[a] = pgMenu[a] || {};
 if (_.isString(m.node)) {
   menus = pgMenu[a][m.node] = pgMenu[a][m.node] || {};

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the of issue in table node

2017-05-09 Thread Murtuza Zabuawala
Hi,

Please find updated patch.

Updated logic to convert name only if name is of type int/long/float
(Python2) or of type int/float (Python3) instead of blindly convert it to
string.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Tue, May 9, 2017 at 7:06 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA minor patch to fix the issue in table node where it fails to create
> table when user provides numeric table name eg: 123.
> RM#2284
>
> Issue is when use json.loads() it converts string "123" into integer 123.
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
index e118cab..b6bf7ed 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
@@ -1376,6 +1376,28 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 
 return data
 
+def check_and_convert_name_to_string(self, data):
+"""
+This function will check and covert table to string incase
+it is numeric
+
+Args:
+data: data dict
+
+Returns:
+Updated data dict
+"""
+# For Python2, it can be int, long, float
+if hasattr(str, 'decode'):
+if isinstance(data['name'], (int, long, float)):
+data['name'] = str(data['name'])
+else:
+# For Python3, it can be int, float
+if isinstance(data['name'], (int, float)):
+data['name'] = str(data['name'])
+return data
+
+
 @check_precondition
 def create(self, gid, sid, did, scid):
 """
@@ -1417,6 +1439,7 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 
 # Parse & format columns
 data = self._parse_format_columns(data)
+data = self.check_and_convert_name_to_string(data)
 
 # 'coll_inherits' is Array but it comes as string from browser
 # We will convert it again to list
@@ -1447,8 +1470,10 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 return internal_server_error(errormsg=res)
 
 # PostgreSQL truncates the table name to 63 characters.
-# Have to truncate the name like PostgreSQL to get the proper 
schema id
+# Have to truncate the name like PostgreSQL to get the
+# proper OID
 CONST_MAX_CHAR_COUNT = 63
+
 if len(data['name']) > CONST_MAX_CHAR_COUNT:
 data['name'] = data['name'][0:CONST_MAX_CHAR_COUNT]
 
@@ -2129,9 +2154,12 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 data['relacl'][mode], self.acl
 )
 
-# If name if not present
+# If name is not present in request data
 if 'name' not in data:
 data['name'] = old_data['name']
+
+data = self.check_and_convert_name_to_string(data)
+
 # If name if not present
 if 'schema' not in data:
 data['schema'] = old_data['schema']
@@ -2310,6 +2338,7 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 
 # Parse & format columns
 data = self._parse_format_columns(data)
+data = self.check_and_convert_name_to_string(data)
 
 if 'foreign_key' in data:
 for c in data['foreign_key']:

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] To add handling of BOM character in query tool

2017-05-09 Thread Murtuza Zabuawala
Hi,

Please find patch to fix the issue handling BOM characters in user files
when they load their sql files in query tool.
RM#2369

FYI,
I have attached sample BOM file in redmine for testing.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/misc/file_manager/__init__.py 
b/web/pgadmin/misc/file_manager/__init__.py
index 6e081b1..85d7fb4 100644
--- a/web/pgadmin/misc/file_manager/__init__.py
+++ b/web/pgadmin/misc/file_manager/__init__.py
@@ -17,6 +17,7 @@ import sys
 import time
 from sys import platform as _platform
 import config
+import codecs
 
 import simplejson as json
 from flask import render_template, Response, session, request as req, url_for
@@ -932,6 +933,68 @@ class Filemanager(object):
 else:
 return newPath, newName
 
+@staticmethod
+def check_file_for_bom_and_binary(filename, enc="utf-8"):
+"""
+This utility function will check if file is Binary file
+and/or if it startswith BOM character
+
+Args:
+filename: File
+enc: Encoding for the file
+
+Returns:
+Status(Error?), Error message, Binary file flag,
+BOM character flag and Encoding to open file
+"""
+status = True
+err_msg = None
+is_startswith_bom = False
+
+# check if file type is text or binary
+text_chars = bytearray([7, 8, 9, 10, 12, 13, 27]) \
++ bytearray(range(0x20, 0x7f)) \
++ bytearray(range(0x80, 0x100))
+
+def is_binary_string(bytes_data):
+"""Checks if string data is binary"""
+return bool(
+bytes_data.translate(None, text_chars)
+)
+
+# read the file
+try:
+
+with open(filename, 'rb') as f:
+file_data = f.read(1024)
+
+# Check for BOM in file data
+for encoding, boms in \
+('utf-8-sig', (codecs.BOM_UTF8,)), \
+('utf-16', (codecs.BOM_UTF16_LE, codecs.BOM_UTF16_BE)), \
+('utf-32', (codecs.BOM_UTF32_LE, codecs.BOM_UTF32_BE)):
+if any(file_data.startswith(bom) for bom in boms):
+is_startswith_bom = True
+enc = encoding
+
+# Check if string is binary
+is_binary = is_binary_string(file_data)
+
+except IOError as ex:
+status = False
+# we don't want to expose real path of file
+# so only show error message.
+if ex.strerror == 'Permission denied':
+err_msg = u"Error: {0}".format(ex.strerror)
+else:
+err_msg = u"Error: {0}".format(str(ex))
+
+except Exception as ex:
+status = False
+err_msg = u"Error: {0}".format(str(ex))
+
+return status, err_msg, is_binary, is_startswith_bom, enc
+
 def addfolder(self, path, name):
 """
 Functionality to create new folder
diff --git a/web/pgadmin/tools/sqleditor/__init__.py 
b/web/pgadmin/tools/sqleditor/__init__.py
index 2d1d4e5..6431b3a 100644
--- a/web/pgadmin/tools/sqleditor/__init__.py
+++ b/web/pgadmin/tools/sqleditor/__init__.py
@@ -12,6 +12,7 @@ import simplejson as json
 import os
 import pickle
 import random
+import codecs
 
 from flask import Response, url_for, render_template, session, request
 from flask_babel import gettext
@@ -1220,7 +1221,10 @@ def load_file():
 
 file_path = unquote(file_data['file_name'])
 if hasattr(str, 'decode'):
-file_path = 
unquote(file_data['file_name']).encode('utf-8').decode('utf-8')
+file_path = unquote(
+file_data['file_name']
+).encode('utf-8').decode('utf-8')
+
 # retrieve storage directory path
 storage_manager_path = get_storage_directory()
 if storage_manager_path:
@@ -1230,45 +1234,27 @@ def load_file():
 file_path.lstrip('/').lstrip('\\')
 )
 
-file_data = None
+status, err_msg, is_binary, \
+is_startswith_bom, enc = Filemanager.check_file_for_bom_and_binary(
+file_path
+)
 
-# check if file type is text or binary
-textchars = bytearray(
-[7, 8, 9, 10, 12, 13, 27]) + bytearray(
-range(0x20, 0x7f)) + bytearray(range(0x80, 0x100))
+if not status:
+return internal_server_error(
+errormsg=gettext(err_msg)
+)
 
-is_binary_string = lambda bytes: bool(
-bytes.translate(None, textchars)
-)
+if is_binary:
+return internal_server_error(
+errormsg=gettext("File type not supported")
+)
+
+with codecs.open(file_path, 'r', encoding=enc) as fileObj:
+data = fileObj.read()
 
-# re

[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issues with CSV file download

2017-05-08 Thread Murtuza Zabuawala
Hi,

Please find the patch to fix the issues in CSV file download feature,

1) To handle non-ascii filenames which we set from table name
RM#2314

2) To handle non-ascii query data
RM#2353

3) To dump JSON type columns properly in csv
RM#2360

Please review.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/requirements.txt b/requirements.txt
index 8afeb52..90ed057 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -40,3 +40,4 @@ SQLAlchemy==1.0.14
 sqlparse==0.1.19
 Werkzeug==0.9.6
 WTForms==2.0.2
+backports.csv==1.0.4; python_version <= '2.7'
\ No newline at end of file
diff --git a/web/pgadmin/tools/sqleditor/__init__.py 
b/web/pgadmin/tools/sqleditor/__init__.py
index d114988..2d1d4e5 100644
--- a/web/pgadmin/tools/sqleditor/__init__.py
+++ b/web/pgadmin/tools/sqleditor/__init__.py
@@ -1337,7 +1337,8 @@ def save_file():
 @login_required
 def start_query_download_tool(trans_id):
 sync_conn = None
-status, error_msg, conn, trans_obj, session_obj = 
check_transaction_status(trans_id)
+status, error_msg, conn, trans_obj, \
+session_obj = check_transaction_status(trans_id)
 
 if status and conn is not None \
 and trans_obj is not None and session_obj is not None:
@@ -1361,11 +1362,15 @@ def start_query_download_tool(trans_id):
 del conn.manager.connections[sync_conn.conn_id]
 
 # This returns generator of records.
-status, gen = sync_conn.execute_on_server_as_csv(sql, 
records=2000)
+status, gen = sync_conn.execute_on_server_as_csv(
+sql, records=2000
+)
 
 if not status:
 r = Response('"{0}"'.format(gen), mimetype='text/csv')
-r.headers["Content-Disposition"] = 
"attachment;filename=error.csv"
+r.headers[
+"Content-Disposition"
+] = "attachment;filename=error.csv"
 r.call_on_close(cleanup)
 return r
 
@@ -1377,7 +1382,18 @@ def start_query_download_tool(trans_id):
 import time
 filename = str(int(time.time())) + ".csv"
 
-r.headers["Content-Disposition"] = 
"attachment;filename={0}".format(filename)
+# We will try to encode report file name with latin-1
+# If it fails then we will fallback to default ascii file name
+# werkzeug only supports latin-1 encoding supported values
+try:
+tmp_file_name = filename
+tmp_file_name.encode('latin-1', 'strict')
+except UnicodeEncodeError:
+filename = "download.csv"
+
+r.headers[
+"Content-Disposition"
+] = "attachment;filename={0}".format(filename)
 
 r.call_on_close(cleanup)
 return r
@@ -1388,4 +1404,6 @@ def start_query_download_tool(trans_id):
 r.call_on_close(cleanup)
 return r
 else:
-return internal_server_error(errormsg=gettext("Transaction status 
check failed."))
+return internal_server_error(
+errormsg=gettext("Transaction status check failed.")
+)
diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py 
b/web/pgadmin/utils/driver/psycopg2/__init__.py
index e474817..f2e4b72 100644
--- a/web/pgadmin/utils/driver/psycopg2/__init__.py
+++ b/web/pgadmin/utils/driver/psycopg2/__init__.py
@@ -18,8 +18,8 @@ import os
 import random
 import select
 import sys
-import csv
 
+import simplejson as json
 import psycopg2
 import psycopg2.extras
 from flask import g, current_app, session
@@ -36,11 +36,15 @@ from ..abstract import BaseDriver, BaseConnection
 from .cursor import DictCursor
 
 if sys.version_info < (3,):
+# Python2 in-built csv module do not handle unicode
+# backports.csv module ported from PY3 csv module for unicode handling
+from backports import csv
 from StringIO import StringIO
 psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
 psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY)
 else:
 from io import StringIO
+import csv
 
 _ = gettext
 
@@ -596,7 +600,22 @@ WHERE
 if self.async == 1:
 self._wait(cur.connection)
 
-def execute_on_server_as_csv(self, query, params=None, 
formatted_exception_msg=False, records=2000):
+def execute_on_server_as_csv(self,
+ query, params=None,
+ formatted_exception_msg=False,
+ records=2000):
+"""
+To fetch query result and generate CSV output
+
+Args:
+  

Re: [pgadmin-hackers] Fix for csv download issue [RM2253] [RM2214] [pgadmin4]

2017-05-08 Thread Murtuza Zabuawala
Please hold on on this patch, I am also working on same type of issue.
I think my patch would cover RM#2253 & RM#2360

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, May 8, 2017 at 2:30 PM, Harshal Dhumal <
harshal.dhu...@enterprisedb.com> wrote:

> Hi,
>
> Pls find attached patch for csv download issue when data contains non
> ASCII characters. And also when table name contains non ASCII characters
>
> --
> *Harshal Dhumal*
> *Sr. Software Engineer*
>
> EnterpriseDB India: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>
>


Re: [pgadmin-hackers] [pgAdmin4][PATCH] SlickGrid column resize triggers column select

2017-05-05 Thread Murtuza Zabuawala
Sure.

--Murtuza

On Fri, May 5, 2017 at 8:55 PM, Sarah McAlear <smcal...@pivotal.io> wrote:

> Hi Murtuza and Ashesh!
>
> We are currently working on a number of features related to the query
> results grid. Some of the changes we are working on is that the checkboxes
> are going away. The implementation of this patch will have to change based
> on this. We noticed that 5 Javascript Tests are failing, in part because
> this patch introduces a new bug with the selection of rows.
>
> Replication steps:
> - select a column
> - select a row
>
> Now notice that the checkbox for the column is still checked, even though
> the column's cells are no longer selected.
>
> One of the tests that was failing was covering this behavior.
> Unfortunately there was a typo in the naming of the test (it originally was
> called "ColumnSelector selecting columns when a row is selected deselects
> the row" but should have been called "ColumnSelector selecting columns when
> a row is selected deselects the *column*"), but we have copied it with
> the correct naming below:
>
> describe("when a row is selected", function () {
>   beforeEach(function () {
> var selectedRanges = [new Slick.Range(0, 0, 0, 1)];
> rowSelectionModel.setSelectedRanges(selectedRanges);
>   });
>
>   it("deselects the column", function () {
> container.find('.slick-header-column')[1].click();
> var selectedRanges = rowSelectionModel.getSelectedRanges();
>
> expect(selectedRanges.length).toBe(1);
>
> var column = selectedRanges[0];
>
> expect(column.fromCell).toBe(1);
> expect(column.toCell).toBe(1);
> expect(column.fromRow).toBe(0);
> expect(column.toRow).toBe(9);
>   })
> });
>
>
>
> Since we are finishing up this feature anyway, if this bug can wait
> another week, we can take it into our backlog and address it and submit the
> fix with our next patch.
>
>
> Thanks!
> Matt & Sarah
>
> On Fri, May 5, 2017 at 5:54 AM, Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>> Hi,
>>
>> PFA patch to fix the issue where in SlickGrid column resize also triggers
>> 'onHeaderClick' event and triggers column selection, In this
>> scenario before drag event which column is under mouse gets selected, So to
>> fix the issue we will check if header checkbox is clicked.
>> RM#2348
>>
>> Please review.
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>>
>> --
>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>
>>
>


[pgadmin-hackers] [pgAdmin4][PATCH] SlickGrid column resize triggers column select

2017-05-05 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue where in SlickGrid column resize also triggers
'onHeaderClick' event and triggers column selection, In this
scenario before drag event which column is under mouse gets selected, So to
fix the issue we will check if header checkbox is clicked.
RM#2348

Please review.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/static/js/selection/column_selector.js 
b/web/pgadmin/static/js/selection/column_selector.js
index c89b3fa..5260fc3 100644
--- a/web/pgadmin/static/js/selection/column_selector.js
+++ b/web/pgadmin/static/js/selection/column_selector.js
@@ -6,12 +6,10 @@ define(['jquery', 'sources/selection/range_selection_helper', 
'slickgrid'], func
 
   if (column.selectable !== false) {
 
-if (!clickedCheckbox(event)) {
+if (clickedCheckbox(event)) {
   var $checkbox = $("[data-id='checkbox-" + column.id + "']");
-  toggleCheckbox($checkbox);
+  updateRanges(grid, column.id);
 }
-
-updateRanges(grid, column.id);
   }
 }
   );
@@ -55,14 +53,6 @@ define(['jquery', 
'sources/selection/range_selection_helper', 'slickgrid'], func
   return e.target.type == "checkbox"
 };
 
-var toggleCheckbox = function (checkbox) {
-  if (checkbox.prop("checked")) {
-checkbox.prop("checked", false)
-  } else {
-checkbox.prop("checked", true)
-  }
-};
-
 var getColumnDefinitionsWithCheckboxes = function (columnDefinitions) {
   return _.map(columnDefinitions, function (columnDefinition) {
 if (columnDefinition.selectable !== false) {

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with Backup in other langauge

2017-05-04 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue in Backup module where it was not working if
user changes its preference language other than english.
RM#2354

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/tools/backup/templates/backup/js/backup.js 
b/web/pgadmin/tools/backup/templates/backup/js/backup.js
index 96fe082..4c742f9 100644
--- a/web/pgadmin/tools/backup/templates/backup/js/backup.js
+++ b/web/pgadmin/tools/backup/templates/backup/js/backup.js
@@ -123,10 +123,10 @@ TODO LIST FOR BACKUP:
 width: "100%"
 },
 options: [
-  {label: "Custom", value: "custom"},
-  {label: "Tar", value: "tar"},
-  {label: "Plain", value: "plain"},
-  {label: "Directory", value: "directory"}
+  {label: '{{ _('Custom') }}', value: "custom"},
+  {label: '{{ _('Tar') }}', value: "tar"},
+  {label: '{{ _('Plain') }}', value: "plain"},
+  {label: '{{ _('Directory') }}', value: "directory"}
 ]
   },{
 id: 'ratio', label: '{{ _('Compression ratio') }}',
@@ -447,9 +447,11 @@ TODO LIST FOR BACKUP:
   url: '{{ url_for('help.static', 
filename='backup_dialog.html') }}'
   }
 },{
-text: '{{ _('Backup') }}', key: 27, className: 'btn 
btn-primary fa fa-lg fa-save pg-alertify-button'
+  text: '{{ _('Backup') }}', key: 27, className: 'btn 
btn-primary fa fa-lg fa-save pg-alertify-button',
+  'data-btn-name': 'backup'
 },{
-text: '{{ _('Cancel') }}', key: 27, className: 'btn 
btn-danger fa fa-lg fa-times pg-alertify-button'
+  text: '{{ _('Cancel') }}', key: 27, className: 'btn 
btn-danger fa fa-lg fa-times pg-alertify-button',
+  'data-btn-name': 'cancel'
   }],
   // Set options for dialog
   options: {
@@ -537,7 +539,7 @@ TODO LIST FOR BACKUP:
   return;
 }
 
-if (e.button.text === '{{ _('Backup') }}') {
+if (e.button['data-btn-name'] === "backup") {
 
   if (!d)
 return;
@@ -660,9 +662,11 @@ TODO LIST FOR BACKUP:
   attrs:{name:'dialog_help', type:'button', label: '{{ 
_('Backup') }}',
   url: '{{ url_for('help.static', 
filename='backup_dialog.html') }}'}
 },{
-text: '{{ _('Backup') }}', key: 27, className: 'btn 
btn-primary fa fa-lg fa-save pg-alertify-button'
+  text: '{{ _('Backup') }}', key: 27, className: 'btn 
btn-primary fa fa-lg fa-save pg-alertify-button',
+  'data-btn-name': 'backup'
 },{
-text: '{{ _('Cancel') }}', key: 27, className: 'btn 
btn-danger fa fa-lg fa-times pg-alertify-button'
+  text: '{{ _('Cancel') }}', key: 27, className: 'btn 
btn-danger fa fa-lg fa-times pg-alertify-button',
+  'data-btn-name': 'cancel'
   }],
   // Set options for dialog
   options: {
@@ -748,7 +752,7 @@ TODO LIST FOR BACKUP:
   return;
 }
 
-if (e.button.text === "Backup") {
+if (e.button['data-btn-name'] === "backup") {
   if (!d)
 return;
 
diff --git 
a/web/pgadmin/tools/import_export/templates/import_export/js/import_export.js 
b/web/pgadmin/tools/import_export/templates/import_export/js/import_export.js
index 8859b23..a300531 100644
--- 
a/web/pgadmin/tools/import_export/templates/import_export/js/import_export.js
+++ 
b/web/pgadmin/tools/import_export/templates/import_export/js/import_export.js
@@ -374,10 +374,12 @@ define(
 return {
   buttons:[{
 text: "{{ _('OK') }}", key: 27, disable: true,
+'data-btn-name': 'ok',
 className:
   "btn btn-primary fa fa-lg fa-save pg-alertify-button"
   }, {
 text: "{{ _('Cancel') }}", key: 27,
+'data-btn-name': 'cancel',
 className:
   "btn btn-danger fa fa-lg fa-times pg-alertify-button"
   }],
@@ -393,7 +395,7 @@ define(
 
   // Callback functions when click on the buttons of the Alertify 
dialogs
   callback: function(e) {
-if (e.button.text === "{{ _('OK') }}") {
+if (e.button['data-btn-name'] === "ok") {
 
   var n 

[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with NodeAjaxControl data caching

2017-05-03 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue in NodeAjaxControl caching with cache-node field
and I've also added cache-node field in Trigger & Event trigger node so
that whenever user creates new Trigger Function we get new data from server
in NodeAjaxControl.
RM#2242

Please review.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/templates/event_triggers/js/event_trigger.js
 
b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/templates/event_triggers/js/event_trigger.js
index 3a5a259..d2b6923 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/templates/event_triggers/js/event_trigger.js
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/templates/event_triggers/js/event_trigger.js
@@ -67,7 +67,6 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
   source: undefined,
   language: undefined
 },
-
 // Default values!
 initialize: function(attrs, args) {
   var isNew = (_.size(attrs) === 0);
@@ -79,7 +78,6 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
   }
   pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, 
arguments);
 },
-
 // Define the schema for the event trigger node
 schema: [{
   id: 'name', label: '{{ _('Name') }}', cell: 'string',
@@ -105,7 +103,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
 },{
   id: 'eventfunname', label:'{{ _('Trigger function') }}',
   type: 'text', control: 'node-ajax-options', group: "Definition",
-  url:'fopts'
+  url:'fopts', cache_node: 'trigger_function'
 },{
   id: 'eventname', label:'{{ _('Events') }}',
   type:"radio", group: "Definition", cell: 'string',
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/templates/trigger/js/trigger.js
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/templates/trigger/js/trigger.js
index 42ace44..3f44e7e 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/templates/trigger/js/trigger.js
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/templates/trigger/js/trigger.js
@@ -283,7 +283,8 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
   id: 'tfunction', label:'{{ _('Trigger Function') }}',
   type: 'text', disabled: 'inSchemaWithModelCheck',
   mode: ['create','edit', 'properties'], group: '{{ _('Definition') 
}}',
-  control: 'node-ajax-options', url: 'get_triggerfunctions'
+  control: 'node-ajax-options', url: 'get_triggerfunctions',
+  cache_node: 'trigger_function'
 },{
   id: 'tgargs', label:'{{ _('Arguments') }}', cell: 'string',
   group: '{{ _('Definition') }}',
diff --git a/web/pgadmin/browser/static/js/node.ui.js 
b/web/pgadmin/browser/static/js/node.ui.js
index 695e413..8e9ffce 100644
--- a/web/pgadmin/browser/static/js/node.ui.js
+++ b/web/pgadmin/browser/static/js/node.ui.js
@@ -126,7 +126,7 @@ function($, _, pgAdmin, Backbone, Backform, Alertify, Node) 
{
 cache_level,
 cache_node = this.field.get('cache_node');
 
-cache_node = (cache_node && pgAdmin.Browser.Nodes['cache_node']) || 
node;
+cache_node = (cache_node && pgAdmin.Browser.Nodes[cache_node]) || node;
 
 if (this.field.has('cache_level')) {
   cache_level = this.field.get('cache_level');

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with Node rename

2017-04-28 Thread Murtuza Zabuawala
Hi Ashesh,

PFA updated patch for the issue.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Wed, Apr 26, 2017 at 10:29 AM, Ashesh Vashi <
ashesh.va...@enterprisedb.com> wrote:

>
> On Mon, Apr 24, 2017 at 4:43 PM, Dave Page <dp...@pgadmin.org> wrote:
>
>> Ashesh, can you review/commit this please? Thanks.
>>
>> On Mon, Apr 24, 2017 at 6:17 AM, Murtuza Zabuawala <
>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>
>>> Hi,
>>>
>>> PFA minor patch to fix the issue where node rename is not working
>>> properly after 7dd9efd8
>>> <https://redmine.postgresql.org/projects/pgadmin4/repository/revisions/7dd9efd811c7845d9dc985b66f8d33497f2f4bfa>
>>>  commit
>>> .
>>> RM#2355
>>>
>> We should remove the existing node, and then insert at right place
> instead of refreshing the parent.
> Because - that will select the parent node, and not that node, and also -
> it adds overhead of refreshing the whole parent node.
>
> Please send the patch as per our discussion.
>
> -- Thanks, Ashesh
>
>>
>>> --
>>> Regards,
>>> Murtuza Zabuawala
>>> EnterpriseDB: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>>
>>> --
>>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>>> To make changes to your subscription:
>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>
>>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>
diff --git a/web/pgadmin/browser/templates/browser/js/browser.js 
b/web/pgadmin/browser/templates/browser/js/browser.js
index a663ae8..28ee938 100644
--- a/web/pgadmin/browser/templates/browser/js/browser.js
+++ b/web/pgadmin/browser/templates/browser/js/browser.js
@@ -1084,7 +1084,8 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, 
CodeMirror) {
 }
   }.bind(ctx),
   deleteNode = function() {
-var pI = this.pI,
+var self = this,
+pI = this.pI,
 findParent = function() {
   if (pI.length) {
 pI.pop();
@@ -1110,30 +,111 @@ function(require, $, _, S, Bootstrap, pgAdmin, 
Alertify, CodeMirror) {
   this.i && this.d && this.old._id == this.d._id &&
   this.old._type == this.d._type
 ) {
-  this.t.remove(this.i);
+  var _parent = this.t.parent(this.i) || null;
 
-  // Find the parent
-  findParent();
-  var _parentData = this.d;
-  // Find the grand-parent, or the collection node of parent.
-  findParent();
+  // If there is no parent then just update the node
+  if(_parent.length == 0) {
+updateNode();
+  } else {
+// If there is a parent then we can remove the node
+this.t.remove(this.i, {
+  success: function() {
+// If server group have no children then close it and set 
inode
+// and unload it so it can fetch new data on next expand
+if (self.new._type == 'server'
+&& self.d._type == 'server-group'
+&& _parent && self.t.children(_parent).length == 0) {
+  self.t.setInode(_parent, {
+success: function() {
+  self.t.unload(_parent);
+}
+  });
+}
+}});
 
-  if (this.i) {
-this.load = true;
+// Find the parent
+findParent();
 
-this.success = function() {
-  addItemNode();
-}.bind(this);
-// We can refresh the collection node, but - let's not bother 
about
-// it right now.
-this.notFound = errorOut;
+// If this is Server node
+if (this.new._type == 'server' && this.d._type == 
'server-group') {
+  var parent = null;
+  // We need to search in all parent siblings (eg: server 
groups)
+  parents = this.t.siblings(this.i) || [];
+  parents.push(this.i[0])
+  _.each(parents, function (p) {
+var d = self.t.itemData($(p));
+

Re: [pgadmin-hackers] Issue with SlickGrid

2017-04-27 Thread Murtuza Zabuawala
No, we didn't.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Thu, Apr 27, 2017 at 4:42 PM, Joao Pedro De Almeida Pereira <
jdealmeidapere...@pivotal.io> wrote:

> Hello Murtuza,
> Thanks for the explanation. Based on what you said it looks like a bug in
> the library, have you guys considered sending a PR to it?
>
> Thanks
>
> On Thu, Apr 27, 2017, 2:46 AM Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>> +++
>> Reference: https://www.postgresql.org/message-id/
>> CAKKotZRjqbKAZev81Zk78nikDVXqLKEDV5r%2BsW8Me31Gpzrm_A%40mail.gmail.com
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On Thu, Apr 27, 2017 at 12:09 PM, Murtuza Zabuawala <murtuza.zabuawala@
>> enterprisedb.com> wrote:
>>
>>> Hello Joao,
>>>
>>> Yes, We made some changes in SlickGrid library when we integrated it
>>> into Query tool.
>>>
>>> *Issue:* Last row from the query result set was not displaying
>>> correctly in query tool when we have scrollbar in grid.
>>>
>>> The row hight/width pixel size calculations is done inside SlickGrid
>>> javascript code, Though we tried solve it through CSS but we had no luck,
>>> so we had no other choice but to do it in library it self.
>>>
>>> The changes were,
>>> 1) "getDataLengthIncludingAddNew()" function (slick.grid.js) to add two
>>> new rows instead of one when user add values into row (one row is dummy &
>>> not visible to user so that it displays last row correctly)
>>> 2) Other change was done into "appendRowHtml()" function to calculating
>>> the correct number of rows in SlickGrid result as we have added our own
>>> custom row as mentioned earlier.
>>> 3) Abbreviated long CSS classes as mentioed in README file.
>>>
>>> Apologies we missed to update this change in README.
>>>
>>>
>>> --
>>> Regards,
>>> Murtuza Zabuawala
>>> EnterpriseDB: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>> On Thu, Apr 27, 2017 at 2:23 AM, Joao Pedro De Almeida Pereira <
>>> jdealmeidapere...@pivotal.io> wrote:
>>>
>>>> Hello Hackers,
>>>>
>>>> While doing some changes to the Query Results we found out that there
>>>> was a issue with Slick grid.
>>>>
>>>> The issue that we found was with the CellSelectModel, behaved
>>>> differently when pressing Ctrl and Command(Mac). We created a PR
>>>> <https://github.com/6pac/SlickGrid/pull/100> with the change to
>>>> changes the behavior of the plugin.
>>>>
>>>> When this PR is applied to the SlickGrid library we need to apply it to
>>>> the current version of SlickGrid that we have vendorized.
>>>> According to the libraries.txt file we are in version 2.2.4 of the
>>>> library but a diff between our code and the libraries version 2.2.4 shows
>>>> differences in the code.
>>>>
>>>> Did we do any change to SlickGrid library that is vendorized? Or is
>>>> just the information in libraries.txt that is incorrect?
>>>> Does anyone know any problem if we bump the version of SlickGrid to the
>>>> newer version after the PR is applied?
>>>>
>>>> Thanks
>>>> Joao
>>>>
>>>
>>>
>>


Re: [pgadmin-hackers] Issue with SlickGrid

2017-04-27 Thread Murtuza Zabuawala
+++
Reference:
https://www.postgresql.org/message-id/CAKKotZRjqbKAZev81Zk78nikDVXqLKEDV5r%2BsW8Me31Gpzrm_A%40mail.gmail.com

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Thu, Apr 27, 2017 at 12:09 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hello Joao,
>
> Yes, We made some changes in SlickGrid library when we integrated it into
> Query tool.
>
> *Issue:* Last row from the query result set was not displaying correctly
> in query tool when we have scrollbar in grid.
>
> The row hight/width pixel size calculations is done inside SlickGrid
> javascript code, Though we tried solve it through CSS but we had no luck,
> so we had no other choice but to do it in library it self.
>
> The changes were,
> 1) "getDataLengthIncludingAddNew()" function (slick.grid.js) to add two
> new rows instead of one when user add values into row (one row is dummy &
> not visible to user so that it displays last row correctly)
> 2) Other change was done into "appendRowHtml()" function to calculating
> the correct number of rows in SlickGrid result as we have added our own
> custom row as mentioned earlier.
> 3) Abbreviated long CSS classes as mentioed in README file.
>
> Apologies we missed to update this change in README.
>
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Thu, Apr 27, 2017 at 2:23 AM, Joao Pedro De Almeida Pereira <
> jdealmeidapere...@pivotal.io> wrote:
>
>> Hello Hackers,
>>
>> While doing some changes to the Query Results we found out that there was
>> a issue with Slick grid.
>>
>> The issue that we found was with the CellSelectModel, behaved differently
>> when pressing Ctrl and Command(Mac). We created a PR
>> <https://github.com/6pac/SlickGrid/pull/100> with the change to changes
>> the behavior of the plugin.
>>
>> When this PR is applied to the SlickGrid library we need to apply it to
>> the current version of SlickGrid that we have vendorized.
>> According to the libraries.txt file we are in version 2.2.4 of the
>> library but a diff between our code and the libraries version 2.2.4 shows
>> differences in the code.
>>
>> Did we do any change to SlickGrid library that is vendorized? Or is just
>> the information in libraries.txt that is incorrect?
>> Does anyone know any problem if we bump the version of SlickGrid to the
>> newer version after the PR is applied?
>>
>> Thanks
>> Joao
>>
>
>


Re: [pgadmin-hackers] Issue with SlickGrid

2017-04-27 Thread Murtuza Zabuawala
Hello Joao,

Yes, We made some changes in SlickGrid library when we integrated it into
Query tool.

*Issue:* Last row from the query result set was not displaying correctly in
query tool when we have scrollbar in grid.

The row hight/width pixel size calculations is done inside SlickGrid
javascript code, Though we tried solve it through CSS but we had no luck,
so we had no other choice but to do it in library it self.

The changes were,
1) "getDataLengthIncludingAddNew()" function (slick.grid.js) to add two new
rows instead of one when user add values into row (one row is dummy & not
visible to user so that it displays last row correctly)
2) Other change was done into "appendRowHtml()" function to calculating the
correct number of rows in SlickGrid result as we have added our own custom
row as mentioned earlier.
3) Abbreviated long CSS classes as mentioed in README file.

Apologies we missed to update this change in README.


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Thu, Apr 27, 2017 at 2:23 AM, Joao Pedro De Almeida Pereira <
jdealmeidapere...@pivotal.io> wrote:

> Hello Hackers,
>
> While doing some changes to the Query Results we found out that there was
> a issue with Slick grid.
>
> The issue that we found was with the CellSelectModel, behaved differently
> when pressing Ctrl and Command(Mac). We created a PR
> <https://github.com/6pac/SlickGrid/pull/100> with the change to changes
> the behavior of the plugin.
>
> When this PR is applied to the SlickGrid library we need to apply it to
> the current version of SlickGrid that we have vendorized.
> According to the libraries.txt file we are in version 2.2.4 of the library
> but a diff between our code and the libraries version 2.2.4 shows
> differences in the code.
>
> Did we do any change to SlickGrid library that is vendorized? Or is just
> the information in libraries.txt that is incorrect?
> Does anyone know any problem if we bump the version of SlickGrid to the
> newer version after the PR is applied?
>
> Thanks
> Joao
>


[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue of default parameters ordering in Functions

2017-04-24 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue where we were not correctly providing default
parameters to respective argument(s).
RM#2350

Affected node,
1) Functions
2) Trigger Function
3) Procedures (EPAS)

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
index 2d2b6fb..970f51c 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
@@ -479,6 +479,22 @@ class FunctionView(PGChildNodeView, DataTypeReader):
 'i': 'IN', 'o': 'OUT', 'b': 'INOUT', 'v': 'VARIADIC', 't': 'TABLE'
 }
 
+# We need to put default parameter at proper location in list
+# Total number of default parameters
+default_values_size = len(proargdefaultvals)
+
+# Total number of parameters
+total_parameters_size = len(proargtypes)
+
+# Parameters which do not have default parameters
+par_without_default = total_parameters_size - default_values_size
+
+# only if we have at least one parameter with default value
+if default_values_size > 0 and par_without_default > 0:
+for idx in range(par_without_default):
+# Set null value for parameter non-default parameter
+proargdefaultvals.insert(idx, '')
+
 # The proargtypes doesn't give OUT params, so we need to fetch
 # those from database explicitly, below code is written for this
 # purpose.

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with Node rename

2017-04-23 Thread Murtuza Zabuawala
Hi,

PFA minor patch to fix the issue where node rename is not working properly
after 7dd9efd8
<https://redmine.postgresql.org/projects/pgadmin4/repository/revisions/7dd9efd811c7845d9dc985b66f8d33497f2f4bfa>
commit
.
RM#2355

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/templates/browser/js/browser.js 
b/web/pgadmin/browser/templates/browser/js/browser.js
index a663ae8..aceda92 100644
--- a/web/pgadmin/browser/templates/browser/js/browser.js
+++ b/web/pgadmin/browser/templates/browser/js/browser.js
@@ -1207,10 +1207,8 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, 
CodeMirror) {
 // if label is different then we need to
 // refresh parent so that node get properly
 // placed in tree
-if(this.d.label != this.new.label) {
-  var p = this.t.parent(this.i);
-  pgAdmin.Browser.onRefreshTreeNode(p);
-}
+var is_refresh_required = this.d.label != this.new.label,
+  parent_item = this.t.parent(this.i);
 
 self.t.openPath(self.i);
 self.t.deselect(self.i);
@@ -1218,6 +1216,9 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, 
CodeMirror) {
 // select tree item after few milliseconds
 setTimeout(function() {
   self.t.select(self.i);
+  if (is_refresh_required && parent_item.length) {
+pgAdmin.Browser.onRefreshTreeNode(parent_item);
+  }
 }, 10);
   }
 }

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue of EXPLAIN option with IE

2017-04-21 Thread Murtuza Zabuawala
Hi,

Please find the patch to fix the issue while using ANALYZE option in IE.

*Issue:*
We were using .startsWith() function to check the sql if it is already
starts with explain clause or not, which was added in commit:
c758920890309e50f47a9427039cf735ddf04d37

But IE do not support .startsWith() function.



   - Desktop
   - Mobile

FeatureChromeFirefox (Gecko)EdgeInternet ExplorerOperaSafari
Basic support 41 17
<https://developer.mozilla.org/en-US/Firefox/Releases/17> (17) (Yes)
No support 28 9


But IE do not support .startsWith() function.

I have also changed the code for File Manager module as well for the same
issue.

So affected modules are,
- Query tool
- File Manager

Please review.
RM#2347


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js 
b/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js
index ff2504c..2fb0c52 100755
--- a/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js
+++ b/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js
@@ -14,7 +14,8 @@
 
 // use alertify and underscore js
 var alertify = require("alertify"),
-_ = require("underscore");
+_ = require("underscore"),
+S = require("underscore.string");
 
 /*-
   Define functions used for various operations
@@ -173,7 +174,7 @@ var setUploader = function(path) {
 $('.storage_dialog #uploader .input-path').val(path);
 }
   } else if (!config.options.platform_type === "win32" &&
-(path == '' || !path.startsWith('/'))) {
+(path == '' || !S.startsWith(path, '/'))) {
 path = '/' + path;
 $('.storage_dialog #uploader .input-path').val(path);
   } else {
@@ -1488,7 +1489,7 @@ function InputObject() {
   path = path.replace(/\//g, '\\')
 } else {
   path = path.replace(/\\/g, '/')
-  if (!path.startsWith('/')) {
+  if (!S.startsWith(path, '/')) {
 path = '/' + path;
   }
 }
diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js 
b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
index f9d4f15..2062aa2 100644
--- a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
@@ -3089,8 +3089,10 @@ define(
 
   $("#btn-flash").prop('disabled', true);
 
-  if (explain_prefix != undefined && 
!sql.trim().toUpperCase().startsWith("EXPLAIN"))
+  if (explain_prefix != undefined &&
+!S.startsWith(sql.trim().toUpperCase(), "EXPLAIN")) {
 sql = explain_prefix + ' ' + sql;
+  }
 
   self.query_start_time = new Date();
   self.query = sql;

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with displaying bigint[] values in query tool

2017-04-20 Thread Murtuza Zabuawala
Hi Dave,

Please test the patch with query provided by user,

SELECT
ARRAY[48994717597666517,48968053424532376,76561198004879311,76561198078757065,76561198086825618]::text
as good,
ARRAY[48994717597666520,48968053424532376,76561198004879311,76561198078757065,76561198086825618]
as bad

I was doing regression with some large arbitrary numbers due to which it
was converting it to numeric[] and numeric[] is already handled in our code.


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Thu, Apr 20, 2017 at 7:18 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> That is strange.
>
> I tested on PG9.6 and it was working properly, What is the your PG
> version?
>
>
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Thu, Apr 20, 2017 at 7:06 PM, Dave Page <dp...@pgadmin.org> wrote:
>
>>
>>
>> On Fri, Apr 14, 2017 at 2:28 PM, Murtuza Zabuawala <
>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>
>>> Hi,
>>>>
>>>> PFA minor patch to fix the the issue with bigint[] array values as JS
>>>> truncates long numbers from array object.
>>>> RM#2272
>>>>
>>>
>> Hi
>>
>> As far as I can see, this doesn't work as expected. The "bad" column is
>> interpreted as numeric[] on my machine, which I assume needs to be added to
>> the list as well?
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with displaying bigint[] values in query tool

2017-04-20 Thread Murtuza Zabuawala
That is strange.

I tested on PG9.6 and it was working properly, What is the your PG version?



--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Thu, Apr 20, 2017 at 7:06 PM, Dave Page <dp...@pgadmin.org> wrote:

>
>
> On Fri, Apr 14, 2017 at 2:28 PM, Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>> Hi,
>>>
>>> PFA minor patch to fix the the issue with bigint[] array values as JS
>>> truncates long numbers from array object.
>>> RM#2272
>>>
>>
> Hi
>
> As far as I can see, this doesn't work as expected. The "bad" column is
> interpreted as numeric[] on my machine, which I assume needs to be added to
> the list as well?
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with displaying bigint[] values in query tool

2017-04-14 Thread Murtuza Zabuawala
>
> Hi,
>
> PFA minor patch to fix the the issue with bigint[] array values as JS
> truncates long numbers from array object.
> RM#2272
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py 
b/web/pgadmin/utils/driver/psycopg2/__init__.py
index 76a1cef..e474817 100644
--- a/web/pgadmin/utils/driver/psycopg2/__init__.py
+++ b/web/pgadmin/utils/driver/psycopg2/__init__.py
@@ -58,8 +58,8 @@ psycopg2.extensions.register_type(
 17, 1186,
 # to cast int4range, int8range, numrange tsrange, tstzrange, 
daterange
 3904,3926, 3906, 3908, 3910, 3912, 3913,
-# date, timestamp, timestamptz, bigint, double precision
-1700, 1082, 1114, 1184, 20, 701
+# date, timestamp, timestamptz, bigint, double precision, bigint[]
+1700, 1082, 1114, 1184, 20, 701, 1016
  ),
 'TYPECAST_TO_STRING', psycopg2.STRING)
 )

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] Table column edit breaks when using column level permissions

2017-04-14 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue in table node where it breaks column edit when
user provides column level permissions.
RM#2335

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/server_groups/servers/static/js/privilege.js 
b/web/pgadmin/browser/server_groups/servers/static/js/privilege.js
index e3da845..6b7efb6 100644
--- a/web/pgadmin/browser/server_groups/servers/static/js/privilege.js
+++ b/web/pgadmin/browser/server_groups/servers/static/js/privilege.js
@@ -140,7 +140,15 @@
   selected = {},
   model = cell.model,
   cid = model.cid,
-  curr_user = model.top.node_info.server.user.name;
+  // We need to check node_info values in parent when object is 
nested.
+  // eg: column level privileges in table dialog
+  // In this case node_info will not be avilable to column node as
+  // it is not loaded yet
+  node_info = (_.has(model.top, 'node_info')
+&& !_.isUndefined(model.top.node_info)) ?
+  model.top.node_info :
+  model.handler.top.node_info,
+  curr_user = node_info.server.user.name;
 
   var idx = 0;
 

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [question]

2017-04-12 Thread Murtuza Zabuawala
 is just to manage servers in groups in browser tree that
the main purpose,  is unique regardless of server-group id
that's why you are getting proper response.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Wed, Apr 12, 2017 at 7:21 PM, Sarah McAlear <smcal...@pivotal.io> wrote:

> Hi Murtuza,
>
> Thanks for your response! There is just one little piece of this URL that
> we can't seem to figure out what it does. The  doesn't
> seem to change the result of the request. Meaning that if we were to input
>
> browser/server/children/1/3
> browser/server/children/684635135/3
> browser/server/children/2/3
>
> we would get the same result every time. So while we thought that this was
> the , it doesn't seem to matter? So we were wondering if
> this  is used any other way? Or could it be removed?
>
> Thank you!
> Sarah
>
> On Wed, Apr 12, 2017 at 9:33 AM, Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>> Hi Sarah,
>>
>> Each number represent mapping of id for the node.
>>
>> For example in your case,
>> /browser//children//
>> /browser/server/children/1/3
>>
>> Here  is the type of object  (eg: server-group, server, database,
>> table etc) and  will be the column 'id' of server
>> table(pgadmin4.db), I guess you have multiple entries of a same server with
>> different name in sqltite database.
>>
>> /browser//children///
>> /browser/database/children/1/1/12641
>>
>> Here  is OID of connected database.
>>
>> We follow this same URL object mapping almost everywhere in pgAdmin4.
>>
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On Wed, Apr 12, 2017 at 3:39 AM, Sarah McAlear <smcal...@pivotal.io>
>> wrote:
>>
>>> Hello Hackers,
>>>
>>> We are working with the tree and are looking into the paths that are
>>> used to get tree data from the Python backend. We noticed that the path has
>>> a component that has to be numeric, but it appears that what this number
>>> is, is irrelevant. Here's an example:
>>>
>>> /browser/server/children/1/3
>>>
>>> So in this case, the '1' seems to be required and appears to represent
>>> the server-group, but we're not sure. It appears that the response is the
>>> same no matter what number is passed in. Is there any behavior in the
>>> application that depends on that number?
>>>
>>> Thanks,
>>> Sarah & George
>>>
>>
>>
>


Re: [pgadmin-hackers] [question]

2017-04-12 Thread Murtuza Zabuawala
Hi Sarah,

Each number represent mapping of id for the node.

For example in your case,
/browser//children//
/browser/server/children/1/3

Here  is the type of object  (eg: server-group, server, database,
table etc) and  will be the column 'id' of server
table(pgadmin4.db), I guess you have multiple entries of a same server with
different name in sqltite database.

/browser//children///
/browser/database/children/1/1/12641

Here  is OID of connected database.

We follow this same URL object mapping almost everywhere in pgAdmin4.


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Wed, Apr 12, 2017 at 3:39 AM, Sarah McAlear <smcal...@pivotal.io> wrote:

> Hello Hackers,
>
> We are working with the tree and are looking into the paths that are used
> to get tree data from the Python backend. We noticed that the path has a
> component that has to be numeric, but it appears that what this number is,
> is irrelevant. Here's an example:
>
> /browser/server/children/1/3
>
> So in this case, the '1' seems to be required and appears to represent the
> server-group, but we're not sure. It appears that the response is the same
> no matter what number is passed in. Is there any behavior in the
> application that depends on that number?
>
> Thanks,
> Sarah & George
>


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in browser tree

2017-04-12 Thread Murtuza Zabuawala
Hi Dave,

Apologies for previous patch, please find updated patch.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Wed, Apr 12, 2017 at 5:52 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Please disregard previous patch.
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Wed, Apr 12, 2017 at 5:50 PM, Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>> Hi Dave,
>>
>> PFA rebased patch.
>>
>> Thanks,
>> Murtuza
>>
>> On Wed, Apr 12, 2017 at 5:45 PM, Dave Page <dp...@pgadmin.org> wrote:
>>
>>> Can you rebase this please?
>>>
>>> On Tue, Apr 11, 2017 at 2:04 PM, Murtuza Zabuawala
>>> <murtuza.zabuaw...@enterprisedb.com> wrote:
>>> > Hi,
>>> >
>>> > PFA minor patch to fix the issue where we were not updating inode
>>> > information on refresh.
>>> > RM#2336
>>> >
>>> > --
>>> > Regards,
>>> > Murtuza Zabuawala
>>> > EnterpriseDB: http://www.enterprisedb.com
>>> > The Enterprise PostgreSQL Company
>>> >
>>> >
>>> > --
>>> > Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>>> > To make changes to your subscription:
>>> > http://www.postgresql.org/mailpref/pgadmin-hackers
>>> >
>>>
>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>
>>
>
diff --git a/web/pgadmin/browser/templates/browser/js/browser.js 
b/web/pgadmin/browser/templates/browser/js/browser.js
index 7ab96cc..a663ae8 100644
--- a/web/pgadmin/browser/templates/browser/js/browser.js
+++ b/web/pgadmin/browser/templates/browser/js/browser.js
@@ -1492,6 +1492,7 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, 
CodeMirror) {
 ctx.t.setLabel(ctx.i, {label: _d.label});
 ctx.t.addIcon(ctx.i, {icon: _d.icon});
 ctx.t.setId(ctx.i, {id: _d.id});
+ctx.t.setInode(ctx.i, {inode: data.inode});
 
 if (
   _n.can_expand && typeof(_n.can_expand) == 'function'

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in browser tree

2017-04-12 Thread Murtuza Zabuawala
Please disregard previous patch.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Wed, Apr 12, 2017 at 5:50 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi Dave,
>
> PFA rebased patch.
>
> Thanks,
> Murtuza
>
> On Wed, Apr 12, 2017 at 5:45 PM, Dave Page <dp...@pgadmin.org> wrote:
>
>> Can you rebase this please?
>>
>> On Tue, Apr 11, 2017 at 2:04 PM, Murtuza Zabuawala
>> <murtuza.zabuaw...@enterprisedb.com> wrote:
>> > Hi,
>> >
>> > PFA minor patch to fix the issue where we were not updating inode
>> > information on refresh.
>> > RM#2336
>> >
>> > --
>> > Regards,
>> > Murtuza Zabuawala
>> > EnterpriseDB: http://www.enterprisedb.com
>> > The Enterprise PostgreSQL Company
>> >
>> >
>> > --
>> > Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>> > To make changes to your subscription:
>> > http://www.postgresql.org/mailpref/pgadmin-hackers
>> >
>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in browser tree

2017-04-12 Thread Murtuza Zabuawala
Hi Dave,

PFA rebased patch.

Thanks,
Murtuza

On Wed, Apr 12, 2017 at 5:45 PM, Dave Page <dp...@pgadmin.org> wrote:

> Can you rebase this please?
>
> On Tue, Apr 11, 2017 at 2:04 PM, Murtuza Zabuawala
> <murtuza.zabuaw...@enterprisedb.com> wrote:
> > Hi,
> >
> > PFA minor patch to fix the issue where we were not updating inode
> > information on refresh.
> > RM#2336
> >
> > --
> > Regards,
> > Murtuza Zabuawala
> > EnterpriseDB: http://www.enterprisedb.com
> > The Enterprise PostgreSQL Company
> >
> >
> > --
> > Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgadmin-hackers
> >
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
diff --git a/web/pgadmin/browser/templates/browser/js/browser.js 
b/web/pgadmin/browser/templates/browser/js/browser.js
index 7ab96cc..9fbd92c 100644
--- a/web/pgadmin/browser/templates/browser/js/browser.js
+++ b/web/pgadmin/browser/templates/browser/js/browser.js
@@ -1203,6 +1203,7 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, 
CodeMirror) {
 this.t.setLabel(ctx.i, {label: this.new.label});
 this.t.addIcon(ctx.i, {icon: this.new.icon});
 this.t.setId(ctx.id, {id: this.new.id});
+ctx.t.setInode(ctx.i, {inode: data.inode});
 
 // if label is different then we need to
 // refresh parent so that node get properly

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in browser tree

2017-04-11 Thread Murtuza Zabuawala
Hi,

PFA minor patch to fix the issue where we were not updating inode
information on refresh.
RM#2336

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/templates/browser/js/browser.js 
b/web/pgadmin/browser/templates/browser/js/browser.js
index 941c77e..c823199 100644
--- a/web/pgadmin/browser/templates/browser/js/browser.js
+++ b/web/pgadmin/browser/templates/browser/js/browser.js
@@ -1473,6 +1473,7 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, 
CodeMirror) {
 ctx.t.setLabel(ctx.i, {label: _d.label});
 ctx.t.addIcon(ctx.i, {icon: _d.icon});
 ctx.t.setId(ctx.i, {id: _d.id});
+ctx.t.setInode(ctx.i, {inode: data.inode});
 
 if (
   _n.can_expand && typeof(_n.can_expand) == 'function'

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in browser tree

2017-04-10 Thread Murtuza Zabuawala
Sure, https://redmine.postgresql.org/issues/2331

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, Apr 10, 2017 at 6:43 PM, Dave Page <dp...@pgadmin.org> wrote:

> Can you create an RM case for this please?
>
> Thanks.
>
> On Mon, Apr 10, 2017 at 2:11 PM, Murtuza Zabuawala
> <murtuza.zabuaw...@enterprisedb.com> wrote:
> > Hi,
> >
> > PFA patch to fix the issue in browser tree where it was adding new nodes
> at
> > wrong place due to wrong conditions in the logic.
> >
> > Thanks to Ashesh for helping me.
> >
> >
> > --
> > Regards,
> > Murtuza Zabuawala
> > EnterpriseDB: http://www.enterprisedb.com
> > The Enterprise PostgreSQL Company
> >
> >
> > --
> > Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgadmin-hackers
> >
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in browser tree

2017-04-10 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue in browser tree where it was adding new nodes at
wrong place due to wrong conditions in the logic.

Thanks to Ashesh for helping me.


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/templates/browser/js/browser.js 
b/web/pgadmin/browser/templates/browser/js/browser.js
index 941c77e..7ab96cc 100644
--- a/web/pgadmin/browser/templates/browser/js/browser.js
+++ b/web/pgadmin/browser/templates/browser/js/browser.js
@@ -916,14 +916,14 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, 
CodeMirror) {
 ) != 1
   )
 return true;
-  m = Math.round((e - s) / 2);
-  i = items.eq(e);
+  m = s + Math.round((e - s) / 2);
+  i = items.eq(m);
   d = ctx.t.itemData(i);
-  if (
-pgAdmin.natural_sort(
-  d._label, _data._label
-) == 1
-  ) {
+  var res = pgAdmin.natural_sort(d._label, 
_data._label);
+  if (res == 0)
+return true;
+
+  if (res == -1) {
 s = m + 1;
 e--;
   } else {
@@ -1203,8 +1203,18 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, 
CodeMirror) {
 this.t.setLabel(ctx.i, {label: this.new.label});
 this.t.addIcon(ctx.i, {icon: this.new.icon});
 this.t.setId(ctx.id, {id: this.new.id});
-this.t.openPath(this.i);
-this.t.deselect(this.i);
+
+// if label is different then we need to
+// refresh parent so that node get properly
+// placed in tree
+if(this.d.label != this.new.label) {
+  var p = this.t.parent(this.i);
+  pgAdmin.Browser.onRefreshTreeNode(p);
+}
+
+self.t.openPath(self.i);
+self.t.deselect(self.i);
+
 // select tree item after few milliseconds
 setTimeout(function() {
   self.t.select(self.i);
@@ -1271,7 +1281,11 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, 
CodeMirror) {
 while (e >= s) {
   i = items.eq(s);
   d = ctx.t.itemData(i);
-  if (d.label > _new.label)
+  if (
+pgAdmin.natural_sort(
+  d._label, _data._label
+) == 1
+  )
 return true;
   s++;
 }
@@ -1283,25 +1297,31 @@ function(require, $, _, S, Bootstrap, pgAdmin, 
Alertify, CodeMirror) {
 return false;
   },
   binarySearch = function() {
-var d, m;
-// Binary search only outperforms Linear search for n 
> 44.
-// Reference:
-// 
https://en.wikipedia.org/wiki/Binary_search_algorithm#cite_note-30
-//
-// We will try until it's half.
 while (e - s > 22) {
   i = items.eq(s);
   d = ctx.t.itemData(i);
-  if (d.label > _new.label)
+  if (
+pgAdmin.natural_sort(
+  d._label, _data._label
+) != -1
+  )
 return true;
   i = items.eq(e);
   d = ctx.t.itemData(i);
-  if (d.label < _new.label)
+  if (
+pgAdmin.natural_sort(
+  d._label, _data._label
+) != 1
+  )
 return true;
-  m = Math.round((e - s) / 2);
-  i = items.eq(e);
+  m = s + Math.round((e - s) / 2);
+  i = items.eq(m);
   d = ctx.t.itemData(i);
-  if (d.label < _new.label) {
+  var res = pgAdmin.natural_sort(d._label, 
_data._label);
+  if (res == 0)
+return true;
+
+  if (res == -1) {
 

Re: [pgadmin-hackers] [pgAdmin4][PATCH] Fix the issue in browser tree

2017-04-07 Thread Murtuza Zabuawala
Checking.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Fri, Apr 7, 2017 at 2:13 PM, Ashesh Vashi <ashesh.va...@enterprisedb.com>
wrote:

> Murtuza - please fix it asap.
>
> --
>
> Thanks & Regards,
>
> Ashesh Vashi
> EnterpriseDB INDIA: Enterprise PostgreSQL Company
> <http://www.enterprisedb.com>
>
>
> *http://www.linkedin.com/in/asheshvashi*
> <http://www.linkedin.com/in/asheshvashi>
>
> On Fri, Apr 7, 2017 at 1:59 PM, Dave Page <dp...@pgadmin.org> wrote:
>
>> Hmm, I think this might have broken adding of new nodes in some cases. I
>> just added two new tables (right-clicking the public schema), and had to
>> refresh the tables node before they showed up.
>>
>> On Fri, Apr 7, 2017 at 4:29 AM, Ashesh Vashi <
>> ashesh.va...@enterprisedb.com> wrote:
>>
>>> Thanks - committed!
>>>
>>> --
>>>
>>> Thanks & Regards,
>>>
>>> Ashesh Vashi
>>> EnterpriseDB INDIA: Enterprise PostgreSQL Company
>>> <http://www.enterprisedb.com>
>>>
>>>
>>> *http://www.linkedin.com/in/asheshvashi*
>>> <http://www.linkedin.com/in/asheshvashi>
>>>
>>> On Thu, Apr 6, 2017 at 11:21 AM, Murtuza Zabuawala <
>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>
>>>> Hello,
>>>>
>>>> PFA patch to fix the issue in browser tree when adding new node if
>>>> parent collection node is not loaded.
>>>> *Fixes:* RM#2321
>>>>
>>>> Steps:
>>>> 1) Open pgAdmin4.
>>>> 2) Do not expand server-group node.
>>>> 3) Right click on server-group collection node and add server, now
>>>> click on save button
>>>> (This issue is reproducible on any collection node which is not loaded)
>>>> 4) You will see that only newly added node is displayed in browser tree
>>>>
>>>> --
>>>> Regards,
>>>> Murtuza Zabuawala
>>>> EnterpriseDB: http://www.enterprisedb.com
>>>> The Enterprise PostgreSQL Company
>>>>
>>>>
>>>> --
>>>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>>>> To make changes to your subscription:
>>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>>
>>>>
>>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>


Re: [pgadmin-hackers] i18n GER, suggestions, questions

2017-04-06 Thread Murtuza Zabuawala
On Thu, Apr 6, 2017 at 1:40 PM, Dave Page  wrote:

> On Thu, Apr 6, 2017 at 2:27 AM, Jonas Thelemann
>  wrote:
> > Thanks for committing! :)
> >
> >>> i18n-trim.diff
> >>>
> >>> Removed two linebreaks to improve translation experience.
> >>
> >> Hmm, I've applied that, but expect an ongoing battle between gettext and
> >> PEP8...
> >>
> > Ok, I had to look up what PEP8 is :D
> > So the only problem was that, with those newlines I removed, the
> > translatable strings contained many extremely useless whitespaces
> inserted
> > by the code indentation. I guess a workaround could be to just remove the
> > spaces like I've seen somewhere else already:
> >
> > --
> > --"""abc \n
> > def"""
> > --
> >
> > instead of:
> >
> > --
> > --"""abc def"""
> > --
> >
> > and:
> >
> > --
> > --"""abc \n
> > --def"""
> > --
> >
> > ... where dashes represent whitespaces.
> > But that is just an idea and something somebody with better Python
> knowledge
> > should decide :)
>
> Hmm, yeah. So we really need the messages to be a single string, as
> the splits may not make sense in other languages, so this won't work:
>
> This will return single string only, python won't add any extra whitespace
or new line with this format.

> >>> print("Hello " \
> ...   "How are you")
>
> This will result in extra whitespace:
>
> >>> print("Hello \
> ...How are you")
>
> Whilst this will result in an extra line break:
>
> >>> print("""Hello
> ... How are you""")
>
> I'm beginning to think we have no choice but to ignore PEP8 and not
> allow strings to wrap except where we want them to. I can't find
> anything on Google about other alternatives - EDB guys, any
> suggestions?
>
> >> Can you provide patches for the changes above?
> >
> > Yes, I can do that, but not right away. I currently have some other
> things
> > to complete in the next few weeks, but I'll try to fit that in.
>
> Cool, thanks!
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


[pgadmin-hackers] [pgAdmin4][PATCH] Fix the issue in browser tree

2017-04-05 Thread Murtuza Zabuawala
Hello,

PFA patch to fix the issue in browser tree when adding new node if parent
collection node is not loaded.
*Fixes:* RM#2321

Steps:
1) Open pgAdmin4.
2) Do not expand server-group node.
3) Right click on server-group collection node and add server, now click on
save button
(This issue is reproducible on any collection node which is not loaded)
4) You will see that only newly added node is displayed in browser tree

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/templates/browser/js/browser.js 
b/web/pgadmin/browser/templates/browser/js/browser.js
index 95797c6..b524e24 100644
--- a/web/pgadmin/browser/templates/browser/js/browser.js
+++ b/web/pgadmin/browser/templates/browser/js/browser.js
@@ -965,14 +965,25 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, 
CodeMirror) {
   var i = $(options.items[0]);
   // Open the item path only if its parent is 
loaded
   // or parent type is same as nodes
-  if(_parent_data._type.search(_data._type) > -1 ||
-is_parent_loaded_before) {
+  if(
+is_parent_loaded_before &&
+_parent_data &&  _parent_data._type.search(
+  _data._type
+) > -1
+  ) {
 ctx.t.openPath(i);
 ctx.t.select(i);
   } else {
-// Unload the parent node so that we'll get
-// latest data when we try to expand it
-ctx.t.unload(ctx.i);
+if (_parent_data) {
+  // Unload the parent node so that we'll get
+  // latest data when we try to expand it
+  ctx.t.unload(ctx.i, {
+success: function (item, options) {
+  // Lets try to load it now
+  ctx.t.open(item);
+}
+  });
+}
   }
   if (
 ctx.o && ctx.o.success &&

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] Error running restore/backup etc utilities in WSGI mode

2017-04-03 Thread Murtuza Zabuawala
Hi,

PFA minor patch to fix the issue where user gets error when try to run
backup/restore etc in pgAdmin4 WSGI mode.

Error in Apache log:

[Mon Apr 03 05:22:26.641789 2017] [wsgi:error] [pid 72351:tid
140303938864896] [remote ::1:28430] File
"/opt/web/pgadmin/utils/driver/psycopg2/__init__.py", line 1664, in utility
[Mon Apr 03 05:22:26.641818 2017] [wsgi:error] [pid 72351:tid
140303938864896] [remote ::1:28430] return
self.server_cls.utility(operation, self.sversion)
[Mon Apr 03 05:22:26.641883 2017] [wsgi:error] [pid 72351:tid
140303938864896] [remote ::1:28430] File
"/opt/web/pgadmin/browser/server_groups/servers/types.py", line 120, in
utility
[Mon Apr 03 05:22:26.641921 2017] [wsgi:error] [pid 72351:tid
140303938864896] [remote ::1:28430] bin_path =
self.utility_path.get().replace("$DIR",
os.path.dirname(sys.modules['__main__'].__file__))
[Mon Apr 03 05:22:26.641958 2017] [wsgi:error] [pid 72351:tid
140303938864896] [remote ::1:28430] AttributeError: 'module' object has no
attribute '__file__'


In WSGI, we get sys.modules['__main__'] as built-in object.


'__main__': ,
'pgadmin.browser.server_groups.servers.databases.schemas.tables.rules':
,
--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/server_groups/servers/types.py 
b/web/pgadmin/browser/server_groups/servers/types.py
index fa7154b..24cb0b3 100644
--- a/web/pgadmin/browser/server_groups/servers/types.py
+++ b/web/pgadmin/browser/server_groups/servers/types.py
@@ -112,8 +112,9 @@ class ServerType(object):
 operation
 ))
 )
-
-bin_path = self.utility_path.get().replace("$DIR", 
os.path.dirname(sys.modules['__main__'].__file__))
+bin_path = self.utility_path.get()
+if "$DIR" in bin_path:
+bin_path = bin_path.replace("$DIR", 
os.path.dirname(sys.modules['__main__'].__file__))
 
 return os.path.abspath(os.path.join(
 bin_path,

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers][patch] Move to Alembic migration system

2017-03-31 Thread Murtuza Zabuawala
Hi,

PFA minor add-on patch for README.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Fri, Mar 31, 2017 at 8:04 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi Ashesh,
>
> Patch looks good to me.
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Fri, Mar 31, 2017 at 1:10 PM, Ashesh Vashi <
> ashesh.va...@enterprisedb.com> wrote:
>
>> Hi Joao & Sarah,
>>
>> I have asked Murtuza to review the patch today.
>> He will update me by EOD.
>>
>> If all goes well, I will commit the patch.
>>
>> --
>>
>> Thanks & Regards,
>>
>> Ashesh Vashi
>> EnterpriseDB INDIA: Enterprise PostgreSQL Company
>> <http://www.enterprisedb.com>
>>
>>
>> *http://www.linkedin.com/in/asheshvashi*
>> <http://www.linkedin.com/in/asheshvashi>
>>
>> On Thu, Mar 30, 2017 at 8:36 PM, Joao Pedro De Almeida Pereira <
>> jdealmeidapere...@pivotal.io> wrote:
>>
>>> Hello Dave and Ashesh,
>>>
>>> Do you still need us to provide more information about this patch or is
>>> it ready to be merged?
>>>
>>> Thanks
>>> Joao
>>>
>>> On Thu, Mar 23, 2017 at 12:00 PM, Joao Pedro De Almeida Pereira <
>>> jdealmeidapere...@pivotal.io> wrote:
>>>
>>>> Hello Hackers,
>>>>
>>>> We found out a issue using Python 3 related to importing modules that
>>>> we corrected in the patch that is now attached.
>>>>
>>>> Also we would like to know the status of this.
>>>>
>>>> Thanks
>>>> Joao & Sarah
>>>>
>>>> On Fri, Mar 17, 2017 at 10:32 AM, Sarah McAlear <smcal...@pivotal.io>
>>>> wrote:
>>>>
>>>>> Hi!
>>>>>
>>>>> We realized that this change was causing the tests to fail because the
>>>>> folder for the sqlite databases was not being created. We also updated the
>>>>> files to contain the missing headers.
>>>>>
>>>>> Thanks!
>>>>> Joao & Sarah
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Mar 16, 2017 at 9:31 AM, Dave Page <dp...@pgadmin.org> wrote:
>>>>>
>>>>>> Ashesh, can you review/commit this please? One thing I notice on a
>>>>>> quick look through is that the file headers are missing everywhere.
>>>>>> They should be present in all source files, except where they would
>>>>>> bloat the data transfer from client to server.
>>>>>>
>>>>>> On Wed, Mar 15, 2017 at 8:09 PM, Sarah McAlear <smcal...@pivotal.io>
>>>>>> wrote:
>>>>>> > Hi Hackers!
>>>>>> >
>>>>>> > It looks like our previous patch messed up some logging. Please use
>>>>>> this one
>>>>>> > instead.
>>>>>> >
>>>>>> > Thanks,
>>>>>> > Joao & Sarah
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> > On Wed, Mar 15, 2017 at 2:46 PM, Sarah McAlear <smcal...@pivotal.io>
>>>>>> wrote:
>>>>>> >>
>>>>>> >> Hi Hackers!
>>>>>> >>
>>>>>> >> Here's a patch to move to current db migration system to use
>>>>>> Alembic.
>>>>>> >> Instructions to create new migrations are in the README.
>>>>>> >>
>>>>>> >> Thanks!
>>>>>> >> Joao & Sarah
>>>>>> >>
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> > --
>>>>>> > Sent via pgadmin-hackers mailing list (
>>>>>> pgadmin-hackers@postgresql.org)
>>>>>> > To make changes to your subscription:
>>>>>> > http://www.postgresql.org/mailpref/pgadmin-hackers
>>>>>> >
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Dave Page
>>>>>> Blog: http://pgsnake.blogspot.com
>>>>>> Twitter: @pgsnake
>>>>>>
>>>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>>>> The Enterprise PostgreSQL Company
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
diff --git a/README b/README
index 973fdec..f39cb37 100644
--- a/README
+++ b/README
@@ -196,6 +196,9 @@ Add any changes to the 'upgrade' function.
 
 There is no need to increment the SETTINGS_SCHEMA_VERSION.
 
+For other positional arguments refer help,
+(pgadmin4) $ FLASK_APP=pgAdmin4.py flask db --help
+
 Configuring the Runtime
 ---
 

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers][patch] Move to Alembic migration system

2017-03-31 Thread Murtuza Zabuawala
Hi Ashesh,

Patch looks good to me.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Fri, Mar 31, 2017 at 1:10 PM, Ashesh Vashi <ashesh.va...@enterprisedb.com
> wrote:

> Hi Joao & Sarah,
>
> I have asked Murtuza to review the patch today.
> He will update me by EOD.
>
> If all goes well, I will commit the patch.
>
> --
>
> Thanks & Regards,
>
> Ashesh Vashi
> EnterpriseDB INDIA: Enterprise PostgreSQL Company
> <http://www.enterprisedb.com>
>
>
> *http://www.linkedin.com/in/asheshvashi*
> <http://www.linkedin.com/in/asheshvashi>
>
> On Thu, Mar 30, 2017 at 8:36 PM, Joao Pedro De Almeida Pereira <
> jdealmeidapere...@pivotal.io> wrote:
>
>> Hello Dave and Ashesh,
>>
>> Do you still need us to provide more information about this patch or is
>> it ready to be merged?
>>
>> Thanks
>> Joao
>>
>> On Thu, Mar 23, 2017 at 12:00 PM, Joao Pedro De Almeida Pereira <
>> jdealmeidapere...@pivotal.io> wrote:
>>
>>> Hello Hackers,
>>>
>>> We found out a issue using Python 3 related to importing modules that we
>>> corrected in the patch that is now attached.
>>>
>>> Also we would like to know the status of this.
>>>
>>> Thanks
>>> Joao & Sarah
>>>
>>> On Fri, Mar 17, 2017 at 10:32 AM, Sarah McAlear <smcal...@pivotal.io>
>>> wrote:
>>>
>>>> Hi!
>>>>
>>>> We realized that this change was causing the tests to fail because the
>>>> folder for the sqlite databases was not being created. We also updated the
>>>> files to contain the missing headers.
>>>>
>>>> Thanks!
>>>> Joao & Sarah
>>>>
>>>>
>>>>
>>>> On Thu, Mar 16, 2017 at 9:31 AM, Dave Page <dp...@pgadmin.org> wrote:
>>>>
>>>>> Ashesh, can you review/commit this please? One thing I notice on a
>>>>> quick look through is that the file headers are missing everywhere.
>>>>> They should be present in all source files, except where they would
>>>>> bloat the data transfer from client to server.
>>>>>
>>>>> On Wed, Mar 15, 2017 at 8:09 PM, Sarah McAlear <smcal...@pivotal.io>
>>>>> wrote:
>>>>> > Hi Hackers!
>>>>> >
>>>>> > It looks like our previous patch messed up some logging. Please use
>>>>> this one
>>>>> > instead.
>>>>> >
>>>>> > Thanks,
>>>>> > Joao & Sarah
>>>>> >
>>>>> >
>>>>> >
>>>>> > On Wed, Mar 15, 2017 at 2:46 PM, Sarah McAlear <smcal...@pivotal.io>
>>>>> wrote:
>>>>> >>
>>>>> >> Hi Hackers!
>>>>> >>
>>>>> >> Here's a patch to move to current db migration system to use
>>>>> Alembic.
>>>>> >> Instructions to create new migrations are in the README.
>>>>> >>
>>>>> >> Thanks!
>>>>> >> Joao & Sarah
>>>>> >>
>>>>> >
>>>>> >
>>>>> >
>>>>> > --
>>>>> > Sent via pgadmin-hackers mailing list (pgadmin-hack...@postgresql.or
>>>>> g)
>>>>> > To make changes to your subscription:
>>>>> > http://www.postgresql.org/mailpref/pgadmin-hackers
>>>>> >
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Dave Page
>>>>> Blog: http://pgsnake.blogspot.com
>>>>> Twitter: @pgsnake
>>>>>
>>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>>> The Enterprise PostgreSQL Company
>>>>>
>>>>
>>>>
>>>
>>
>


[pgadmin-hackers] [pgAdmin4][PATCH] To fix dialog help in browser tab/window

2017-03-30 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue where "Dialog Help" was broken in case where
query tool/Debugger opens in new browser tab.
RM#2310

*Note:*
Object help might not work as well when used in new browser tab but for
that we might need to find a way to pass node & server information in new
browser tab so that we can able to create proper url for given/selected
object which requires some time and fortunately we not using Object help
button in query tool or debugger at present, meanwhile this patch will fix
the issue for dialog help button only.
diff --git a/web/pgadmin/browser/templates/browser/js/browser.js 
b/web/pgadmin/browser/templates/browser/js/browser.js
index 7df56d0..b195e84 100644
--- a/web/pgadmin/browser/templates/browser/js/browser.js
+++ b/web/pgadmin/browser/templates/browser/js/browser.js
@@ -706,19 +706,26 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, 
CodeMirror) {
 iframe.openURL(fullUrl);
   } else if(type == "dialog_help") {
 // See if we can find an existing panel, if not, create one
-pnlDialogHelp = this.docker.findPanels('pnl_online_help')[0];
-
-if (pnlDialogHelp == null) {
-  pnlProperties = this.docker.findPanels('properties')[0];
-  this.docker.addPanel('pnl_online_help', wcDocker.DOCK.STACKED, 
pnlProperties);
+if(this.docker) {
   pnlDialogHelp = this.docker.findPanels('pnl_online_help')[0];
-}
 
-// Update the panel
-iframe = $(pnlDialogHelp).data('embeddedFrame');
+  if (pnlDialogHelp == null) {
+pnlProperties = this.docker.findPanels('properties')[0];
+this.docker.addPanel('pnl_online_help', wcDocker.DOCK.STACKED, 
pnlProperties);
+pnlDialogHelp = this.docker.findPanels('pnl_online_help')[0];
+  }
+
+  // Update the panel
+  iframe = $(pnlDialogHelp).data('embeddedFrame');
 
-pnlDialogHelp.focus();
-iframe.openURL(url);
+  pnlDialogHelp.focus();
+  iframe.openURL(url);
+} else {
+  // We have added new functionality of opening Query tool & debugger 
in new
+  // browser tab, In that case we wil not have docker object available
+  // so we will open dialog help in new browser tab
+  window.open(url, '_blank');
+}
   }
 },
 

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][Patch] To fix the issues in SQL editor module & Functions node

2017-03-17 Thread Murtuza Zabuawala
Hi,

PFA patches to fix the issues in SQL Editor & Function nodes.

1) Add handling of DATERANGE[] type
RM#2258

2) "By Selection" and "Exclude selection" filter options was broken due to
2d array data conversion.
RM#2265

3) Barces are missing on function parameters on SQL tab.
RM#2246

Please review.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
index d2a787f..96dcec5 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
@@ -996,16 +996,16 @@ class FunctionView(PGChildNodeView, DataTypeReader):
func_def=name_with_default_args,
query_for="sql_panel")
 
-sql_header = u"""-- {0}: {1}{2}
+sql_header = u"""-- {0}: {1}({2})
 
--- DROP {0} {1}{2};
+-- DROP {0} {1}({2});
 
 """.format(object_type.upper(),
self.qtIdent(
self.conn,
resp_data['pronamespace'],
resp_data['proname']),
-   resp_data['proargtypenames'])
+   resp_data['proargtypenames'].lstrip('(').rstrip(')'))
 
 SQL = sql_header + func_def
 SQL = re.sub('\n{2,}', '\n\n', SQL)
diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py 
b/web/pgadmin/utils/driver/psycopg2/__init__.py
index 18be00e..b76209f 100644
--- a/web/pgadmin/utils/driver/psycopg2/__init__.py
+++ b/web/pgadmin/utils/driver/psycopg2/__init__.py
@@ -56,8 +56,8 @@ psycopg2.extensions.register_type(
 (
 # To cast bytea and interval type
 17, 1186,
-# to cast int4range, int8range, numrange tsrange, tstzrange
-3904,3926, 3906, 3908, 3910, 3912,
+# to cast int4range, int8range, numrange tsrange, tstzrange, 
daterange
+3904,3926, 3906, 3908, 3910, 3912, 3913,
 # date, timestamp, timestamptz, bigint, double precision
 1700, 1082, 1114, 1184, 20, 701
  ),
diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js 
b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
index d0ad28e..fe6aaef 100644
--- a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
@@ -2705,7 +2705,7 @@ define(
 return;
 
   // Add column position and it's value to data
-  data[column_info.pos] = _values[column_info.pos] || '';
+  data[column_info.field] = _values[column_info.pos] || '';
 
   self.trigger(
 'pgadmin-sqleditor:loading-icon:show',
@@ -2775,7 +2775,7 @@ define(
 return;
 
   // Add column position and it's value to data
-  data[column_info.pos] = _values[column_info.pos] || '';
+  data[column_info.field] = _values[column_info.pos] || '';
 
   self.trigger(
 'pgadmin-sqleditor:loading-icon:show',

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue of Import/Export in linux runtime

2017-03-08 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue where Import/Export was failing in linux runtime.
RM#2166

*Issue:*
Changes done by Ashesh in pgAdmin4.py file for setting up PYTHONHOME
variable to sys.prefix was applicable only for windows only.

Additionally I have also added exception handling for file provided by user
for Backup/Restore/Import/Export.


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgAdmin4.py b/web/pgAdmin4.py
index c738287..6025514 100644
--- a/web/pgAdmin4.py
+++ b/web/pgAdmin4.py
@@ -100,7 +100,9 @@ if __name__ == '__main__':
 # the process-executor.
 #
 # Setting PYTHONHOME launch them properly.
-os.environ['PYTHONHOME'] = sys.prefix
+from pgadmin.utils import IS_WIN
+if IS_WIN:
+os.environ['PYTHONHOME'] = sys.prefix
 
 try:
 app.run(
diff --git a/web/pgadmin/misc/bgprocess/processes.py 
b/web/pgadmin/misc/bgprocess/processes.py
index 5fc48c7..457e6d3 100644
--- a/web/pgadmin/misc/bgprocess/processes.py
+++ b/web/pgadmin/misc/bgprocess/processes.py
@@ -217,7 +217,7 @@ class BatchProcess(object):
 executor = file_quote(os.path.join(
 os.path.dirname(u(__file__)), u'process_executor.py'
 ))
-paths = sys.path[:]
+paths = os.environ['PATH'].split(os.pathsep)
 interpreter = None
 
 if os.name == 'nt':
diff --git a/web/pgadmin/tools/backup/__init__.py 
b/web/pgadmin/tools/backup/__init__.py
index 099a822..87e011c 100644
--- a/web/pgadmin/tools/backup/__init__.py
+++ b/web/pgadmin/tools/backup/__init__.py
@@ -226,7 +226,10 @@ def create_backup_job(sid):
 else:
 data = json.loads(request.data, encoding='utf-8')
 
-backup_file = filename_with_file_manager_path(data['file'])
+try:
+backup_file = filename_with_file_manager_path(data['file'])
+except Exception as e:
+return bad_request(errormsg=str(e))
 
 # Fetch the server details like hostname, port, roles etc
 server = Server.query.filter_by(
@@ -324,7 +327,10 @@ def create_backup_objects_job(sid):
 else:
 data = json.loads(request.data, encoding='utf-8')
 
-backup_file = filename_with_file_manager_path(data['file'])
+try:
+backup_file = filename_with_file_manager_path(data['file'])
+except Exception as e:
+return bad_request(errormsg=str(e))
 
 # Fetch the server details like hostname, port, roles etc
 server = Server.query.filter_by(
diff --git a/web/pgadmin/tools/import_export/__init__.py 
b/web/pgadmin/tools/import_export/__init__.py
index 76f71e1..e5bd708 100644
--- a/web/pgadmin/tools/import_export/__init__.py
+++ b/web/pgadmin/tools/import_export/__init__.py
@@ -223,7 +223,11 @@ def create_import_export_job(sid):
 storage_dir = get_storage_directory()
 
 if 'filename' in data:
-_file = filename_with_file_manager_path(data['filename'], 
data['is_import'])
+try:
+_file = filename_with_file_manager_path(data['filename'], 
data['is_import'])
+except Exception as e:
+return bad_request(errormsg=str(e))
+
 if not _file:
 return bad_request(errormsg=_('Please specify a valid file'))
 
diff --git a/web/pgadmin/tools/restore/__init__.py 
b/web/pgadmin/tools/restore/__init__.py
index 394902f..393639b 100644
--- a/web/pgadmin/tools/restore/__init__.py
+++ b/web/pgadmin/tools/restore/__init__.py
@@ -179,7 +179,10 @@ def create_restore_job(sid):
 else:
 data = json.loads(request.data, encoding='utf-8')
 
-_file = filename_with_file_manager_path(data['file'])
+try:
+_file = filename_with_file_manager_path(data['file'])
+except Exception as e:
+return bad_request(errormsg=str(e))
 
 if _file is None:
 return make_json_response(

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] Minor condition code improvement

2017-03-08 Thread Murtuza Zabuawala
Hi,

PFA minor patch for condition check improvement.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/tools/datagrid/templates/datagrid/js/datagrid.js 
b/web/pgadmin/tools/datagrid/templates/datagrid/js/datagrid.js
index e5bb9a1..f568fa1 100644
--- a/web/pgadmin/tools/datagrid/templates/datagrid/js/datagrid.js
+++ b/web/pgadmin/tools/datagrid/templates/datagrid/js/datagrid.js
@@ -55,7 +55,7 @@ define(
  * otherwise enabled.
  */
 query_tool_menu_enabled = function(obj) {
-  if(!_.isUndefined(obj) && !_.isNull(obj))
+  if(!_.isUndefined(obj) && !_.isNull(obj)) {
 if(_.indexOf(unsupported_nodes, obj._type) == -1) {
   if (obj._type == 'database' && obj.allowConn)
 return true;
@@ -63,9 +63,12 @@ define(
 return true;
   else
 return false;
+ } else {
+return false;
  }
-  else
+  } else {
 return false;
+  }
 };
 
 // Define the nodes on which the menus to be appear

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [PATCH][pgAdmin4] To fix the issue in server-group deletion

2017-03-03 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue in ServerGroup node, where servers associated to
server group were not deleted when user deletes server-group.
RM#2212

Also fixed the gif file url in file manager(changes included in the patch).

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


RM_2212.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [PATCH][pgAdmin4] To show indeterminate state for [null] value for boolean

2017-03-03 Thread Murtuza Zabuawala
Hi,

PFA minor patch to fix the issue where it was not showing indeterminate
state for [null] value for boolean when we enter value in new row.
RM#2153

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


RM_2153.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][PATCH] SlickGrid result set format efficiency

2017-02-28 Thread Murtuza Zabuawala
Hi Dave,

PFA updated patch for the same.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, Feb 27, 2017 at 8:34 PM, Dave Page <dp...@pgadmin.org> wrote:

> Hi
>
> On Mon, Feb 27, 2017 at 10:25 AM, Murtuza Zabuawala
> <murtuza.zabuaw...@enterprisedb.com> wrote:
> > Hi,
> >
> > PFA patch to reduce the size of query result set  by converting it into
> 2D
> > array result set.
> > RM#2036
> > RM#2038
> >
> > Additionally,
> > 1) I had to change some logic in Debugger module to handle 2D array
> result
> > set from async query (changes included in patch).
>
> - The first test I tried had a typo in the table name:
>
> 2017-02-27 14:44:14,403: SQL pgadmin: Execute (async) for server #1 -
> CONN:7535990 (Query-id: 269320):
> select * from pg_table
> 2017-02-27 14:44:14,405: INFO werkzeug: 127.0.0.1 - - [27/Feb/2017
> 14:44:14] "POST /sqleditor/query_tool/start/2431806 HTTP/1.1" 200 -
> 2017-02-27 14:44:14,436: SQL pgadmin: Polling result for (Query-id: 269320)
> 2017-02-27 14:44:14,443: INFO werkzeug: 127.0.0.1 - - [27/Feb/2017
> 14:44:14] "GET /sqleditor/poll/2431806 HTTP/1.1" 500 -
> Traceback (most recent call last):
>   File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 2000, in __call__
> return self.wsgi_app(environ, start_response)
>   File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1991, in wsgi_app
> response = self.make_response(self.handle_exception(e))
>   File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1567, in handle_exception
> reraise(exc_type, exc_value, tb)
>   File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1988, in wsgi_app
> response = self.full_dispatch_request()
>   File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1641, in full_dispatch_request
> rv = self.handle_user_exception(e)
>   File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1544, in handle_user_exception
> reraise(exc_type, exc_value, tb)
>   File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1639, in full_dispatch_request
> rv = self.dispatch_request()
>   File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask/app.py",
> line 1625, in dispatch_request
> return self.view_functions[rule.endpoint](**req.view_args)
>   File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/flask_login.py",
> line 792, in decorated_view
> return func(*args, **kwargs)
>   File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/sqleditor/__
> init__.py",
> line 476, in poll
> status, result = conn.poll()
> ValueError: too many values to unpack
>
> Fixed

> - If I copy rows from the grid, for some reason 'true' is quoted,
> whilst false is not:
>
> 'information_schema','sql_implementation_info','
> postgres',,false,false,false
> 'information_schema','sql_parts','postgres',,false,false,false
> 'information_schema','sql_features','postgres',,false,false,false
> 'pem','server_version','postgres',,'true',false,'true'
>
> Fixed

> - I get the same error as above, if I try to run "create table foo(id
> serial)"
>
> Fixed

> - "columns_info" should be "column_info", as "def
> get_columns_info(self)" should be "def get_column_info(self)"
>
> Fixed

> > 2) While testing I also found one issue where we are unable to right
> click
> > on browser tree if we set Debug = False in config_local.py file, this was
> > because of typo as path for css was changed to '/js/' to '/vendor/'.
> > (separate patch RM#2213)
>
> Thanks, applied (along with the change to the About dialogue).
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


RM_2036_v1.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][PATCH] SlickGrid result set format efficiency

2017-02-27 Thread Murtuza Zabuawala
++ Forgot to add one more :-)

Also fix button inconstancy issue with pgAdmin4 About dialog (changes
included in RM_2036.patch file).

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, Feb 27, 2017 at 3:55 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA patch to reduce the size of query result set  by converting it into 2D
> array result set.
> RM#2036
> RM#2038
>
> Additionally,
> 1) I had to change some logic in Debugger module to handle 2D array result
> set from async query (changes included in patch).
>
> 2) While testing I also found one issue where we are unable to right click
> on browser tree if we set Debug = False in config_local.py file, this was
> because of typo as path for css was changed to '/js/' to '/vendor/'.
> (separate patch RM#2213)
>
> Please review.
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


[pgadmin-hackers] [pgAdmin4][PATCH] SlickGrid result set format efficiency

2017-02-27 Thread Murtuza Zabuawala
Hi,

PFA patch to reduce the size of query result set  by converting it into 2D
array result set.
RM#2036
RM#2038

Additionally,
1) I had to change some logic in Debugger module to handle 2D array result
set from async query (changes included in patch).

2) While testing I also found one issue where we are unable to right click
on browser tree if we set Debug = False in config_local.py file, this was
because of typo as path for css was changed to '/js/' to '/vendor/'.
(separate patch RM#2213)

Please review.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/__init__.py b/web/pgadmin/browser/__init__.py
index d14bd4f0..18c7fbda 100644
--- a/web/pgadmin/browser/__init__.py
+++ b/web/pgadmin/browser/__init__.py
@@ -42,7 +42,7 @@ class BrowserModule(PgAdminModule):
 ('static', 'vendor/codemirror/codemirror.css'),
 ('static', 'vendor/codemirror/addon/dialog/dialog.css'),
 ('static', 'vendor/jQuery-contextMenu/jquery.contextMenu.css' if 
current_app.debug
-else 'css/jQuery-contextMenu/jquery.contextMenu.min.css'),
+else 'vendor/jQuery-contextMenu/jquery.contextMenu.min.css'),
 ('static', 'vendor/wcDocker/wcDocker.css' if current_app.debug
 else 'vendor/wcDocker/wcDocker.min.css'),
 ('browser.static', 'css/browser.css'),


RM_2036.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] pgAdmin4 mirror issues [pgAdmin4]

2017-02-23 Thread Murtuza Zabuawala
RM created,

https://redmine.postgresql.org/issues/2200
https://redmine.postgresql.org/issues/2201
https://redmine.postgresql.org/issues/2202


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Thu, Feb 23, 2017 at 4:12 PM, Dave Page <dp...@pgadmin.org> wrote:

> Hi
>
> Can you create RMs for each one please? We need to track fixes.
>
> Thanks.
>
> On Thu, Feb 23, 2017 at 10:34 AM, Harshal Dhumal
> <harshal.dhu...@enterprisedb.com> wrote:
> > Hi,
> >
> > While fixing and testing Unicode issues throughout pgadmin4 nodes I found
> > bellow issues (other than Unicode) which was preventing me further
> testing.
> > So these need to checked in first before we can apply Unicode related
> issue
> > patch.
> >
> > 1. event_trigger_sql.patch: returns correct value of 'eventfunname' when
> > schema of of trgger function is other than public.
> >
> > 2.check_constraint_sql.patch: Wrong sql was generated for check
> constraint
> > when we rename table name and check name at the same time from table edit
> > mode.
> >
> > 3.dependents_sql.patch: dependents sql was failing because of following
> > issue.
> > On non utf-8 encoding database bellow type casting queries fail as it
> > treats 0 (zero) as null instead of integer.
> >
> > SELECT 0::text;
> >
> > SELECT CAST(0 AS text);
> >
> > db error:
> > ERROR:  null character not permitted
> >
> > ** Error **
> >
> > ERROR: null character not permitted
> > SQL state: 54000
> >
> >
> >
> >
> > --
> > Harshal Dhumal
> > Software Engineer
> >
> > EnterpriseDB India: http://www.enterprisedb.com
> > The Enterprise PostgreSQL Company
> >
> >
> > --
> > Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgadmin-hackers
> >
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>


[pgadmin-hackers] [pgAdmin4][PATCH] Columns with no size display incorrectly in the Query Tool

2017-02-21 Thread Murtuza Zabuawala
Hi,

Please find minor patch to fix the issue where we were displaying incorrect
size if columns has no size defined in the Query Tool.
RM#2151


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


RM_2151.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] [pgAdmin4][PATCH] Handling of non-ascii with Python2.7

2017-02-12 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue where user enters non ascii username/password
(invalid credentials) while creating new server and it throws error.
RM#2160

This patch also includes some other minor fixes for the same issue in some
other files where we are passing error to gettext() if it includes non
ascii words then it breaks in Python2.7.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py
index 86a02e6..b9750e8 100644
--- a/web/pgadmin/__init__.py
+++ b/web/pgadmin/__init__.py
@@ -385,9 +385,15 @@ def create_app(app_name=config.APP_NAME):
 svr_superuser = registry.get(section, 'Superuser')
 svr_port = registry.getint(section, 'Port')
 svr_discovery_id = section
-svr_comment = gettext("Auto-detected %s installation with 
the data directory at %s" % (
-registry.get(section, 'Description'),
-registry.get(section, 'DataDirectory')))
+description = registry.get(section, 'Description')
+data_directory = registry.get(section, 'DataDirectory')
+if hasattr(str, 'decode'):
+description = description.decode('utf-8')
+data_directory = data_directory.decode('utf-8')
+svr_comment = gettext(u"Auto-detected %s installation with 
the data directory at %s" % (
+description,
+data_directory
+))
 add_server(user_id, servergroup_id, svr_name, 
svr_superuser, svr_port, svr_discovery_id, svr_comment)
 
 except:
diff --git a/web/pgadmin/about/__init__.py b/web/pgadmin/about/__init__.py
index 3806346..dc6d893 100644
--- a/web/pgadmin/about/__init__.py
+++ b/web/pgadmin/about/__init__.py
@@ -23,6 +23,9 @@ import config
 
 class AboutModule(PgAdminModule):
 def get_own_menuitems(self):
+appname = config.APP_NAME
+if hasattr(str, 'decode'):
+appname = appname.decode('utf-8')
 return {
 'help_items': [
 MenuItem(name='mnu_about',
@@ -30,8 +33,10 @@ class AboutModule(PgAdminModule):
  module="pgAdmin.About",
  callback='about_show',
  icon='fa fa-info-circle',
- label=gettext('About %(appname)s',
-   appname=config.APP_NAME))
+ label=gettext(u'About %(appname)s',
+   appname=appname
+   )
+ )
 ]
 }
 
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py 
b/web/pgadmin/browser/server_groups/servers/__init__.py
index 3913b95..ad5607c 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -584,14 +584,15 @@ class ServerNode(PGChildNodeView):
 password=password,
 server_types=ServerType.types()
 )
-
+if hasattr(str, 'decode'):
+errmsg = errmsg.decode('utf-8')
 if not status:
 db.session.delete(server)
 db.session.commit()
 return make_json_response(
 status=401,
 success=0,
-errormsg=gettext("Unable to connect to server:\n\n%s" 
% errmsg)
+errormsg=gettext(u"Unable to connect to server:\n\n%s" 
% errmsg)
 )
 else:
 if 'save_password' in data and data['save_password'] and 
have_password:
diff --git a/web/pgadmin/misc/file_manager/__init__.py 
b/web/pgadmin/misc/file_manager/__init__.py
index 8542cdf..4d32f39 100644
--- a/web/pgadmin/misc/file_manager/__init__.py
+++ b/web/pgadmin/misc/file_manager/__init__.py
@@ -505,7 +505,7 @@ class Filemanager(object):
 if not path_exists(orig_path):
 return {
 'Code': 0,
-'Error': gettext(u"'{}' file does not exist.".format(path))
+'Error': gettext(u"'{0}' file does not exist.".format(path))
 }
 
 user_dir = path
@@ -599,7 +599,7 @@ class Filemanager(object):
 # Do not allow user to access outside his storage dir in server mode.
 if not orig_path.startswith(dir):
 raise Exception(
-gettext(u"Access denied ({})".format(path)))
+gettext(u"Access denied ({0})".format(path)))
 return True
 
 @staticmethod
@@ -690,7 +690,7 @@ class Filemanager(object):

Re: [pgadmin-hackers][patch] RM2163 emboldened syntax highlighting

2017-02-08 Thread Murtuza Zabuawala
Hi,

It's not a good idea to directly change in main Library, Lets say if newer
version of CodeMirror available and we want to pull new version then we
need to maintain this change set every time we pull new version.

Instead please use,

   - web/pgadmin/static/css/overrides.css


or more specifically if you are only targeting Syntax highlighting for
Query Tool then,

   - web/pgadmin/tools/sqleditor/static/css/sqleditor.css


to override any CSS related changes specific to pgAdmin4.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Thu, Feb 9, 2017 at 4:24 AM, Atira Odhner <aodh...@pivotal.io> wrote:

> Hello Hackers
>
> We have made syntax highlighting more visible!
>
> -Tira & George
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>
>


Re: [pgadmin-hackers][patch] We can see tables in Greenplum!

2017-02-08 Thread Murtuza Zabuawala
Hello,

Regarding test output,


*Comment Style-1:*  If we comment like

"""Test Case is used for... """

*Result:*

runTest (pgadmin.xxx)
*Test case to verify server group (Get server list) ... ok*


*Comment Style-2: *If we comment like

"""

Test Case is used for 
"""

*Result:*

runTest runTest (pgadmin.xxx) ... ok

Unittest framework strip the doc string with "\n" and get the string at 0th
index so in case of Comment Style-2 it will be empty, so no description
will be displayed.

So use *Comment Style-1* when you write test cases.



--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Wed, Feb 8, 2017 at 9:26 PM, George Gelashvili <ggelashv...@pivotal.io>
wrote:

> Hello Hackers!
>
> We've a fix for displaying table nodes when connected to Greenplum. The
> salient bit was leaving off tgisinternal from the default template (but
> leaving the template used for postgres 9.1+ unchanged).
> We also added a Database helper class in test_utils for setting up and
> tearing down a database. It can be used via python's with (see
>  TestTablesNode).
>
>
> This isn't super important, but does anyone know why our test comment
> doesn't show up in test output?
>
> We see:
>
>> runTest (pgadmin.browser.server_groups.servers.databases.
>> schemas.tables.templates.table.sql.tests.test_tables_node.TestTablesNode)
>> ... {'oid': 106072, 'has_enable_triggers': '0', 'name': 'test_table',
>> 'triggercount': '0'}
>
>
> Whereas for other tests we see output like
>
>>  This function update the server details (Default Server Node url)
>
>
> Cheers!
> Tira & George
>
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>
>


[pgadmin-hackers] [pgAdmin4][PATCH] To handle "char" type in column node

2017-02-06 Thread Murtuza Zabuawala
Hi,

PFA minor patch to handle "char" type while creating columns in Column node.

*Issue:* simplejson parse '*"char"*' as valid json, hence when we perform
simplejson.loads(request.args) operation '"char"' gets converted to 'char'
I had to handle it manually as of now, I did not find any other workaround
to handle this issue, I went over several SO question most of them
suggested manual handling.
This behavior is only in Column node, table & type nodes are not affectted
by .loads() method as we send data as column collection.
RM#2152

*Snippet of issue:*
import simplejson as json
print(json.loads('"char"'))

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/__init__.py
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/__init__.py
index ac9a103..225e694 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/__init__.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/__init__.py
@@ -490,6 +490,15 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
 after length/precision so we will set flag for
 sql template
 """
+
+# We need to add this exceptional case for manually adding " in type
+# in json.loads('"char"') is valid json hence it
+# converts '"char"' -> 'char' as string but if we
+# send the same in collection json.loads() handles it properly in
+# Table & Type nodes, This handling handling is Column node specific
+if type == 'char':
+type = '"char"'
+
 if '[]' in type:
 type = type.replace('[]', '')
 self.hasSqrBracket = True
@@ -710,7 +719,7 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
 for k, v in request.args.items():
 try:
 data[k] = json.loads(v, encoding='utf-8')
-except ValueError:
+except (ValueError, TypeError, KeyError):
 data[k] = v
 
 # Adding parent into data dict, will be using it while creating sql

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in handling of timestamp type

2017-02-05 Thread Murtuza Zabuawala
Hi Dave,

Please find a fix for the same, attribute length was set to False instead
of None.


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, Feb 6, 2017 at 11:18 AM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Sure, Checking.
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Sat, Feb 4, 2017 at 7:34 PM, Dave Page <dp...@pgadmin.org> wrote:
>
>> Hi Murtuza,
>>
>> I clearly neglected to run the regression tests with this patch, and
>> unfortunately it looks like it broke them. Can you look at this ASAP
>> please?
>>
>> runTest (pgadmin.browser.server_groups.servers.databases.schemas.
>> tables.column.tests.test_column_add.ColumnAddTestCase)
>> This function will add column under table node. (Add table Node URL)
>> ... 2017-02-04 14:43:55,191: ERROR pgadmin: Failed to execute query
>> (execute_scalar) for the server #4 - DB:test_db_9e176 (Query-id:
>> 4792242):
>> Error Message:ERROR:  syntax error at or near "False"
>> LINE 2: ADD COLUMN test_column_add_f0d5d char(False);
>>   ^
>> FAIL
>>
>> As far as I can see, the app works fine - it's only the test that
>> broke (probably because the application uses type name aliases (e.g.
>> character) rather than the base type name that the test is using
>> ("char").
>>
>> Thanks.
>>
>> On Fri, Feb 3, 2017 at 1:52 PM, Dave Page <dp...@pgadmin.org> wrote:
>> > Thanks - patch applied.
>> >
>> > On Fri, Feb 3, 2017 at 11:46 AM, Murtuza Zabuawala
>> > <murtuza.zabuaw...@enterprisedb.com> wrote:
>> >> Hi,
>> >>
>> >> Please find updates patch for the same.
>> >> RM#2076
>> >>
>> >> --
>> >> Regards,
>> >> Murtuza Zabuawala
>> >> EnterpriseDB: http://www.enterprisedb.com
>> >> The Enterprise PostgreSQL Company
>> >>
>> >> On Wed, Feb 1, 2017 at 3:08 PM, Dave Page <dp...@pgadmin.org> wrote:
>> >>>
>> >>> Hi
>> >>>
>> >>> On Tue, Jan 31, 2017 at 5:19 AM, Murtuza Zabuawala
>> >>> <murtuza.zabuaw...@enterprisedb.com> wrote:
>> >>> > Hi Dave,
>> >>> >
>> >>> > PFA updated patch.
>> >>>
>> >>> This seems to display "timestamp(0) with[out] timezone" columns
>> >>> correctly in both the properties panel and dialog now, but the size is
>> >>> still ignored if I try to add a new column through the table or column
>> >>> dialogue.
>> >>>
>> >>> --
>> >>> Dave Page
>> >>> Blog: http://pgsnake.blogspot.com
>> >>> Twitter: @pgsnake
>> >>>
>> >>> EnterpriseDB UK: http://www.enterprisedb.com
>> >>> The Enterprise PostgreSQL Company
>> >>
>> >>
>> >
>> >
>> >
>> > --
>> > Dave Page
>> > Blog: http://pgsnake.blogspot.com
>> > Twitter: @pgsnake
>> >
>> > EnterpriseDB UK: http://www.enterprisedb.com
>> > The Enterprise PostgreSQL Company
>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/tests/test_column_add.py
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/tests/test_column_add.py
index 25542d7..fb2bbe7 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/tests/test_column_add.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/tests/test_column_add.py
@@ -55,7 +55,7 @@ class ColumnAddTestCase(BaseTestGenerator):
 "attacl": [],
 "is_primary_key": False,
 "attnotnull": False,
-"attlen": False,
+"attlen": None,
 "attprecision": None,
 "attoptions": [],
 "seclabels": []

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in handling of timestamp type

2017-02-05 Thread Murtuza Zabuawala
Sure, Checking.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Sat, Feb 4, 2017 at 7:34 PM, Dave Page <dp...@pgadmin.org> wrote:

> Hi Murtuza,
>
> I clearly neglected to run the regression tests with this patch, and
> unfortunately it looks like it broke them. Can you look at this ASAP
> please?
>
> runTest (pgadmin.browser.server_groups.servers.databases.
> schemas.tables.column.tests.test_column_add.ColumnAddTestCase)
> This function will add column under table node. (Add table Node URL)
> ... 2017-02-04 14:43:55,191: ERROR pgadmin: Failed to execute query
> (execute_scalar) for the server #4 - DB:test_db_9e176 (Query-id:
> 4792242):
> Error Message:ERROR:  syntax error at or near "False"
> LINE 2: ADD COLUMN test_column_add_f0d5d char(False);
>   ^
> FAIL
>
> As far as I can see, the app works fine - it's only the test that
> broke (probably because the application uses type name aliases (e.g.
> character) rather than the base type name that the test is using
> ("char").
>
> Thanks.
>
> On Fri, Feb 3, 2017 at 1:52 PM, Dave Page <dp...@pgadmin.org> wrote:
> > Thanks - patch applied.
> >
> > On Fri, Feb 3, 2017 at 11:46 AM, Murtuza Zabuawala
> > <murtuza.zabuaw...@enterprisedb.com> wrote:
> >> Hi,
> >>
> >> Please find updates patch for the same.
> >> RM#2076
> >>
> >> --
> >> Regards,
> >> Murtuza Zabuawala
> >> EnterpriseDB: http://www.enterprisedb.com
> >> The Enterprise PostgreSQL Company
> >>
> >> On Wed, Feb 1, 2017 at 3:08 PM, Dave Page <dp...@pgadmin.org> wrote:
> >>>
> >>> Hi
> >>>
> >>> On Tue, Jan 31, 2017 at 5:19 AM, Murtuza Zabuawala
> >>> <murtuza.zabuaw...@enterprisedb.com> wrote:
> >>> > Hi Dave,
> >>> >
> >>> > PFA updated patch.
> >>>
> >>> This seems to display "timestamp(0) with[out] timezone" columns
> >>> correctly in both the properties panel and dialog now, but the size is
> >>> still ignored if I try to add a new column through the table or column
> >>> dialogue.
> >>>
> >>> --
> >>> Dave Page
> >>> Blog: http://pgsnake.blogspot.com
> >>> Twitter: @pgsnake
> >>>
> >>> EnterpriseDB UK: http://www.enterprisedb.com
> >>> The Enterprise PostgreSQL Company
> >>
> >>
> >
> >
> >
> > --
> > Dave Page
> > Blog: http://pgsnake.blogspot.com
> > Twitter: @pgsnake
> >
> > EnterpriseDB UK: http://www.enterprisedb.com
> > The Enterprise PostgreSQL Company
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


[pgadmin-hackers] [pgAdmin4][PATCH] To fix graphical explain for Insert/Update/Delete quries

2017-02-05 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue with Graphical Explain plan functionality which
was breaking for INSERT/UPDATE/DELETE explain plans.
RM#2133

*Issue:* It was due to typo in imageMapper object.

Please review.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/misc/templates/explain/js/explain.js 
b/web/pgadmin/misc/templates/explain/js/explain.js
index 382fd61..3c4c6d9 100644
--- a/web/pgadmin/misc/templates/explain/js/explain.js
+++ b/web/pgadmin/misc/templates/explain/js/explain.js
@@ -145,11 +145,11 @@ var imageMapper = {
   }
 },
 "ModifyTable" : function(data) {
-  switch (data['Operaton']) {
-case "insert": return { "image":"ex_insert.png",
+  switch (data['Operation']) {
+case "Insert": return { "image":"ex_insert.png",
 "image_text":"Insert"
};
-case "update": return {"image":"ex_update.png","image_text":"Update"};
+case "Update": return {"image":"ex_update.png","image_text":"Update"};
 case "Delete": return {"image":"ex_delete.png","image_text":"Delete"};
   }
 },

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] Regarding Import and Export Issue

2017-02-03 Thread Murtuza Zabuawala
It's a bug with windows system & already reported
https://redmine.postgresql.org/issues/1679
It will be taken care in future release.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Thu, Feb 2, 2017 at 12:02 PM, <vinay.m...@eapindia.in> wrote:

> Hi,
>
> Details are as below:,
>
>- pgAdmin4 Version: Pgadmin4 version 1.1 Yes after installing
>PostgreSQL 9.6
>- PostgreSQL Version: 9.6
>- Operating system: Windows 10
>- Reproduce steps: Clearly mention the steps to reproduce the bug.
>- Create table test having id as integer and name as character varying
>   with some values in it.
>   - click on button export and and select csv type with delimiter as
>   ',' store where you want it.
>- Expected result: How application should behave on the above
>mentioned steps.
>- Need to start the export functionality but it wont.
>- Actual result: What is the actual result on running the above steps
>i.e. the bug behavior.
>   - same way create csv file and import to any of it havinf same no f
>   columns in it.
>
>
> Regards,
> Vinay Mali
> Software Developer | Pune, (IST) | Cell: +91-99233 88865
>
>
> On Tuesday, 31 January 2017 3:29 PM, "vinay.m...@eapindia.in" <
> vinay.m...@eapindia.in> wrote:
>
>
> Hi,
>
> Provide required details as below,
>
>- pgAdmin4 Version: Yes after installing PostgreSQL 9.6
>- PostgreSQL Version: 9.6
>- Operating system: Windows 10
>- Reproduce steps: Clearly mention the steps to reproduce the bug.
>- Create table test having id as integer and name as character varying
>   with some values in it.
>   - click on button export and and select csv type with delimiter as
>   ',' store where you want it.
>- Expected result: How application should behave on the above
>mentioned steps.
>- Need to start the export functionality but it wont.
>- Actual result: What is the actual result on running the above steps
>i.e. the bug behavior.
>   - same way create csv file and import to any of it havinf same no f
>   columns in it.
>
>
> Regards,
> Vinay Mali
> Software Developer | Pune, (IST) | Cell: +91-99233 88865
>
>
> On Tuesday, 31 January 2017 3:23 PM, Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>
> Hi,
>
> Provide required details as below,
>
>- pgAdmin4 Version: ?
>- PostgreSQL Version: ?
>- Operating system: ?
>- Reproduce steps: Clearly mention the steps to reproduce the bug.
>- Expected result: How application should behave on the above
>mentioned steps.
>- Actual result: What is the actual result on running the above steps
>i.e. the bug behavior.
>
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Tue, Jan 31, 2017 at 1:10 PM, <vinay.m...@eapindia.in> wrote:
>
> Hello
>
> I have issue for the for the tables data in the Export and import
> functionality.
>
>
> Regards,
> Vinay Mali
> Software Developer | Pune, (IST) |
>
>
>
>
>
>
>


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in handling of timestamp type

2017-02-03 Thread Murtuza Zabuawala
Hi,

Please find updates patch for the same.
RM#2076

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Wed, Feb 1, 2017 at 3:08 PM, Dave Page <dp...@pgadmin.org> wrote:

> Hi
>
> On Tue, Jan 31, 2017 at 5:19 AM, Murtuza Zabuawala
> <murtuza.zabuaw...@enterprisedb.com> wrote:
> > Hi Dave,
> >
> > PFA updated patch.
>
> This seems to display "timestamp(0) with[out] timezone" columns
> correctly in both the properties panel and dialog now, but the size is
> still ignored if I try to add a new column through the table or column
> dialogue.
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
index 9292989..646f12a 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py
@@ -654,13 +654,13 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 # If we have length & precision both
 matchObj = re.search(r'(\d+),(\d+)', fulltype)
 if matchObj:
-column['attlen'] = int(matchObj.group(1))
-column['attprecision'] = int(matchObj.group(2))
+column['attlen'] = matchObj.group(1)
+column['attprecision'] = matchObj.group(2)
 else:
 # If we have length only
 matchObj = re.search(r'(\d+)', fulltype)
 if matchObj:
-column['attlen'] = int(matchObj.group(1))
+column['attlen'] = matchObj.group(1)
 column['attprecision'] = None
 else:
 column['attlen'] = None
@@ -694,21 +694,7 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 edit_types_list.append(present_type)
 
 column['edit_types'] = edit_types_list
-
-# Manual Data type formatting
-# If data type has () with them then we need to remove them
-# eg bit(1) because we need to match the name with combobox
-isArray = False
-if column['cltype'].endswith('[]'):
-isArray = True
-column['cltype'] = column['cltype'].rstrip('[]')
-
-idx = column['cltype'].find('(')
-if idx and column['cltype'].endswith(')'):
-column['cltype'] = column['cltype'][:idx]
-
-if isArray:
-column['cltype'] += "[]"
+column['cltype'] = 
DataTypeReader.parse_type_name(column['cltype'])
 
 if 'indkey' in column:
 # Current column
@@ -1316,6 +1302,24 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 else:
 return data_type, False
 
+@staticmethod
+def convert_length_precision_to_string(data):
+"""
+This function is used to convert length & precision to string
+to handle case like when user gives 0 as length
+
+Args:
+data: Data from client
+
+Returns:
+Converted data
+"""
+if 'attlen' in data and data['attlen'] is not None:
+data['attlen'] = str(data['attlen'])
+if 'attprecision' in data and data['attprecision'] is not None:
+data['attprecision'] = str(data['attprecision'])
+return data
+
 def _parse_format_columns(self, data, mode=None):
 """
 data:
@@ -1343,6 +1347,8 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 # check type for '[]' in it
 c['cltype'], c['hasSqrBracket'] = 
self._cltype_formatter(c['cltype'])
 
+c = self.convert_length_precision_to_string(c)
+
 data['columns'][action] = final_columns
 else:
 # We need to exclude all the columns which are inherited from 
other tables
@@ -1363,6 +1369,8 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 # check type for '[]' in it
 c['cltype'], c['hasSqrBracket'] = 
self._cltype_formatter(c['cltype'])
 
+c = self.convert_length_precision_to_string(c)
+
 data['columns'] = final_columns
 
 return data
@@ -2199,6 +2207,7 @@ class TableView(PGChildNodeView, DataTypeReader, 
VacuumSettings):
 

Re: [pgadmin-hackers] Issues with PgAdmin4

2017-02-03 Thread Murtuza Zabuawala
You can try "Reset Layout" option.
Ref: https://www.pgadmin.org/docs4/dev/pgadmin_menu_bar.html

You can copy paste rows, To copy rows from query tool, first select rows
you want to copy then click on "Copy button" (refer screenshot)
Now you can "Paste" the copied rows at your desired destination.
Ref: https://www.pgadmin.org/docs4/1.x/query_tool.html

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Fri, Feb 3, 2017 at 3:24 AM, Tania <palta...@gmail.com> wrote:

> Hi,
>
> I like the new interface, until I realized how sensitive the windows/tabs
> are!  Gets docked and undocked at weird times and then docking them back to
> original position is so hard.
> Are there any tips or tricks to that to make my life easier?   I work with
> PgAdmin all the time at my job and this new behavior is getting a bit
> annoying.  I miss the old PgAdmin.
>
> Also, how do you select a column in the output of an query and then copy
> and paste them in a text editor? I used to be able to do that with the old
> PgAdmin.
>
> Any pointers are appreciated.
>
> Tania
>
>

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][Patch] Displaying Zero in Slickgrid editor

2017-02-01 Thread Murtuza Zabuawala
Thanks Dave.

Tested and working fine.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Wed, Feb 1, 2017 at 7:20 PM, Dave Page <dp...@pgadmin.org> wrote:

> Hi
>
> On Wed, Feb 1, 2017 at 12:18 PM, Murtuza Zabuawala
> <murtuza.zabuaw...@enterprisedb.com> wrote:
> > Hi,
> >
> > PFA minor patch to display value '0'  in Read only text editor.
> > RM#2138
>
> Thanks - I committed a modified version of the patch; yours had the
> same tests duplicated and joined with an or conditional.
>
> Please double check it's OK - it looks fine to me and seems to work as
> expected with null, zero and one.
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


[pgadmin-hackers] [pgAdmin4][Patch] Displaying Zero in Slickgrid editor

2017-02-01 Thread Murtuza Zabuawala
Hi,

PFA minor patch to display value '0'  in Read only text editor.
RM#2138


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/static/js/slickgrid/slick.pgadmin.editors.js 
b/web/pgadmin/static/js/slickgrid/slick.pgadmin.editors.js
index 19ad11d..3ef4f5a 100644
--- a/web/pgadmin/static/js/slickgrid/slick.pgadmin.editors.js
+++ b/web/pgadmin/static/js/slickgrid/slick.pgadmin.editors.js
@@ -550,7 +550,16 @@
 };
 
 this.loadValue = function (item) {
-  defaultValue = item[args.column.field] || "";
+  var value = item[args.column.field];
+  // Check if value is null or undefined
+  if(
+(value === undefined && typeof value === "undefined")
+||
+(value === undefined && typeof value === "undefined")
+  ) {
+value = ""
+  }
+  defaultValue = value;
   $input.val(defaultValue);
   $input[0].defaultValue = defaultValue;
   $input.select();

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] PATCH: To fix the issue in Database node (pgAdmin4)

2017-02-01 Thread Murtuza Zabuawala
Hi Dave,

PFA updated patch, issue was conn.release(did=did) was removing all
connection for same database from connection manager.
We have now created new connection for offline updates using "conn_id"
parameter instead of did.

Please review.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, Jan 30, 2017 at 8:03 PM, Dave Page <dp...@pgadmin.org> wrote:

> Hi
>
> On Mon, Jan 30, 2017 at 5:31 AM, Murtuza Zabuawala
> <murtuza.zabuaw...@enterprisedb.com> wrote:
> > Hi Dave,
> >
> > Please find updated patch, Tested against maintenance database as well.
>
> I can change parameters on the maintenance DB now, but it still
> crashes if I try to change the comment. Both operations on other
> databases seem to work OK.
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


RM_2024_v5.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][Patch] Minor fix in test file for the Template loader

2017-01-31 Thread Murtuza Zabuawala
Hi Dave,

Please find minor patch for the same.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Tue, Jan 31, 2017 at 4:10 PM, Dave Page <dp...@pgadmin.org> wrote:

> On Tue, Jan 31, 2017 at 10:36 AM, Murtuza Zabuawala
> <murtuza.zabuaw...@enterprisedb.com> wrote:
> > Hi Dave,
> >
> > Even I tested against Python3.5 but did not receive any such error and I
> > tried again after your mail but still did not receive error.
> >
> > murtuza@vm:~/pgadmin4/web/regression$ python3 --version
> >
> > Python 3.5.0
>
> Hmm, I have:
>
> (pgadmin4-py35) piranha:web dpage$ python --version
> Python 3.5.3
> (pgadmin4-py35) piranha:web dpage$ pip freeze
> Babel==1.3
> beautifulsoup4==4.4.1
> blinker==1.3
> click==6.6
> extras==0.0.3
> fixtures==2.0.0
> Flask==0.11.1
> Flask-Babel==0.11.1
> Flask-Gravatar==0.4.2
> Flask-HTMLmin==1.2
> Flask-Login==0.3.2
> Flask-Mail==0.9.1
> Flask-Principal==0.4.0
> Flask-Security==1.7.5
> Flask-SQLAlchemy==2.1
> Flask-WTF==0.12
> html5lib==1.0b3
> htmlmin==0.1.10
> itsdangerous==0.24
> Jinja2==2.7.3
> linecache2==1.0.0
> MarkupSafe==0.23
> passlib==1.6.2
> pbr==1.9.1
> psycopg2==2.6.2
> pycrypto==2.6.1
> pyrsistent==0.11.13
> python-dateutil==2.5.0
> python-mimeparse==1.5.1
> pytz==2014.10
> simplejson==3.6.5
> six==1.9.0
> speaklater==1.3
> SQLAlchemy==1.0.14
> sqlparse==0.1.19
> testscenarios==0.5.0
> testtools==2.0.0
> traceback2==1.4.0
> unittest2==1.1.0
> Werkzeug==0.9.6
> WTForms==2.0.2
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
diff --git a/web/pgadmin/utils/sqlautocomplete/counter.py 
b/web/pgadmin/utils/sqlautocomplete/counter.py
index 081b390..1ccd99c 100644
--- a/web/pgadmin/utils/sqlautocomplete/counter.py
+++ b/web/pgadmin/utils/sqlautocomplete/counter.py
@@ -3,7 +3,12 @@ Copied from 
http://code.activestate.com/recipes/576611-counter-class/
 """
 
 from heapq import nlargest
-from itertools import repeat, ifilter
+from itertools import repeat
+try:
+from itertools import ifilter
+except ImportError:
+# ifilter is in-built function in Python3 as filter
+ifilter = filter
 from operator import itemgetter
 
 

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] [pgAdmin4][Patch] Minor fix in test file for the Template loader

2017-01-31 Thread Murtuza Zabuawala
Hi Dave,

Even I tested against Python3.5 but did not receive any such error and I
tried again after your mail but still did not receive error.

murtuza@vm:~/pgadmin4/web/regression$ python3 --version

Python 3.5.0

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Tue, Jan 31, 2017 at 3:34 PM, Dave Page <dp...@pgadmin.org> wrote:

> Thanks Murtuza. When you get a minute, can you also look at the
> following issue I get with the tests under Python 3.5? It doesn't seem
> to stop them working.
>
> Traceback (most recent call last):
>   File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/route.py", line
> 75, in load_generators
> import_module(module_name)
>   File "/Users/dpage/.virtualenvs/pgadmin4-py35/lib/python3.5/
> importlib/__init__.py",
> line 126, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 986, in _gcd_import
>   File "", line 969, in _find_and_load
>   File "", line 958, in
> _find_and_load_unlocked
>   File "", line 673, in _load_unlocked
>   File "", line 673, in exec_module
>   File "", line 222, in
> _call_with_frames_removed
>   File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/
> sqlautocomplete/counter.py",
> line 6, in 
> from itertools import repeat, ifilter
> ImportError: cannot import name 'ifilter'
>
>
> On Tue, Jan 31, 2017 at 5:25 AM, Murtuza Zabuawala
> <murtuza.zabuaw...@enterprisedb.com> wrote:
> > Hi,
> >
> > PFA patch to fix the issue in test suite for template loader.
> >
> > Issue(Python3):
> > murtuza@vm:~/pgadmin4/web/regression$ python3 runtests.py
> > pgAdmin 4 - Application Initialisation
> > ==
> >
> >
> > The configuration database - '/../.pgadmin/test_pgadmin4.db' does not
> exist.
> > Entering initial setup mode...
> > NOTE: Configuring authentication for SERVER mode.
> >
> >
> > The configuration database has been created at
> /../.pgadmin/test_pgadmin4.db
> > Traceback (most recent call last):
> >   File "runtests.py", line 250, in 
> > test_module_list = get_test_modules(args)
> >   File "runtests.py", line 138, in get_test_modules
> > TestsGeneratorRegistry.load_generators('pgadmin')
> >   File "../../pgadmin4/web/pgadmin/utils/route.py", line 66, in
> > load_generators
> > import_module(module_name)
> >   File "/../../3.5/lib/python3.5/importlib/__init__.py", line 126, in
> > import_module
> > return _bootstrap._gcd_import(name[level:], package, level)
> >   File "", line 986, in _gcd_import
> >   File "", line 969, in _find_and_load
> >   File "", line 958, in
> _find_and_load_unlocked
> >   File "", line 673, in _load_unlocked
> >   File "", line 658, in
> exec_module
> >   File "", line 764, in get_code
> >   File "", line 724, in
> source_to_code
> >   File "", line 222, in
> > _call_with_frames_removed
> >   File
> > "/../../pgadmin4/web/pgadmin/utils/tests/test_versioned_
> template_loader.py",
> > line 50
> > except TemplateNotFound, e:
> >^
> > SyntaxError: invalid syntax
> >
> > --
> > Regards,
> > Murtuza Zabuawala
> > EnterpriseDB: http://www.enterprisedb.com
> > The Enterprise PostgreSQL Company
> >
> >
> > --
> > Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgadmin-hackers
> >
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


Re: [pgadmin-hackers] Regarding Import and Export Issue

2017-01-31 Thread Murtuza Zabuawala
Hi,

Provide required details as below,

   - pgAdmin4 Version: ?
   - PostgreSQL Version: ?
   - Operating system: ?
   - Reproduce steps: Clearly mention the steps to reproduce the bug.
   - Expected result: How application should behave on the above mentioned
   steps.
   - Actual result: What is the actual result on running the above steps
   i.e. the bug behavior.


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Tue, Jan 31, 2017 at 1:10 PM, <vinay.m...@eapindia.in> wrote:

> Hello
>
> I have issue for the for the tables data in the Export and import
> functionality.
>
>
> Regards,
> Vinay Mali
> Software Developer | Pune, (IST) |
>


[pgadmin-hackers] [pgAdmin4][Patch] Minor fix in test file for the Template loader

2017-01-30 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue in test suite for template loader.

*Issue(Python3):*
murtuza@vm:~/pgadmin4/web/regression$ python3 runtests.py
pgAdmin 4 - Application Initialisation
==


The configuration database - '/../.pgadmin/test_pgadmin4.db' does not exist.
Entering initial setup mode...
NOTE: Configuring authentication for SERVER mode.


The configuration database has been created at /../.pgadmin/test_pgadmin4.db
Traceback (most recent call last):
  File "runtests.py", line 250, in 
test_module_list = get_test_modules(args)
  File "runtests.py", line 138, in get_test_modules
TestsGeneratorRegistry.load_generators('pgadmin')
  File "../../pgadmin4/web/pgadmin/utils/route.py", line 66, in
load_generators
import_module(module_name)
  File "/../../3.5/lib/python3.5/importlib/__init__.py", line 126, in
import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 986, in _gcd_import
  File "", line 969, in _find_and_load
  File "", line 958, in _find_and_load_unlocked
  File "", line 673, in _load_unlocked
  File "", line 658, in exec_module
  File "", line 764, in get_code
  File "", line 724, in source_to_code
  File "", line 222, in
_call_with_frames_removed
  File
"/../../pgadmin4/web/pgadmin/utils/tests/test_versioned_template_loader.py",
line 50
except TemplateNotFound, e:
   ^
SyntaxError: invalid syntax

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Fix_template_loader_test.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


  1   2   3   4   5   >