Re: [pgAdmin4][Patch] - RM 4030 - IDENTITY column not recognised

2019-03-28 Thread Khushboo Vashi
Hi Dave,

Please find the attached updated patch.

Thanks,
Khushboo

On Thu, Mar 21, 2019 at 3:57 PM Dave Page  wrote:

> Hi
>
> On Thu, Mar 21, 2019 at 9:52 AM Khushboo Vashi <
> khushboo.va...@enterprisedb.com> wrote:
>
>> Hi Dave,
>>
>> On Wed, Mar 20, 2019 at 8:37 PM Dave Page  wrote:
>>
>>> Hi
>>>
>>> On Wed, Mar 20, 2019 at 7:30 AM Khushboo Vashi <
>>> khushboo.va...@enterprisedb.com> wrote:
>>>
 Hi,

 Please find the attached patch to fix the RM #4030 - IDENTITY column
 not recognised.
 - Added support for IDENTITY column for PostgreSQL >= 10.0

>>>
>>> A few issues unfortunately:
>>>
>>> - There's an extra space in the generated SQL for an identity column on
>>> a table, right before the end comma (in both the CREATE and reverse
>>> engineered SQL.
>>>
>>> - I cannot make an IDENTITY column a primary key through the UI, nor
>>> does it reverse-engineer that property in the SQL if I create it via SQL
>>> (it does properly set the switch value though).
>>>
>> This issue has already been logged earlier, but I will fix this with this
>> patch.
>>
> Fixed

>
>>> - After creating an IDENTITY column, there should be a dependency on the
>>> sequence, but I don't see this listed.
>>>
>> If the *Show System Object* is enabled, then only you can see.
>>
>
> Hmm, OK. I turned on "Show System Objects" and I do now see the
> dependencies. Something seems funky though:
>
> - The sequence has a dependency of the column
> - The sequence is dependent on the table
>
> Shouldn't they both be dependencies? It's the table and column that needs
> the sequence.
>
> - The sequence is only listed as a dependent of the column (which is the
> opposite of what is seen on the sequence, as you'd expect), but it doesn't
> show that it's dependent on the table, in the same way that a table lists a
> schema as a dependency.
>
> Is our SQL messed up here, or is PostgreSQL listing things in a funky way?
> I'd expect to see:
>
> When clicking on the sequence:
>
> - Dependencies should list the schema.
> - Dependents  should list the table and column.
>
> If we check the pg_depend for a sequence,
select * from pg_depend where objid=36946, here objid = {seqid}
then, the output is

*classid*

*objid*

*objsubid*

*refclassid*

*refobjid*

*refobjsubid*

*deptype*

*1259*

36946

0

2615

2200

0

n

*1259*

36946

0

1259

36897

3

i

So, it shows the schema, table, and column as its dependency.
We display only schema and column but we can also consider the table in
this case.

 As per you, Dependents should display table and column, do you still
think, we are doing something wrong?

When clicking on the column:
>
> - Dependencies should list the sequence.
>
> - Dependents should list the table.
>
> I grant you it's confusing and open to interpretation though. I think as
> long as we're definitely listing things as PG tracks them, it's all good.
>
>
>>
>>> - We should consider the auto-created sequence a system object, and hide
>>> it in the treeview by default as it's an implementation detail.
>>>
>> How, can I identify those as a system object? I tried but couldn't find a
>> way.
>>
>
> Check if there's a dependency on a column.
>
>
>>
>>> - If I click on an IDENTITY column in the treeview, the
>>> reverse-engineered SQL just shows the plain datatype.
>>>
>> Fixed.
>>
> Fixed

>
>>> - Can we reasonably support the sequence_options clause?
>>>
>> I will look into it.
>>
>
> Done

> Thanks.
>
>
>>
>>> Thanks.
>>>
>>> Thanks,
>> Khushboo
>>
>>> --
>>> 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
>


RM_4030_v1.patch
Description: Binary data


Re: [pgAdmin4][RM4105] select for json context doesn't work

2019-03-28 Thread Dave Page
Thanks, patch applied (but not yet pushed for network reasons. Sigh).

On Wed, Mar 27, 2019 at 3:02 AM Aditya Toshniwal <
aditya.toshni...@enterprisedb.com> wrote:

> Hi Hackers,
>
> Attached is the patch to fix the issue, where selecting json type was not
> rendering the grid.
> This also fixes RM4114.
>
> Kindly review.
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB Software Solutions | Pune
> "Don't Complain about Heat, Plant a tree"
>


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

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


pgAdmin 4 commit: Fix an issue where JSON data would not be rendered in

2019-03-28 Thread Dave Page
Fix an issue where JSON data would not be rendered in the Query Tool. Fixes 
#4105

Branch
--
master

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

Modified Files
--
docs/en_US/release_notes_4_4.rst   |  1 +
web/pgadmin/tools/sqleditor/static/js/sqleditor.js | 48 +++---
2 files changed, 25 insertions(+), 24 deletions(-)



pgAdmin 4 commit: Include inherited column comments and defaults in rev

2019-03-28 Thread Dave Page
Include inherited column comments and defaults in reverse engineered table SQL. 
Fixes #2627
Include comment SQL for inherited columns in reverse engineered table SQL. 
Fixes #4037
Include inherited columns in SELECT scripts. Fixes #4058

Branch
--
master

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

Modified Files
--
docs/en_US/release_notes_4_4.rst   |  3 ++
.../templates/table/sql/10_plus/properties.sql |  1 +
.../templates/table/sql/9.1_plus/properties.sql|  1 +
.../tables/templates/table/sql/default/create.sql  |  4 +--
.../servers/databases/schemas/tables/utils.py  | 42 +-
5 files changed, 24 insertions(+), 27 deletions(-)



[pgAdmin4][Patch]: RM #4110 "Updating 'Custom auto-vacuum?' property throws error for Materialized View."

2019-03-28 Thread Akshay Joshi
Hi Hackers,

I have started working on RM #4110 "Updating 'Custom auto-vacuum?' property
throws error for Materialized View." and while working I have figured out
following issues:

   - Reset some/all the parameter for table and toast table is not
   implemented.
   - Value of "Custom auto-vacuum?" is not retrieved and set properly.
   - When user set the "Custom auto-vacuum?" to "Yes" and none of the
   parameter is set previously then set the value of "Enabled?" control to
   "Yes".
   - Alignment of Table and remove extra margin from "Parameters" tab.

Attached is the patch to fix all the above issues. Added API test cases.
Please review it.

-- 
*Thanks & Regards*
*Akshay Joshi*

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


RM_4110.patch
Description: Binary data


[pgAdmin4][Patch] - RM 4082 - Download CSV error displayed for procedure and functions with create script

2019-03-28 Thread Khushboo Vashi
Hi,

Please find the attached patch to fix the RM #4082 - Download CSV error
displayed for procedure and functions with create script.

The error message in case of any error while downloading the CSV file was
blank, so now it has been displayed.

Thanks,
Khushboo
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index ec8ab954..6ea45b93 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -3736,7 +3736,15 @@ define('tools.querytool', [
 pgAdmin, self, err, gettext('Download CSV'), [], true
   );
 }
+
+if (_.isEmpty(msg)) msg = err.statusText || gettext('Download CSV error');
 alertify.alert(gettext('Download CSV error'), msg);
+// Enable the execute button
+$('#btn-flash').prop('disabled', false);
+$('#btn-download').prop('disabled', false);
+self.disable_tool_buttons(false);
+self.trigger(
+  'pgadmin-sqleditor:loading-icon:hide');
   });
 
   },


Re: [pgAdmin4][RM4037] COMMENTS from inherited fields are not present when seeing generated SQL from a table

2019-03-28 Thread Dave Page
Thanks, applied.

On Thu, Mar 28, 2019 at 2:00 AM Aditya Toshniwal <
aditya.toshni...@enterprisedb.com> wrote:

> Hi Hackers,
>
> Just to mention, the patch also fixes RM2627, RM4058.
>
> On Wed, Mar 27, 2019 at 6:25 PM Aditya Toshniwal <
> aditya.toshni...@enterprisedb.com> wrote:
>
>> Hi Hackers,
>>
>> Attached is the patch which fixes the issue where comments added in child
>> table on inherited columns where not showing in reverse engineered SQL.
>>
>> I have also made changes to show column details of inherited columns of
>> table, as well as for "of type" tables similar to pgAdmin3. eg-
>> CREATE TABLE public.inhactortest
>> (
>> -- Inherited from table public.actor: actor_id integer NOT NULL DEFAULT
>> nextval('actor_actor_id_seq'::regclass),
>> -- Inherited from table public.actor: first_name character varying(45)
>> COLLATE pg_catalog."default" NOT NULL,
>> -- Inherited from table public.actor: last_name character varying(45)
>> COLLATE pg_catalog."default" NOT NULL,
>> -- Inherited from table public.test_table: col1 integer,
>> -- Inherited from table public.test_table: col2 "char",
>> -- Inherited from table public.test_table: col3 character varying COLLATE
>> pg_catalog."default",
>>  owncol integer
>> )
>> INHERITS (public.actor, public.test_table)
>> WITH (
>> OIDS = FALSE
>> )
>> TABLESPACE pg_default;
>>
>> ALTER TABLE public.inhactortest
>> OWNER to postgres;
>>
>> COMMENT ON COLUMN public.inhactortest.actor_id
>> IS 'in child c';
>> --
>>
>> Kindly review.
>>
>> Thanks and Regards,
>> Aditya Toshniwal
>> Software Engineer | EnterpriseDB Software Solutions | Pune
>> "Don't Complain about Heat, Plant a tree"
>>
>
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB Software Solutions | Pune
> "Don't Complain about Heat, Plant a tree"
>


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

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


pgAdmin 4 commit: Add support for IDENTITY columns. Fixes #4030

2019-03-28 Thread Dave Page
Add support for IDENTITY columns. Fixes #4030

Branch
--
master

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

Modified Files
--
docs/en_US/release_notes_4_4.rst   |   1 +
.../databases/schemas/sequences/__init__.py|  23 ++-
.../schemas/tables/columns/static/js/column.js | 133 +-
.../tables/columns/tests/test_column_add.py|  42 -
.../tables/columns/tests/test_column_put.py|  46 -
.../databases/schemas/tables/static/js/table.js|  18 +-
.../tables/templates/column/sql/10_plus/create.sql |  46 +
.../templates/column/sql/10_plus/properties.sql|  46 +
.../tables/templates/column/sql/10_plus/update.sql | 192 +
.../templates/column/sql/default/properties.sql|   2 +-
.../tables/templates/table/sql/10_plus/create.sql  | 168 ++
.../table/sql/10_plus/get_columns_for_table.sql|  16 ++
web/pgadmin/browser/utils.py   |  10 +-
web/pgadmin/static/js/backform.pgadmin.js  |   1 +
web/pgadmin/static/scss/_backgrid.overrides.scss   |   4 +
15 files changed, 723 insertions(+), 25 deletions(-)



Re: [pgAdmin4][Patch] - RM 4030 - IDENTITY column not recognised

2019-03-28 Thread Dave Page
Thanks, patch applied!

One thing I did notice - Sequences are missing the system object property.
I've re-opened #1257

On Thu, Mar 28, 2019 at 5:17 AM Khushboo Vashi <
khushboo.va...@enterprisedb.com> wrote:

> Hi Dave,
>
> Please find the attached updated patch.
>
> Thanks,
> Khushboo
>
> On Thu, Mar 21, 2019 at 3:57 PM Dave Page  wrote:
>
>> Hi
>>
>> On Thu, Mar 21, 2019 at 9:52 AM Khushboo Vashi <
>> khushboo.va...@enterprisedb.com> wrote:
>>
>>> Hi Dave,
>>>
>>> On Wed, Mar 20, 2019 at 8:37 PM Dave Page  wrote:
>>>
 Hi

 On Wed, Mar 20, 2019 at 7:30 AM Khushboo Vashi <
 khushboo.va...@enterprisedb.com> wrote:

> Hi,
>
> Please find the attached patch to fix the RM #4030 - IDENTITY column
> not recognised.
> - Added support for IDENTITY column for PostgreSQL >= 10.0
>

 A few issues unfortunately:

 - There's an extra space in the generated SQL for an identity column on
 a table, right before the end comma (in both the CREATE and reverse
 engineered SQL.

 - I cannot make an IDENTITY column a primary key through the UI, nor
 does it reverse-engineer that property in the SQL if I create it via SQL
 (it does properly set the switch value though).

>>> This issue has already been logged earlier, but I will fix this with
>>> this patch.
>>>
>> Fixed
>
>>
 - After creating an IDENTITY column, there should be a dependency on
 the sequence, but I don't see this listed.

>>> If the *Show System Object* is enabled, then only you can see.
>>>
>>
>> Hmm, OK. I turned on "Show System Objects" and I do now see the
>> dependencies. Something seems funky though:
>>
>> - The sequence has a dependency of the column
>> - The sequence is dependent on the table
>>
>> Shouldn't they both be dependencies? It's the table and column that needs
>> the sequence.
>>
>> - The sequence is only listed as a dependent of the column (which is the
>> opposite of what is seen on the sequence, as you'd expect), but it doesn't
>> show that it's dependent on the table, in the same way that a table lists a
>> schema as a dependency.
>>
>> Is our SQL messed up here, or is PostgreSQL listing things in a funky
>> way? I'd expect to see:
>>
>> When clicking on the sequence:
>>
>> - Dependencies should list the schema.
>> - Dependents  should list the table and column.
>>
>> If we check the pg_depend for a sequence,
> select * from pg_depend where objid=36946, here objid = {seqid}
> then, the output is
>
> *classid*
>
> *objid*
>
> *objsubid*
>
> *refclassid*
>
> *refobjid*
>
> *refobjsubid*
>
> *deptype*
>
> *1259*
>
> 36946
>
> 0
>
> 2615
>
> 2200
>
> 0
>
> n
>
> *1259*
>
> 36946
>
> 0
>
> 1259
>
> 36897
>
> 3
>
> i
>
> So, it shows the schema, table, and column as its dependency.
> We display only schema and column but we can also consider the table in
> this case.
>
>  As per you, Dependents should display table and column, do you still
> think, we are doing something wrong?
>
> When clicking on the column:
>>
>> - Dependencies should list the sequence.
>>
>> - Dependents should list the table.
>>
>> I grant you it's confusing and open to interpretation though. I think as
>> long as we're definitely listing things as PG tracks them, it's all good.
>>
>>
>>>
 - We should consider the auto-created sequence a system object, and
 hide it in the treeview by default as it's an implementation detail.

>>> How, can I identify those as a system object? I tried but couldn't find
>>> a way.
>>>
>>
>> Check if there's a dependency on a column.
>>
>>
>>>
 - If I click on an IDENTITY column in the treeview, the
 reverse-engineered SQL just shows the plain datatype.

>>> Fixed.
>>>
>> Fixed
>
>>
 - Can we reasonably support the sequence_options clause?

>>> I will look into it.
>>>
>>
>> Done
>
>> Thanks.
>>
>>
>>>
 Thanks.

 Thanks,
>>> Khushboo
>>>
 --
 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 4 commit: PEP-8 fixes.

2019-03-28 Thread Dave Page
PEP-8 fixes.

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=4d45a3cb24e1c4f185d83eb85adf2dd9a0489c63

Modified Files
--
.../databases/schemas/sequences/__init__.py|  6 +++--
.../tables/columns/tests/test_column_add.py|  1 -
.../tables/columns/tests/test_column_put.py| 31 +++---
web/pgadmin/browser/utils.py   |  6 +++--
4 files changed, 23 insertions(+), 21 deletions(-)



[pgAdmin4][RM4085] CSV download should show error messages in messages tab and not in the CSV file

2019-03-28 Thread Aditya Toshniwal
Hi Hackers,

Attached is the patch to handle Postgres or other errors gracefully when
clicked on download CSV. PostgresSQL errors will be shown in messages tab
similar to normal SQL execute.

The patch also covers RM4082 (a patch is available for this on hackers, but
this is an improved version :P. Actually I had already started working on
this ) and RM4096.

Kindly review.

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


RM4085.patch
Description: Binary data


[pgAdmin4][Patch] - Minor patch to remove javascript debugger

2019-03-28 Thread Khushboo Vashi
Hi,

Please find the attached patch to remove the javascript debugger from the
code.

Thanks,
Khushboo


remove_debugger.patch
Description: Binary data