mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Added statistics and storage information in reverse engineering SQL of table/column. Fixes #4982.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
"attnum": 2,
|
||||
"name": "new_col_2_$%{}[]()&*^!@\"'`\\/#",
|
||||
"attlen": null,
|
||||
"attstattarget": "0",
|
||||
"attstattarget": "5",
|
||||
"attstorage": "p",
|
||||
"description": "Comment for alter",
|
||||
"cltype":"character",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
"attnum": 2,
|
||||
"name": "new_col_2_$%{}[]()&*^!@\"'`\\/#",
|
||||
"attlen": null,
|
||||
"attstattarget": "0",
|
||||
"attstattarget": "5",
|
||||
"attstorage": "p",
|
||||
"description": "Comment for alter",
|
||||
"cltype":"character",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
"attnum": 2,
|
||||
"name": "new_col_2_$%{}[]()&*^!@\"'`\\/#",
|
||||
"attlen": null,
|
||||
"attstattarget": "0",
|
||||
"attstattarget": "5",
|
||||
"attstorage": "p",
|
||||
"description": "Comment for alter",
|
||||
"cltype":"character",
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
@@ -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'%}
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
@@ -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'%}
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
@@ -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'%}
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
Reference in New Issue
Block a user