[pgadmin-hackers] pgAdmin 4 commit: Fix various mis-spellings of VACUUM. Fixes #2005

2016-12-08 Thread Dave Page
Fix various mis-spellings of VACUUM. Fixes #2005

Branch
--
master

Details
---
http://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=6ff2fe64b8b25a9038e7b4f025b91792ae2fa08b
Author: Anthony DeBarros 

Modified Files
--
.../databases/schemas/templates/schema/js/schema.js|  4 ++--
.../templates/vacuum_settings/vacuum_fields.json   | 18 +-
.../views/templates/mview/pg/9.3_plus/sql/update.sql   |  2 +-
.../views/templates/mview/pg/9.4_plus/sql/update.sql   |  2 +-
.../views/templates/mview/ppas/9.3_plus/sql/update.sql |  2 +-
web/pgadmin/messages.pot   |  2 +-
web/pgadmin/translations/fr/LC_MESSAGES/messages.po|  2 +-
web/pgadmin/translations/zh/LC_MESSAGES/messages.po|  8 
8 files changed, 20 insertions(+), 20 deletions(-)


-- 
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: Fix typos of "vacuum" throughout

2016-12-08 Thread Dave Page
Hi

On Thu, Dec 8, 2016 at 3:49 AM, Anthony DeBarros  wrote:
> Hi,
>
> I hope this is helpful to the team. I noticed that in the Parameter tab of
> the Create Table dialog that VACUUM was misspelled. Hey, it's not easy to
> remember if it's one "C" or two :-) So, I searched the codebase for all the
> misspellings of that particular word and corrected them in this patch.

Urgh - how did I miss that?

> It looks like Sublime Text also removed a couple of spaces at the end of
> lines; hope that's OK.

No problem.

> This is my first time submitting a patch to pgAdmin; thanks for considering.

May it be the first of many :-)

Thanks - patch applied!

-- 
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


Re: [pgadmin-hackers] [pgAdmin4][Patch]: RM #1801 : Properly handle databases with datallowconn == false

2016-12-08 Thread Khushboo Vashi
Hi,

Please find the attached updated patch.

Thanks,
Khushboo

On Mon, Dec 5, 2016 at 11:09 PM, Dave Page  wrote:

> Hi
>
> On Friday, December 2, 2016, Khushboo Vashi  com> wrote:
>
>> Hi.
>>
>> Please find the attached updated patch.
>>
>> Thanks,
>> Khushboo
>>
>> On Fri, Nov 25, 2016 at 7:12 PM, Dave Page  wrote:
>>
>>> Hi
>>>
>>> On Fri, Nov 25, 2016 at 12:19 PM, Khushboo Vashi
>>>  wrote:
>>> > Hi,
>>> >
>>> > Please find the attached updated patch.
>>>
>>> Please see the attached screenshot. It's still offering to let me
>>> connect to a database with datallowconn=false, or create objects in
>>> it.
>>>
>>> Fixed.
>>
>>
>>> It also doesn't display the properties or dashboard for it if I click
>>> on it - it just silently keeps displaying the properties/dashboard for
>>> the previous database.
>>>
>>> Fixed.
>>
>
> I'm still seeing graphs being generated when I've selected a template
> database with datallowconn = true. What is it showing me? I'm seeing
> transactions, tuple and block I/O, which I would not expect from a database
> that noone can connect to.
>
>
Fixed


> 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/collection.py b/web/pgadmin/browser/collection.py
index e4a83a2..391ccf9 100644
--- a/web/pgadmin/browser/collection.py
+++ b/web/pgadmin/browser/collection.py
@@ -66,7 +66,7 @@ class CollectionNodeModule(PgAdminModule, PGChildModule):
 "id": "%s/%s" % (self.node_type, node_id),
 "label": label,
 "icon": self.node_icon if not icon else icon,
-"inode": self.node_inode,
+"inode": self.node_inode if 'inode' not in kwargs else kwargs['inode'],
 "_type": self.node_type,
 "_id": node_id,
 "_pid": parent_id,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
index ed08ef6..0c96d6b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
@@ -214,7 +214,8 @@ class DatabaseView(PGChildNodeView):
 allowConn=row['datallowconn'],
 canCreate=row['cancreate'],
 canDisconn=canDisConn,
-canDrop = canDrop
+canDrop=canDrop,
+inode=True if row['datallowconn'] else False
 )
 )
 
@@ -276,11 +277,13 @@ class DatabaseView(PGChildNodeView):
 
 @check_precondition(action="properties")
 def properties(self, gid, sid, did):
+conn = self.manager.connection()
+
 SQL = render_template(
 "/".join([self.template_path, 'properties.sql']),
-did=did, conn=self.conn, last_system_oid=0
+did=did, conn=conn, last_system_oid=0
 )
-status, res = self.conn.execute_dict(SQL)
+status, res = conn.execute_dict(SQL)
 
 if len(res['rows']) == 0:
 return gone(
@@ -292,9 +295,9 @@ class DatabaseView(PGChildNodeView):
 
 SQL = render_template(
 "/".join([self.template_path, 'acl.sql']),
-did=did, conn=self.conn
+did=did, conn=conn
 )
-status, dataclres = self.conn.execute_dict(SQL)
+status, dataclres = conn.execute_dict(SQL)
 if not status:
 return internal_server_error(errormsg=res)
 
@@ -302,9 +305,9 @@ class DatabaseView(PGChildNodeView):
 
 SQL = render_template(
 "/".join([self.template_path, 'defacl.sql']),
-did=did, conn=self.conn
+did=did, conn=conn
 )
-status, defaclres = self.conn.execute_dict(SQL)
+status, defaclres = conn.execute_dict(SQL)
 if not status:
 return internal_server_error(errormsg=res)
 
@@ -314,10 +317,10 @@ class DatabaseView(PGChildNodeView):
 # Fetching variable for database
 SQL = render_template(
 "/".join([self.template_path, 'get_variables.sql']),
-did=did, conn=self.conn
+did=did, conn=conn
 )
 
-status, res1 = self.conn.execute_dict(SQL)
+status, res1 = conn.execute_dict(SQL)
 
 if not status:
 return internal_server_error(errormsg=res1)
@@ -535,12 +538,13 @@ class DatabaseView(PGChildNodeView):
 request.data, encoding='utf-8'
 )
 
+conn = self.manager.connection()
 if did is not None:
 # Fetch the name of database for comparison
-status, rset = self.conn.execute_dict(
+status, rset = conn.execute_dict(
 render_template(
 "/".join([self.template_path, 'nodes.sql']),
-did=did, conn=self.conn, last_system_oid=0
+did

Re: [pgadmin-hackers] [pgAdmin4][Patch]: RM #1994 Insert / update are truncating if column is character

2016-12-08 Thread Akshay Joshi
Hi Dave

I have remove the type casting while inserting/updating data. Attached is
the patch file to fixe the issue, I have tested this patch with following
data types:

"serial, integer, interger[], numeric, numeric[], bit, character,
character[], character varying, character varying[], jsonb, timestamp with
timezone, boolean"

Please review it.

On Mon, Dec 5, 2016 at 11:09 PM, Dave Page  wrote:

> Hi
>
> On Friday, December 2, 2016, Akshay Joshi 
> wrote:
>
>> Hi All
>>
>> Please find the attached patch to fix the RM #1994 Insert / update are
>> truncating if column is character.
>>
>> *Issue*: Create any column with datatype as character and provide some
>> length (10), now view the data in pgAdmin4 and try to insert/update that
>> column it gets truncated to one character. In insert/update query we have
>> type casted the value with data type like "col_val::character" but not
>> provided the length while type casting it, so it is truncated to one
>> character.
>>
>> *Solution*: We can solve this in many ways(server side, client side),
>> but for server side it requires too much of code changes. So instead of
>> doing that I have fixed this at client side in "sqleditor.js" file from
>> where we send the modified/inserted data to the server. Following is the
>> fix:
>>
>> If datatype is "character" or "character varying" then check for it's
>> internal_size(length) and update the data type string as well as column
>> label to be shown on column headers.
>>
>>
>> After this fix if user inserts more character than the specified length
>> it will be truncated to that length and saved it into the database.
>>
>> Please review it.
>>
>
>  The problem with that approach is that casting the data will cause
> strings that are excessively long to be silently truncated - for example;
>
> Manually:
>
> postgres=# insert into char_table (char1, char10) values ('abc',
> 'abcdefghi');
> ERROR:  value too long for type character(1)
>
> In the editor:
>
> 2016-12-05 13:23:57,443: SQL pgadmin: Execute (void) for server #1 -
> CONN:7981668 (Query-id: 5028718):
> INSERT INTO public.char_table (
> char1, char10) VALUES (
> 'abc'::character(1), 'abcdefghi'::character(10));
> 2016-12-05 13:23:57,444: SQL pgadmin: Execute (void) for server #1 -
> CONN:7981668 (Query-id: 5003297):
> COMMIT;
>
> We need to avoid casting the data as it will silently truncate data and
> prevent the user seeing the error they should see.
>
> Thanks.
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>


-- 
*Akshay Joshi*
*Principal Software Engineer *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


RM_1994_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