Обсуждение: [pgadmin-hackers] patch for RM2243 and RM2244 [pgAdmin4]

Поиск
Список
Период
Сортировка

[pgadmin-hackers] patch for RM2243 and RM2244 [pgAdmin4]

От
Harshal Dhumal
Дата:
Hi,

Here is patch for RM2243 and RM2244

Changes: 1. Pickup correct encoding in qtLiteral to decode.
2. While releasing database connection only decode database name if it's not unicode.

-- 
Harshal Dhumal
Software Engineer

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Вложения

Re: [pgadmin-hackers] patch for RM2243 and RM2244 [pgAdmin4]

От
Dave Page
Дата:
Hi

On Fri, Mar 17, 2017 at 7:02 AM, Harshal Dhumal
<harshal.dhumal@enterprisedb.com> wrote:
> Hi,
>
> Here is patch for RM2243 and RM2244
>
> Changes: 1. Pickup correct encoding in qtLiteral to decode.
> 2. While releasing database connection only decode database name if it's not
> unicode.

This fixes 2243, but 2244 is an SQL error that occurs when querying
tables with no columns in the Query Tool. Although Fahar found it
whilst testing with an Arabic name, it's otherwise unrelated.

Patch committed to fix 2243 only.

Thanks.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: [pgadmin-hackers] patch for RM2243 and RM2244 [pgAdmin4]

От
Harshal Dhumal
Дата:
Hi,

-- 
Harshal Dhumal
Software Engineer

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Fri, Mar 17, 2017 at 4:04 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Fri, Mar 17, 2017 at 7:02 AM, Harshal Dhumal
<harshal.dhumal@enterprisedb.com> wrote:
> Hi,
>
> Here is patch for RM2243 and RM2244
>
> Changes: 1. Pickup correct encoding in qtLiteral to decode.
> 2. While releasing database connection only decode database name if it's not
> unicode.

This fixes 2243, but 2244 is an SQL error that occurs when querying
tables with no columns in the Query Tool. Although Fahar found it
whilst testing with an Arabic name, it's otherwise unrelated.

Patch committed to fix 2243 only.


Yes right, I missed that. I thought 2244 was also related to encoding.

Please find attached patch for RM2244.

 
Thanks.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Вложения

Re: [pgadmin-hackers] patch for RM2243 and RM2244 [pgAdmin4]

От
Dave Page
Дата:
Hi

On Sat, Mar 18, 2017 at 2:57 PM, Harshal Dhumal
<harshal.dhumal@enterprisedb.com> wrote:
>
> Please find attached patch for RM2244.

If I run View Data on the table below, I see the following exception
and no grid is rendered:

CREATE TABLE public.varchar_test
(
    id integer NOT NULL DEFAULT nextval('varchar_test_id_seq'::regclass),
    data character varying(10) COLLATE pg_catalog."default",
    CONSTRAINT varchar_test_pkey PRIMARY KEY (id)
)
WITH (
    OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.varchar_test
    OWNER to postgres;




2017-03-20 10:37:49,711: SQL pgadmin: Execute (async) for server #1 -
CONN:1470698 (Query-id: 4557394):
SELECT * FROM public.varchar_test
ORDER BY id ASC
2017-03-20 10:37:49,714: INFO werkzeug: 127.0.0.1 - - [20/Mar/2017
10:37:49] "GET /sqleditor/view_data/start/2408862 HTTP/1.1" 200 -
2017-03-20 10:37:49,749: SQL pgadmin: Polling result for (Query-id: 4557394)
2017-03-20 10:37:49,749: SQL pgadmin: Status message for (Query-id: 4557394)
2017-03-20 10:37:49,750: INFO werkzeug: 127.0.0.1 - - [20/Mar/2017
10:37:49] "GET /sqleditor/poll/2408862 HTTP/1.1" 200 -
2017-03-20 10:37:49,779: INFO werkzeug: 127.0.0.1 - - [20/Mar/2017
10:37:49] "GET /sqleditor/columns/2408862 HTTP/1.1" 200 -
2017-03-20 10:37:49,808: SQL pgadmin: Execute (dict) for server #1 -
CONN:1470698 (Query-id: 9451779):
SELECT oid, format_type(oid,null) as typname FROM pg_type WHERE oid IN
(%s) ORDER BY oid;

2017-03-20 10:37:49,814: INFO werkzeug: 127.0.0.1 - - [20/Mar/2017
10:37:49] "GET /sqleditor/fetch/types/2408862 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 558, in fetch_pg_types
    """, tuple(oid))
  File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/driver/psycopg2/__init__.py",
line 938, in execute_dict
    self.__internal_blocking_execute(cur, query, params)
  File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/driver/psycopg2/__init__.py",
line 595, in __internal_blocking_execute
    cur.execute(query, params)
  File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/driver/psycopg2/cursor.py",
line 176, in execute
    return _cursor.execute(self, query, params)
TypeError: not all arguments converted during string formatting



--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: [pgadmin-hackers] patch for RM2243 and RM2244 [pgAdmin4]

От
Harshal Dhumal
Дата:
Hi,

Please find updated patch for RM2244.

Changes: View Data was broken in last patch when table contains more that 1 column.


-- 
Harshal Dhumal
Software Engineer

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, Mar 20, 2017 at 4:10 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Sat, Mar 18, 2017 at 2:57 PM, Harshal Dhumal
<harshal.dhumal@enterprisedb.com> wrote:
>
> Please find attached patch for RM2244.

If I run View Data on the table below, I see the following exception
and no grid is rendered:

CREATE TABLE public.varchar_test
(
    id integer NOT NULL DEFAULT nextval('varchar_test_id_seq'::regclass),
    data character varying(10) COLLATE pg_catalog."default",
    CONSTRAINT varchar_test_pkey PRIMARY KEY (id)
)
WITH (
    OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.varchar_test
    OWNER to postgres;




2017-03-20 10:37:49,711: SQL pgadmin: Execute (async) for server #1 -
CONN:1470698 (Query-id: 4557394):
SELECT * FROM public.varchar_test
ORDER BY id ASC
2017-03-20 10:37:49,714: INFO werkzeug: 127.0.0.1 - - [20/Mar/2017
10:37:49] "GET /sqleditor/view_data/start/2408862 HTTP/1.1" 200 -
2017-03-20 10:37:49,749: SQL pgadmin: Polling result for (Query-id: 4557394)
2017-03-20 10:37:49,749: SQL pgadmin: Status message for (Query-id: 4557394)
2017-03-20 10:37:49,750: INFO werkzeug: 127.0.0.1 - - [20/Mar/2017
10:37:49] "GET /sqleditor/poll/2408862 HTTP/1.1" 200 -
2017-03-20 10:37:49,779: INFO werkzeug: 127.0.0.1 - - [20/Mar/2017
10:37:49] "GET /sqleditor/columns/2408862 HTTP/1.1" 200 -
2017-03-20 10:37:49,808: SQL pgadmin: Execute (dict) for server #1 -
CONN:1470698 (Query-id: 9451779):
SELECT oid, format_type(oid,null) as typname FROM pg_type WHERE oid IN
(%s) ORDER BY oid;

2017-03-20 10:37:49,814: INFO werkzeug: 127.0.0.1 - - [20/Mar/2017
10:37:49] "GET /sqleditor/fetch/types/2408862 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 558, in fetch_pg_types
    """, tuple(oid))
  File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/driver/psycopg2/__init__.py",
line 938, in execute_dict
    self.__internal_blocking_execute(cur, query, params)
  File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/driver/psycopg2/__init__.py",
line 595, in __internal_blocking_execute
    cur.execute(query, params)
  File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/driver/psycopg2/cursor.py",
line 176, in execute
    return _cursor.execute(self, query, params)
TypeError: not all arguments converted during string formatting



--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Вложения

