Skip to content

Commit

Permalink
Addressing Issue #35767 to allow for view creation into specified sch…
Browse files Browse the repository at this point in the history
…ema from [ Create a view ] in DBManager
  • Loading branch information
gisn8 authored Oct 4, 2024
1 parent f549811 commit ccdd612
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion python/plugins/db_manager/db_plugins/postgis/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,13 @@ def moveTable(self, table, new_table, new_schema=None):
self._commit()

def createView(self, view, query):
sql = "CREATE VIEW %s AS %s" % (self.quoteId(view), query)
user_input = view

if '.' in user_input: # To allow view creation into specified schema
schema, view_name = user_input.split('.')
sql = "CREATE VIEW %s AS %s" % (self.quoteId([schema, view_name]), query)
else: # No schema specified; uses public
sql = "CREATE VIEW %s AS %s" % (self.quoteId(view), query)
self._execute_and_commit(sql)

def createSpatialView(self, view, query):
Expand Down

0 comments on commit ccdd612

Please sign in to comment.