[pgAdmin4][Patch]: RM #3066 - Create script doesn't add quotation marks to column names for the "add index" functions
Hi, Please find the attached patch to fix RM #3066 - Create script doesn't add quotation marks to column names for the "add index" functions Thanks, Khushboo diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/index/sql/default/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/index/sql/default/create.sql index b7bfa52..26921b8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/index/sql/default/create.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/index/sql/default/create.sql @@ -7,7 +7,7 @@ CREATE {% if data.indisunique %}UNIQUE {% endif %}INDEX {% if data.isconcurrent FIRST{% else %}LAST{% endif %}{% endif %}{% endif %}{% endfor %}) {% else %} {## We will get indented data from postgres for column ##} -({% for c in data.columns %}{% if loop.index != 1 %}, {% endif %}{{c.colname}}{% if c.collspcname %} COLLATE {{c.collspcname}}{% endif %}{% if c.op_class %} +({% for c in data.columns %}{% if loop.index != 1 %}, {% endif %}{{conn|qtIdent(c.colname)}}{% if c.collspcname %} COLLATE {{c.collspcname}}{% endif %}{% if c.op_class %} {{c.op_class}}{% endif %}{% if c.sort_order is defined %}{% if c.sort_order %} DESC{% else %} ASC{% endif %}{% endif %}{% if c.nulls is defined %} NULLS {% if c.nulls %} FIRST{% else %}LAST{% endif %}{% endif %}{% endfor %}) {% endif %}
[pgAdmin4][Patch]: RM 3081- Reverse engineered SQL for Sequences missing comment header and drop statement
Hi, Please find the attached patch to fix RM #3081 : Reverse engineered SQL for Sequences missing comment header and drop statement Thanks, Khushboo diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py index a6d6e21..25722d6 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/__init__.py @@ -141,15 +141,19 @@ class SequenceView(PGChildNodeView): @wraps(f) def wrapped(self, *args, **kwargs): -self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid']) +driver = get_driver(PG_DEFAULT_DRIVER) +self.manager = driver.connection_manager(kwargs['sid']) + if action and action in ["drop"]: self.conn = self.manager.connection() elif 'did' in kwargs: self.conn = self.manager.connection(did=kwargs['did']) else: self.conn = self.manager.connection() + self.template_path = 'sequence/sql/#{0}#'.format(self.manager.version) self.acl = ['r', 'w', 'U'] +self.qtIdent = driver.qtIdent return f(self, *args, **kwargs) return wrapped @@ -625,6 +629,15 @@ class SequenceView(PGChildNodeView): if not isinstance(SQL, (str, unicode)): return SQL SQL = SQL.strip('\n').strip(' ') + +sql_header = u"""-- SEQUENCE: {0} + +-- DROP SEQUENCE {0}; + +""".format(self.qtIdent(self.conn, result['schema'], result['name'])) + +SQL = sql_header + SQL + return ajax_response(response=SQL) def _formatter(self, data, scid, seid):
Proposal for changes in official Docker image
Hi! I accidentially sent this email to pgsql-hackers yesterday, sorry! First of all, thanks for the great app :) I started using PgAdmin with docker image (dpage/pgadmin4) a few weeks ago, however I thought that it had some issues, so I decided to make my own image. Some of the advantages: - Use alpine linux instead of centos to greatly reduce image size (170MB vs 560MB) - Use lightweight pure-python HTTP server waitress instead of heavy apache/mod_wsgi - Use python 3.6 You can test the image at https://hub.docker.com/r/maksbotan/pgadmin4/ Readme contains more detailed explanation and usage instructions. The Dockerfile is hosted at github: https://github.com/maksbotan/pgadmin4_docker If you find my work useful, I'd love to make a contribution with these scripts, after some discussion with pgadmin developers and further improvements. Looking forward for an answer, Maxim.