public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4][Patch] - RM 3505 Incorrect SQL generated for tables created using inherited columns
2+ messages / 2 participants
[nested] [flat]

* [pgAdmin4][Patch] - RM 3505 Incorrect SQL generated for tables created using inherited columns
@ 2019-01-10 09:26  Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Akshay Joshi @ 2019-01-10 09:26 UTC (permalink / raw)
  To: pgadmin-hackers

Hi Hackers,

Attached is the patch to fix RM #3505 Incorrect SQL generated for tables
created using inherited columns.

Please review it.

-- 
*Akshay Joshi*

*Sr. Software Architect *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


Attachments:

  [text/x-patch] RM_3505.patch (2.9K, 3-RM_3505.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/default/create.sql
index 8ea1b762..82501a91 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/default/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/default/create.sql
@@ -41,10 +41,10 @@ CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE {{conn|qtIdent(data
 {### Add columns ###}
 {% if data.columns and data.columns|length > 0 %}
 {% for c in data.columns %}
-{% if c.name and c.cltype %}
-{% if loop.index != 1 %},
-{% endif %}
+{% if c.name and c.cltype and not c.inheritedfrom %}
     {{conn|qtIdent(c.name)}} {% if is_sql %}{{c.displaytypname}}{% else %}{{ GET_TYPE.CREATE_TYPE_SQL(conn, c.cltype, c.attlen, c.attprecision, c.hasSqrBracket) }}{% endif %}{% if c.collspcname %} COLLATE {{c.collspcname}}{% endif %}{% if c.attnotnull %} NOT NULL{% endif %}{% if c.defval %} DEFAULT {{c.defval}}{% endif %}
+{% if not loop.last %},
+{% endif %}
 {% endif %}
 {% endfor %}
 {% endif %}
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/default/sql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/default/sql.sql
deleted file mode 100644
index 17b35aed..00000000
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/default/sql.sql
+++ /dev/null
@@ -1 +0,0 @@
-TAKE ASHESH'S HELP ON THIS TASK :-)
\ No newline at end of file
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/gpdb_5.0_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/gpdb_5.0_plus/create.sql
index 61e4e1e1..c82e72cc 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/gpdb_5.0_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/gpdb_5.0_plus/create.sql
@@ -41,10 +41,10 @@ CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE {{conn|qtIdent(data
 {### Add columns ###}
 {% if data.columns and data.columns|length > 0 %}
 {% for c in data.columns %}
-{% if c.name and c.cltype %}
-{% if loop.index != 1 %},
-{% endif %}
+{% if c.name and c.cltype and not c.inheritedfrom %}
     {{conn|qtIdent(c.name)}} {% if is_sql %}{{c.displaytypname}}{% else %}{{ GET_TYPE.CREATE_TYPE_SQL(conn, c.cltype, c.attlen, c.attprecision, c.hasSqrBracket) }}{% endif %}{% if c.collspcname %} COLLATE {{c.collspcname}}{% endif %}{% if c.attnotnull %} NOT NULL{% endif %}{% if c.defval %} DEFAULT {{c.defval}}{% endif %}
+{% if not loop.last %},
+{% endif %}
 {% endif %}
 {% endfor %}
 {% endif %}


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [pgAdmin4][Patch] - RM 3505 Incorrect SQL generated for tables created using inherited columns
@ 2019-01-11 16:20  Dave Page <[email protected]>
  parent: Akshay Joshi <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Dave Page @ 2019-01-11 16:20 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers

Thanks, patch applied.

On Thu, Jan 10, 2019 at 2:56 PM Akshay Joshi
<[email protected]> wrote:
>
> Hi Hackers,
>
> Attached is the patch to fix RM #3505 Incorrect SQL generated for tables created using inherited columns.
>
> Please review it.
>
> --
> Akshay Joshi
> Sr. Software Architect
>
>
> Phone: +91 20-3058-9517
> Mobile: +91 976-788-8246



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

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





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2019-01-11 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-01-10 09:26 [pgAdmin4][Patch] - RM 3505 Incorrect SQL generated for tables created using inherited columns Akshay Joshi <[email protected]>
2019-01-11 16:20 ` 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