Addressing Issue #35767 to allow for view creation into specified schema from [ Create a view ] in DBManager

This commit is contained in:
gisn8 2024-10-04 11:41:56 -04:00 committed by Nyall Dawson
parent 72b493b1d7
commit 70e9694a12

View File

@ -1014,7 +1014,13 @@ class PostGisDBConnector(DBConnector):
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):