Added statistics and storage information in reverse engineering SQL of table/column. Fixes #4982.

pull/27/head
Akshay Joshi 2019-12-09 15:01:04 +05:30
parent 619c4e1180
commit f15db03ec3
16 changed files with 116 additions and 9 deletions

View File

@ -30,6 +30,7 @@ Bug fixes
| `Issue #3538 <https://redmine.postgresql.org/issues/3538>`_ - Fix issue where the Reset button does not get enabled till all the mandatory fields are provided in the dialog.
| `Issue #4220 <https://redmine.postgresql.org/issues/4220>`_ - Fix scrolling issue in 'Users' dialog.
| `Issue #4516 <https://redmine.postgresql.org/issues/4516>`_ - Remove the sorting of table headers with no labels.
| `Issue #4659 <https://redmine.postgresql.org/issues/4659>`_ - Updated documentation for default privileges to clarify more on the grantor.
| `Issue #4674 <https://redmine.postgresql.org/issues/4674>`_ - Fix query tool launch error if user name contains HTML characters. It's a regression.
| `Issue #4724 <https://redmine.postgresql.org/issues/4724>`_ - Fix network disconnect issue while establishing the connection via SSH Tunnel and it impossible to expand the Servers node.
@ -55,5 +56,6 @@ Bug fixes
| `Issue #4975 <https://redmine.postgresql.org/issues/4975>`_ - Fix issue where the user can not switch the UI language. It's a regression of #4348.
| `Issue #4976 <https://redmine.postgresql.org/issues/4976>`_ - Fix reverse engineering SQL issue where when clause is not visible for PG/EPAS 12.
| `Issue #4978 <https://redmine.postgresql.org/issues/4978>`_ - Fix pgAdmin4 failed to start issue after upgrading to version 4.15.
| `Issue #4982 <https://redmine.postgresql.org/issues/4982>`_ - Added statistics and storage information in reverse engineering SQL of table/column.
| `Issue #4985 <https://redmine.postgresql.org/issues/4985>`_ - Fix an issue where the inherited table name with quotes did not escape correctly.
| `Issue #4991 <https://redmine.postgresql.org/issues/4991>`_ - Fix an issue where context menu is open along with submenu and the focus is not on context menu or submenu.

View File

@ -8,4 +8,10 @@ ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."new_col_2_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "new_col_2_$%{}[]()&*^!@""'`\/#" SET STATISTICS 5;
ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "new_col_2_$%{}[]()&*^!@""'`\/#" SET STORAGE PLAIN;
GRANT INSERT("new_col_2_$%{}[]()&*^!@""'`\/#"), SELECT("new_col_2_$%{}[]()&*^!@""'`\/#"), REFERENCES("new_col_2_$%{}[]()&*^!@""'`\/#") ON testschema."table_2_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -86,7 +86,7 @@
"attnum": 2,
"name": "new_col_2_$%{}[]()&*^!@\"'`\\/#",
"attlen": null,
"attstattarget": "0",
"attstattarget": "5",
"attstorage": "p",
"description": "Comment for alter",
"cltype":"character",

View File

@ -8,4 +8,10 @@ ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_2_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "new_col_2_$%{}[]()&*^!@""'`\/#" SET STATISTICS 5;
ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "new_col_2_$%{}[]()&*^!@""'`\/#" SET STORAGE PLAIN;
GRANT INSERT("new_col_2_$%{}[]()&*^!@""'`\/#"), SELECT("new_col_2_$%{}[]()&*^!@""'`\/#"), REFERENCES("new_col_2_$%{}[]()&*^!@""'`\/#") ON testschema."table_3_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -86,7 +86,7 @@
"attnum": 2,
"name": "new_col_2_$%{}[]()&*^!@\"'`\\/#",
"attlen": null,
"attstattarget": "0",
"attstattarget": "5",
"attstorage": "p",
"description": "Comment for alter",
"cltype":"character",

View File

@ -8,4 +8,10 @@ ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#"
COMMENT ON COLUMN testschema."table_1_$%{}[]()&*^!@""'`\/#"."new_col_2_$%{}[]()&*^!@""'`\/#"
IS 'Comment for alter';
ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "new_col_2_$%{}[]()&*^!@""'`\/#" SET STATISTICS 5;
ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#"
ALTER COLUMN "new_col_2_$%{}[]()&*^!@""'`\/#" SET STORAGE PLAIN;
GRANT INSERT("new_col_2_$%{}[]()&*^!@""'`\/#"), SELECT("new_col_2_$%{}[]()&*^!@""'`\/#"), REFERENCES("new_col_2_$%{}[]()&*^!@""'`\/#") ON testschema."table_1_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@ -86,7 +86,7 @@
"attnum": 2,
"name": "new_col_2_$%{}[]()&*^!@\"'`\\/#",
"attlen": null,
"attstattarget": "0",
"attstattarget": "5",
"attstorage": "p",
"description": "Comment for alter",
"cltype":"character",

