public inbox for [email protected]  
help / color / mirror / Atom feed
From: Akshay Joshi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch] - RM 3505 Incorrect SQL generated for tables created using inherited columns
Date: Thu, 10 Jan 2019 14:56:32 +0530
Message-ID: <CANxoLDf5z0C9eDCjAKDFOfd1YtVqESUfJWs16iXT9-YoC+kGgg@mail.gmail.com> (raw)

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 %}


view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [pgAdmin4][Patch] - RM 3505 Incorrect SQL generated for tables created using inherited columns
  In-Reply-To: <CANxoLDf5z0C9eDCjAKDFOfd1YtVqESUfJWs16iXT9-YoC+kGgg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox