Thread: Patch for RM1500 other issues [pgAdmin4]
Hi,
PFA patch for RM1500.3] Added missing data formating when adding new column to existing table (from table edit mode).
4] Added more validation for Foreign key constraint.
5] Column.js: Column grid (in table edit mode) show proper disabled color for disabled cell when grid renders.
6] All constraints and index js added idattribute to distinguish which s/constraint or s/index is updated on server side.
7] Column update.sql: Fixed sql when altering column data type. The issue was when we alter data type from which has length and precision to data type which don't have these properties and vice versa.
For e.g. alter data type numeric(10,12) to real (and vice versa)
8] Renaming constraint (RM1500).
--
Harshal Dhumal
Software Engineer
Attachment
Hi On Wed, Aug 3, 2016 at 7:36 AM, Harshal Dhumal <harshal.dhumal@enterprisedb.com> wrote: > Hi, > > PFA patch for RM1500. > > Changes/Issues fixed: > > 1] datamodel.js: For collection type added check before adding model into > "changed" list instead of adding it blindly. > > 2] Type casting from str to int of column properties like attlen, > attpricision. > > 3] Added missing data formating when adding new column to existing table > (from table edit mode). > > 4] Added more validation for Foreign key constraint. > > 5] Column.js: Column grid (in table edit mode) show proper disabled color > for disabled cell when grid renders. > > 6] All constraints and index js added idattribute to distinguish which > s/constraint or s/index is updated on server side. > > 7] Column update.sql: Fixed sql when altering column data type. The issue > was when we alter data type from which has length and precision to data type > which don't have these properties and vice versa. > For e.g. alter data type numeric(10,12) to real (and vice versa) > > 8] Renaming constraint (RM1500). I get the following error when renaming a primary key. I have restarted my app sever and done a hard reload/clear cache on my browser. The generated SQL is: ALTER TABLE public.foo RENAME CONSTRAINT foo_pkey TO foo_pkey1; 2016-08-03 11:39:43,764: INFO werkzeug: 127.0.0.1 - - [03/Aug/2016 11:39:43] "PUT /browser/table/obj/1/1/12403/2200/158521 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/views.py", line 84, in view return self.dispatch_request(*args, **kwargs) File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line 235, in dispatch_request return method(*args, **kwargs) File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py", line 331, in wrap return f(*args, **kwargs) File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py", line 1446, in update data[k] = json.loads(v, encoding='utf-8') File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/__init__.py", line 533, in loads return cls(encoding=encoding, **kw).decode(s) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/decoder.py", line 395, in raw_decode ord0 = ord(s[idx]) KeyError: 0 -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Hi Dave,
This because on python 2.X simplejson throws KeyError instead of TypeError if any error occurs while loading json data from given object. Now I have handled that exception as well in attached patch.I'm sending this as separate patch instead part of RM1500.
--
Harshal Dhumal
Software Engineer
On Wed, Aug 3, 2016 at 4:12 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi
On Wed, Aug 3, 2016 at 7:36 AM, Harshal Dhumal
<harshal.dhumal@enterprisedb.com> wrote:
> Hi,
>
> PFA patch for RM1500.
>
> Changes/Issues fixed:
>
> 1] datamodel.js: For collection type added check before adding model into
> "changed" list instead of adding it blindly.
>
> 2] Type casting from str to int of column properties like attlen,
> attpricision.
>
> 3] Added missing data formating when adding new column to existing table
> (from table edit mode).
>
> 4] Added more validation for Foreign key constraint.
>
> 5] Column.js: Column grid (in table edit mode) show proper disabled color
> for disabled cell when grid renders.
>
> 6] All constraints and index js added idattribute to distinguish which
> s/constraint or s/index is updated on server side.
>
> 7] Column update.sql: Fixed sql when altering column data type. The issue
> was when we alter data type from which has length and precision to data type
> which don't have these properties and vice versa.
> For e.g. alter data type numeric(10,12) to real (and vice versa)
>
> 8] Renaming constraint (RM1500).
I get the following error when renaming a primary key. I have
restarted my app sever and done a hard reload/clear cache on my
browser. The generated SQL is:
ALTER TABLE public.foo
RENAME CONSTRAINT foo_pkey TO foo_pkey1;
2016-08-03 11:39:43,764: INFO werkzeug: 127.0.0.1 - - [03/Aug/2016
11:39:43] "PUT /browser/table/obj/1/1/12403/2200/158521 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/views.py",
line 84, in view
return self.dispatch_request(*args, **kwargs)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line
235, in dispatch_request
return method(*args, **kwargs)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py",
line 331, in wrap
return f(*args, **kwargs)
File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py",
line 1446, in update
data[k] = json.loads(v, encoding='utf-8')
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/__init__.py",
line 533, in loads
return cls(encoding=encoding, **kw).decode(s)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/decoder.py",
line 370, in decode
obj, end = self.raw_decode(s)
File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/decoder.py",
line 395, in raw_decode
ord0 = ord(s[idx])
KeyError: 0
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Attachment
Hi On Wed, Aug 3, 2016 at 12:43 PM, Harshal Dhumal <harshal.dhumal@enterprisedb.com> wrote: > Hi Dave, > > This because on python 2.X simplejson throws KeyError instead of TypeError > if any error occurs while loading json data from given object. Now I have > handled that exception as well in attached patch. > > I'm sending this as separate patch instead part of RM1500. I still see the same error, with both patches applied. I've restarted the app server and cleared the browser cache and reloaded etc. -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Hi Dave,
Please find attached updated patch. I missed to change table __init__.py file that why you got the error sorry for that. Also patch has changes for both RM1500 and simplejson issue as both require changes in same file. Please discard old patch of RM1500 and simplejson.
--
Harshal Dhumal
Software Engineer
On Wed, Aug 3, 2016 at 6:30 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi
On Wed, Aug 3, 2016 at 12:43 PM, Harshal Dhumal
<harshal.dhumal@enterprisedb.com> wrote:
> Hi Dave,
>
> This because on python 2.X simplejson throws KeyError instead of TypeError
> if any error occurs while loading json data from given object. Now I have
> handled that exception as well in attached patch.
>
> I'm sending this as separate patch instead part of RM1500.
I still see the same error, with both patches applied. I've restarted
the app server and cleared the browser cache and reloaded etc.
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Attachment
Thanks - applied. On Wed, Aug 3, 2016 at 2:39 PM, Harshal Dhumal <harshal.dhumal@enterprisedb.com> wrote: > Hi Dave, > > Please find attached updated patch. I missed to change table __init__.py > file that why you got the error sorry for that. Also patch has changes for > both RM1500 and simplejson issue as both require changes in same file. > Please discard old patch of RM1500 and simplejson. > > > > > -- > Harshal Dhumal > Software Engineer > > EnterpriseDB India: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > > On Wed, Aug 3, 2016 at 6:30 PM, Dave Page <dpage@pgadmin.org> wrote: >> >> Hi >> >> On Wed, Aug 3, 2016 at 12:43 PM, Harshal Dhumal >> <harshal.dhumal@enterprisedb.com> wrote: >> > Hi Dave, >> > >> > This because on python 2.X simplejson throws KeyError instead of >> > TypeError >> > if any error occurs while loading json data from given object. Now I >> > have >> > handled that exception as well in attached patch. >> > >> > I'm sending this as separate patch instead part of RM1500. >> >> I still see the same error, with both patches applied. I've restarted >> the app server and cleared the browser cache and reloaded etc. >> >> >> -- >> 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