View File

@ -31,6 +31,20 @@ COMMENT ON COLUMN {{conn|qtIdent(data.schema, data.table, data.name)}}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
{{ VARIABLE.SET(conn, 'COLUMN', data.name, data.attoptions) }}
{% endif %}
{### Alter column statistics value ###}
{% if data.attstattarget is defined and data.attstattarget > -1 %}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
ALTER COLUMN {{conn|qtTypeIdent(data.name)}} SET STATISTICS {{data.attstattarget}};
{% endif %}
{### Alter column storage value ###}
{% if data.attstorage is defined and data.attstorage != data.defaultstorage %}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
ALTER COLUMN {{conn|qtTypeIdent(data.name)}} SET STORAGE {%if data.attstorage == 'p' %}
PLAIN{% elif data.attstorage == 'm'%}MAIN{% elif data.attstorage == 'e'%}
EXTERNAL{% elif data.attstorage == 'x'%}EXTENDED{% endif %};
{% endif %}
{### ACL ###}
{% if data.attacl %}

View File

@ -72,13 +72,13 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
{% endif %}
{### Alter column statistics value ###}
{% if data.attstattarget and data.attstattarget != o_data.attstattarget %}
{% if data.attstattarget is defined and data.attstattarget != o_data.attstattarget %}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} SET STATISTICS {{data.attstattarget}};
{% endif %}
{### Alter column storage value ###}
{% if data.attstorage and data.attstorage != o_data.attstorage %}
{% if data.attstorage is defined and data.attstorage != o_data.attstorage %}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} SET STORAGE {%if data.attstorage == 'p' %}
PLAIN{% elif data.attstorage == 'm'%}MAIN{% elif data.attstorage == 'e'%}

View File

@ -31,6 +31,20 @@ COMMENT ON COLUMN {{conn|qtIdent(data.schema, data.table, data.name)}}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
{{ VARIABLE.SET(conn, 'COLUMN', data.name, data.attoptions) }}
{% endif %}
{### Alter column statistics value ###}
{% if data.attstattarget is defined and data.attstattarget > -1 %}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
ALTER COLUMN {{conn|qtTypeIdent(data.name)}} SET STATISTICS {{data.attstattarget}};
{% endif %}
{### Alter column storage value ###}
{% if data.attstorage is defined and data.attstorage != data.defaultstorage %}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
ALTER COLUMN {{conn|qtTypeIdent(data.name)}} SET STORAGE {%if data.attstorage == 'p' %}
PLAIN{% elif data.attstorage == 'm'%}MAIN{% elif data.attstorage == 'e'%}
EXTERNAL{% elif data.attstorage == 'x'%}EXTENDED{% endif %};
{% endif %}
{### ACL ###}
{% if data.attacl %}

View File

@ -32,13 +32,13 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
{% endif %}
{### Alter column statistics value ###}
{% if data.attstattarget and data.attstattarget != o_data.attstattarget %}
{% if data.attstattarget is defined and data.attstattarget != o_data.attstattarget %}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} SET STATISTICS {{data.attstattarget}};
{% endif %}
{### Alter column storage value ###}
{% if data.attstorage and data.attstorage != o_data.attstorage %}
{% if data.attstorage is defined and data.attstorage != o_data.attstorage %}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} SET STORAGE {%if data.attstorage == 'p' %}
PLAIN{% elif data.attstorage == 'm'%}MAIN{% elif data.attstorage == 'e'%}

View File

@ -22,6 +22,20 @@ COMMENT ON COLUMN {{conn|qtIdent(data.schema, data.table, data.name)}}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
{{ VARIABLE.SET(conn, 'COLUMN', data.name, data.attoptions) }}
{% endif %}
{### Alter column statistics value ###}
{% if data.attstattarget is defined and data.attstattarget > -1 %}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
ALTER COLUMN {{conn|qtTypeIdent(data.name)}} SET STATISTICS {{data.attstattarget}};
{% endif %}
{### Alter column storage value ###}
{% if data.attstorage is defined and data.attstorage != data.defaultstorage %}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
ALTER COLUMN {{conn|qtTypeIdent(data.name)}} SET STORAGE {%if data.attstorage == 'p' %}
PLAIN{% elif data.attstorage == 'm'%}MAIN{% elif data.attstorage == 'e'%}
EXTERNAL{% elif data.attstorage == 'x'%}EXTENDED{% endif %};
{% endif %}
{### ACL ###}
{% if data.attacl %}

View File

@ -33,13 +33,13 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
{% endif %}
{### Alter column statistics value ###}
{% if data.attstattarget and data.attstattarget != o_data.attstattarget %}
{% if data.attstattarget is defined and data.attstattarget != o_data.attstattarget %}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} SET STATISTICS {{data.attstattarget}};
{% endif %}
{### Alter column storage value ###}
{% if data.attstorage and data.attstorage != o_data.attstorage %}
{% if data.attstorage is defined and data.attstorage != o_data.attstorage %}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} SET STORAGE {%if data.attstorage == 'p' %}
PLAIN{% elif data.attstorage == 'm'%}MAIN{% elif data.attstorage == 'e'%}

View File

@ -140,6 +140,21 @@ COMMENT ON COLUMN {{conn|qtIdent(data.schema, data.name, c.name)}}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
{{ VARIABLE.SET(conn, 'COLUMN', c.name, c.attoptions) }}
{% endif %}
{### Alter column statistics value ###}
{% if c.attstattarget is defined and c.attstattarget > -1 %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
ALTER COLUMN {{conn|qtTypeIdent(c.name)}} SET STATISTICS {{c.attstattarget}};
{% endif %}
{### Alter column storage value ###}
{% if c.attstorage is defined and c.attstorage != c.defaultstorage %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
ALTER COLUMN {{conn|qtTypeIdent(c.name)}} SET STORAGE {%if c.attstorage == 'p' %}
PLAIN{% elif c.attstorage == 'm'%}MAIN{% elif c.attstorage == 'e'%}
EXTERNAL{% elif c.attstorage == 'x'%}EXTENDED{% endif %};
{% endif %}
{### ACL ###}
{% if c.attacl and c.attacl|length > 0 %}

View File

@ -153,6 +153,21 @@ COMMENT ON COLUMN {{conn|qtIdent(data.schema, data.name, c.name)}}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
{{ VARIABLE.SET(conn, 'COLUMN', c.name, c.attoptions) }}
{% endif %}
{### Alter column statistics value ###}
{% if c.attstattarget is defined and c.attstattarget > -1 %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
ALTER COLUMN {{conn|qtTypeIdent(c.name)}} SET STATISTICS {{c.attstattarget}};
{% endif %}
{### Alter column storage value ###}
{% if c.attstorage is defined and c.attstorage != c.defaultstorage %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
ALTER COLUMN {{conn|qtTypeIdent(c.name)}} SET STORAGE {%if c.attstorage == 'p' %}
PLAIN{% elif c.attstorage == 'm'%}MAIN{% elif c.attstorage == 'e'%}
EXTERNAL{% elif c.attstorage == 'x'%}EXTENDED{% endif %};
{% endif %}
{### ACL ###}
{% if c.attacl and c.attacl|length > 0 %}

View File

@ -128,6 +128,21 @@ COMMENT ON COLUMN {{conn|qtIdent(data.schema, data.name, c.name)}}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
{{ VARIABLE.SET(conn, 'COLUMN', c.name, c.attoptions) }}
{% endif %}
{### Alter column statistics value ###}
{% if c.attstattarget is defined and c.attstattarget > -1 %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
ALTER COLUMN {{conn|qtTypeIdent(c.name)}} SET STATISTICS {{c.attstattarget}};
{% endif %}
{### Alter column storage value ###}
{% if c.attstorage is defined and c.attstorage != c.defaultstorage %}
ALTER TABLE {{conn|qtIdent(data.schema, data.name)}}
ALTER COLUMN {{conn|qtTypeIdent(c.name)}} SET STORAGE {%if c.attstorage == 'p' %}
PLAIN{% elif c.attstorage == 'm'%}MAIN{% elif c.attstorage == 'e'%}
EXTERNAL{% elif c.attstorage == 'x'%}EXTENDED{% endif %};
{% endif %}
{### ACL ###}
{% if c.attacl and c.attacl|length > 0 %}