Re: [pgadmin-hackers] patch for RM2243 and RM2244 [pgAdmin4]

От
Dave Page
Дата:
Thanks, patch applied.

On Tue, Mar 21, 2017 at 12:35 PM, Harshal Dhumal
<harshal.dhumal@enterprisedb.com> wrote:
> Hi,
>
> Please find updated patch for RM2244.
>
> Changes: View Data was broken in last patch when table contains more that 1
> column.
>
>
> --
> Harshal Dhumal
> Software Engineer
>
> EnterpriseDB India: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Mon, Mar 20, 2017 at 4:10 PM, Dave Page <dpage@pgadmin.org> wrote:
>>
>> Hi
>>
>> On Sat, Mar 18, 2017 at 2:57 PM, Harshal Dhumal
>> <harshal.dhumal@enterprisedb.com> wrote:
>> >
>> > Please find attached patch for RM2244.
>>
>> If I run View Data on the table below, I see the following exception
>> and no grid is rendered:
>>
>> CREATE TABLE public.varchar_test
>> (
>>     id integer NOT NULL DEFAULT nextval('varchar_test_id_seq'::regclass),
>>     data character varying(10) COLLATE pg_catalog."default",
>>     CONSTRAINT varchar_test_pkey PRIMARY KEY (id)
>> )
>> WITH (
>>     OIDS = FALSE
>> )
>> TABLESPACE pg_default;
>>
>> ALTER TABLE public.varchar_test
>>     OWNER to postgres;
>>
>>
>>
>>
>> 2017-03-20 10:37:49,711: SQL pgadmin: Execute (async) for server #1 -
>> CONN:1470698 (Query-id: 4557394):
>> SELECT * FROM public.varchar_test
>> ORDER BY id ASC
>> 2017-03-20 10:37:49,714: INFO werkzeug: 127.0.0.1 - - [20/Mar/2017
>> 10:37:49] "GET /sqleditor/view_data/start/2408862 HTTP/1.1" 200 -
>> 2017-03-20 10:37:49,749: SQL pgadmin: Polling result for (Query-id:
>> 4557394)
>> 2017-03-20 10:37:49,749: SQL pgadmin: Status message for (Query-id:
>> 4557394)
>> 2017-03-20 10:37:49,750: INFO werkzeug: 127.0.0.1 - - [20/Mar/2017
>> 10:37:49] "GET /sqleditor/poll/2408862 HTTP/1.1" 200 -
>> 2017-03-20 10:37:49,779: INFO werkzeug: 127.0.0.1 - - [20/Mar/2017
>> 10:37:49] "GET /sqleditor/columns/2408862 HTTP/1.1" 200 -
>> 2017-03-20 10:37:49,808: SQL pgadmin: Execute (dict) for server #1 -
>> CONN:1470698 (Query-id: 9451779):
>> SELECT oid, format_type(oid,null) as typname FROM pg_type WHERE oid IN
>> (%s) ORDER BY oid;
>>
>> 2017-03-20 10:37:49,814: INFO werkzeug: 127.0.0.1 - - [20/Mar/2017
>> 10:37:49] "GET /sqleditor/fetch/types/2408862 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 558, in fetch_pg_types
>>     """, tuple(oid))
>>   File
>> "/Users/dpage/git/pgadmin4/web/pgadmin/utils/driver/psycopg2/__init__.py",
>> line 938, in execute_dict
>>     self.__internal_blocking_execute(cur, query, params)
>>   File
>> "/Users/dpage/git/pgadmin4/web/pgadmin/utils/driver/psycopg2/__init__.py",
>> line 595, in __internal_blocking_execute
>>     cur.execute(query, params)
>>   File
>> "/Users/dpage/git/pgadmin4/web/pgadmin/utils/driver/psycopg2/cursor.py",
>> line 176, in execute
>>     return _cursor.execute(self, query, params)
>> TypeError: not all arguments converted during string formatting
>>
>>
>>
>> --
>> 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