public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin4][Patch][RM_2461]: Unable to drop defaut value from the column in table
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin4][Patch][RM_2461]: Unable to drop defaut value from the column in table
@ 2017-06-06 10:05 Surinder Kumar <[email protected]>
2017-06-07 13:33 ` Re: [pgAdmin4][Patch][RM_2461]: Unable to drop defaut value from the column in table Dave Page <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Surinder Kumar @ 2017-06-06 10:05 UTC (permalink / raw)
To: pgadmin-hackers
Hi
Add drop column syntax for dropping default value of a column if default
value is kept empty.
Please find attached patch and review.
Thanks,
Surinder
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[application/octet-stream] RM_2461.patch (2.4K, 3-RM_2461.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/column/sql/9.2_plus/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/column/sql/9.2_plus/update.sql
index fcfd3c1..7728a2a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/column/sql/9.2_plus/update.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/column/sql/9.2_plus/update.sql
@@ -20,6 +20,12 @@ 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 DEFAULT {{data.defval}};
{% endif %}
+{### Drop column default value ###}
+{% if data.defval is defined and data.defval == '' and data.defval != o_data.defval %}
+ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
+ ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} DROP DEFAULT;
+
+{% endif %}
{### Alter column not null value ###}
{% if 'attnotnull' in data and data.attnotnull != o_data.attnotnull %}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/column/sql/default/update.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/column/sql/default/update.sql
index b045131..5f48672 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/column/sql/default/update.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/column/sql/default/update.sql
@@ -20,6 +20,12 @@ 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 DEFAULT {{data.defval}};
{% endif %}
+{### Drop column default value ###}
+{% if data.defval is defined and data.defval == '' and data.defval != o_data.defval %}
+ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
+ ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} DROP DEFAULT;
+
+{% endif %}
{### Alter column not null value ###}
{% if 'attnotnull' in data and data.attnotnull != o_data.attnotnull %}
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin4][Patch][RM_2461]: Unable to drop defaut value from the column in table
2017-06-06 10:05 [pgAdmin4][Patch][RM_2461]: Unable to drop defaut value from the column in table Surinder Kumar <[email protected]>
@ 2017-06-07 13:33 ` Dave Page <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Dave Page @ 2017-06-07 13:33 UTC (permalink / raw)
To: Surinder Kumar <[email protected]>; +Cc: pgadmin-hackers
Thanks, applied.
On Tue, Jun 6, 2017 at 11:05 AM, Surinder Kumar
<[email protected]> wrote:
> Hi
>
> Add drop column syntax for dropping default value of a column if default
> value is kept empty.
>
> Please find attached patch and review.
>
> Thanks,
> Surinder
>
>
> --
> Sent via pgadmin-hackers mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2017-06-07 13:33 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-06-06 10:05 [pgAdmin4][Patch][RM_2461]: Unable to drop defaut value from the column in table Surinder Kumar <[email protected]>
2017-06-07 13:33 ` Dave Page <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox