prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Issues with installation process that connects an existing DB
  - [x] Tester Marius reports (server credentials in Upwork)
    - [ ] It seems that even if you select existing database, it still tries to start a docker container for the database, creating a conflict?
  - [x] Tester Mohammad reports an error as well ([details here](https://docs.google.com/document/d/15m9eZFocAsU1V9inLKxC6i_KQxMdu28snRrBPOrf5Hk/edit))
  
  </issue>
  <code>
  [start of db/install.py]
  1 from sqlalchemy import text
  2 from sqlalchemy.exc import OperationalError
  3 
  4 from db import engine
  5 from db.types import install
  6 
  7 
  8 def install_mathesar(
  9         database_name, username, password, hostname, port, skip_confirm
  10 ):
  11     """Create database and install Mathesar on it."""
  12     user_db_engine = engine.create_future_engine(
  13         username, password, hostname, database_name, port,
  14         connect_args={"connect_timeout": 10}
  15     )
  16     try:
  17         user_db_engine.connect()
  18         print(f"Installing Mathesar on preexisting PostgreSQL database {database_name} at host {hostname}...")
  19         install.install_mathesar_on_database(user_db_engine)
  20         user_db_engine.dispose()
  21     except OperationalError:
  22         database_created = _create_database(
  23             database_name=database_name,
  24             hostname=hostname,
  25             username=username,
  26             password=password,
  27             port=port,
  28             skip_confirm=skip_confirm
  29         )
  30         if database_created:
  31             print(f"Installing Mathesar on PostgreSQL database {database_name} at host {hostname}...")
  32             install.install_mathesar_on_database(user_db_engine)
  33             user_db_engine.dispose()
  34         else:
  35             print(f"Skipping installing on DB with key {database_name}.")
  36 
  37 
  38 def _create_database(database_name, hostname, username, password, port, skip_confirm=True):
  39     if skip_confirm is True:
  40         create_database = "y"
  41     else:
  42         create_database = input(
  43             f"Create a new Database called {database_name}? (y/n) > "
  44         )
  45     if create_database.lower() in ["y", "yes"]:
  46         # We need to connect to an existing database inorder to create a new Database.
  47         # So we use the default Database `postgres` that comes with postgres.
  48         # TODO Throw correct error when the default postgres database does not exists(which is very rare but still possible)
  49         root_database = "postgres"
  50         root_db_engine = engine.create_future_engine(
  51             username, password, hostname, root_database, port,
  52             connect_args={"connect_timeout": 10}
  53         )
  54         with root_db_engine.connect() as conn:
  55             conn.execution_options(isolation_level="AUTOCOMMIT")
  56             conn.execute(text(f"CREATE DATABASE {database_name}"))
  57         root_db_engine.dispose()
  58         print(f"Created DB is {database_name}.")
  59         return True
  60     else:
  61         print(f"Database {database_name} not created!")
  62         return False
  63
  [end of db/install.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/db/install.py b/db/install.py
  --- a/db/install.py
  +++ b/db/install.py
  @@ -53,7 +53,7 @@
           )
           with root_db_engine.connect() as conn:
               conn.execution_options(isolation_level="AUTOCOMMIT")
  -            conn.execute(text(f"CREATE DATABASE {database_name}"))
  +            conn.execute(text(f'CREATE DATABASE "{database_name}"'))
           root_db_engine.dispose()
           print(f"Created DB is {database_name}.")
           return True
  
verification_info: {"golden_diff": "diff --git a/db/install.py b/db/install.py\n--- a/db/install.py\n+++ b/db/install.py\n@@ -53,7 +53,7 @@\n         )\n         with root_db_engine.connect() as conn:\n             conn.execution_options(isolation_level=\"AUTOCOMMIT\")\n-            conn.execute(text(f\"CREATE DATABASE {database_name}\"))\n+            conn.execute(text(f'CREATE DATABASE \"{database_name}\"'))\n         root_db_engine.dispose()\n         print(f\"Created DB is {database_name}.\")\n         return True\n", "issue": "Issues with installation process that connects an existing DB\n- [x] Tester Marius reports (server credentials in Upwork)\r\n  - [ ] It seems that even if you select existing database, it still tries to start a docker container for the database, creating a conflict?\r\n- [x] Tester Mohammad reports an error as well ([details here](https://docs.google.com/document/d/15m9eZFocAsU1V9inLKxC6i_KQxMdu28snRrBPOrf5Hk/edit))\n", "before_files": [{"content": "from sqlalchemy import text\nfrom sqlalchemy.exc import OperationalError\n\nfrom db import engine\nfrom db.types import install\n\n\ndef install_mathesar(\n        database_name, username, password, hostname, port, skip_confirm\n):\n    \"\"\"Create database and install Mathesar on it.\"\"\"\n    user_db_engine = engine.create_future_engine(\n        username, password, hostname, database_name, port,\n        connect_args={\"connect_timeout\": 10}\n    )\n    try:\n        user_db_engine.connect()\n        print(f\"Installing Mathesar on preexisting PostgreSQL database {database_name} at host {hostname}...\")\n        install.install_mathesar_on_database(user_db_engine)\n        user_db_engine.dispose()\n    except OperationalError:\n        database_created = _create_database(\n            database_name=database_name,\n            hostname=hostname,\n            username=username,\n            password=password,\n            port=port,\n            skip_confirm=skip_confirm\n        )\n        if database_created:\n            print(f\"Installing Mathesar on PostgreSQL database {database_name} at host {hostname}...\")\n            install.install_mathesar_on_database(user_db_engine)\n            user_db_engine.dispose()\n        else:\n            print(f\"Skipping installing on DB with key {database_name}.\")\n\n\ndef _create_database(database_name, hostname, username, password, port, skip_confirm=True):\n    if skip_confirm is True:\n        create_database = \"y\"\n    else:\n        create_database = input(\n            f\"Create a new Database called {database_name}? (y/n) > \"\n        )\n    if create_database.lower() in [\"y\", \"yes\"]:\n        # We need to connect to an existing database inorder to create a new Database.\n        # So we use the default Database `postgres` that comes with postgres.\n        # TODO Throw correct error when the default postgres database does not exists(which is very rare but still possible)\n        root_database = \"postgres\"\n        root_db_engine = engine.create_future_engine(\n            username, password, hostname, root_database, port,\n            connect_args={\"connect_timeout\": 10}\n        )\n        with root_db_engine.connect() as conn:\n            conn.execution_options(isolation_level=\"AUTOCOMMIT\")\n            conn.execute(text(f\"CREATE DATABASE {database_name}\"))\n        root_db_engine.dispose()\n        print(f\"Created DB is {database_name}.\")\n        return True\n    else:\n        print(f\"Database {database_name} not created!\")\n        return False\n", "path": "db/install.py"}]}