prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  `mathesar_temp_schema` should be hidden
  ## Description
  <!-- A clear and concise description of what the bug is. -->
  
  Currently, the system schema `mathesar_temp_schema` is returned as a standard schema, and ends up displayed as a result in the UI.  This is confusing, since that schema is used for system operations, and shouldn't be available to the user.
  
  ## Expected behavior
  <!-- A clear and concise description of what you expected to happen. -->
  
  The schema `mathesar_temp_schema` should be hidden.
  
  ## To Reproduce
  <!-- How can we recreate this bug? Please try to provide a Minimal, Complete, and Verifiable (http://stackoverflow.com/help/mcve) example if code-related. -->
  
  After starting the service and doing type inference on at least one CSV loading into a table, go to `http://localhost:8000/api/v0/schemas/`.  Note that `mathesar_temp_schema` will be one of the schemata in the `mathesar_tables` DB.
  
  ## Additional context
  <!-- Add any other context about the problem or screenshots here. -->
  
  We're already hiding some schemata, e.g., `mathesar_types`.  The implementer should figure out where the list of such schemata is, and add `mathesar_temp_schema` to that list.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `db/tables/operations/infer_types.py`
  Content:
  ```
  1 from time import time
  2 
  3 from sqlalchemy import select
  4 
  5 from db import constants
  6 from db.columns.base import MathesarColumn
  7 from db.columns.operations.infer_types import infer_column_type
  8 from db.schemas.operations.create import create_schema
  9 from db.tables.operations.create import CreateTableAs
  10 from db.tables.operations.select import reflect_table
  11 
  12 
  13 TEMP_SCHEMA = f"{constants.MATHESAR_PREFIX}temp_schema"
  14 TEMP_TABLE = f"{constants.MATHESAR_PREFIX}temp_table_%s"
  15 
  16 
  17 def update_table_column_types(schema, table_name, engine):
  18     table = reflect_table(table_name, schema, engine)
  19     # we only want to infer (modify) the type of non-default columns
  20     inferable_column_names = (
  21         col.name for col in table.columns
  22         if not MathesarColumn.from_column(col).is_default
  23         and not col.primary_key
  24         and not col.foreign_keys
  25     )
  26     for column_name in inferable_column_names:
  27         infer_column_type(
  28             schema,
  29             table_name,
  30             column_name,
  31             engine,
  32         )
  33 
  34 
  35 def infer_table_column_types(schema, table_name, engine):
  36     table = reflect_table(table_name, schema, engine)
  37 
  38     temp_name = TEMP_TABLE % (int(time()))
  39     create_schema(TEMP_SCHEMA, engine)
  40     with engine.begin() as conn:
  41         while engine.dialect.has_table(conn, temp_name, schema=TEMP_SCHEMA):
  42             temp_name = TEMP_TABLE.format(int(time()))
  43 
  44     full_temp_name = f"{TEMP_SCHEMA}.{temp_name}"
  45 
  46     select_table = select(table)
  47     with engine.begin() as conn:
  48         conn.execute(CreateTableAs(full_temp_name, select_table))
  49     temp_table = reflect_table(temp_name, TEMP_SCHEMA, engine)
  50 
  51     try:
  52         update_table_column_types(
  53             TEMP_SCHEMA, temp_table.name, engine,
  54         )
  55     except Exception as e:
  56         # Ensure the temp table is deleted
  57         temp_table.drop()
  58         raise e
  59     else:
  60         temp_table = reflect_table(temp_name, TEMP_SCHEMA, engine)
  61         types = [c.type.__class__ for c in temp_table.columns]
  62         temp_table.drop()
  63         return types
  64
  ```
  
  Path: `db/schemas/operations/select.py`
  Content:
  ```
  1 import warnings
  2 
  3 from sqlalchemy import MetaData, select, and_, not_, or_, Table
  4 
  5 from db import types
  6 
  7 
  8 TYPES_SCHEMA = types.base.SCHEMA
  9 EXCLUDED_SCHEMATA = [TYPES_SCHEMA, "information_schema"]
  10 
  11 
  12 def reflect_schema(engine, name=None, oid=None):
  13     # If we have both arguments, the behavior is undefined.
  14     try:
  15         assert name is None or oid is None
  16     except AssertionError as e:
  17         raise e
  18     metadata = MetaData()
  19     with warnings.catch_warnings():
  20         warnings.filterwarnings("ignore", message="Did not recognize type")
  21         pg_namespace = Table("pg_namespace", metadata, autoload_with=engine)
  22     sel = (
  23         select(pg_namespace.c.oid, pg_namespace.c.nspname.label("name"))
  24         .where(or_(pg_namespace.c.nspname == name, pg_namespace.c.oid == oid))
  25     )
  26     with engine.begin() as conn:
  27         schema_info = conn.execute(sel).fetchone()
  28     return schema_info
  29 
  30 
  31 def get_mathesar_schemas_with_oids(engine):
  32     metadata = MetaData()
  33     with warnings.catch_warnings():
  34         warnings.filterwarnings("ignore", message="Did not recognize type")
  35         pg_namespace = Table("pg_namespace", metadata, autoload_with=engine)
  36     sel = (
  37         select(pg_namespace.c.nspname.label('schema'), pg_namespace.c.oid)
  38         .where(
  39             and_(
  40                 *[pg_namespace.c.nspname != schema for schema in EXCLUDED_SCHEMATA],
  41                 not_(pg_namespace.c.nspname.like("pg_%"))
  42             )
  43         )
  44     )
  45     with engine.begin() as conn:
  46         result = conn.execute(sel).fetchall()
  47     return result
  48
  ```
  
  Path: `db/constants.py`
  Content:
  ```
  1 MATHESAR_PREFIX = "mathesar_"
  2 ID = "id"
  3 ID_ORIGINAL = "id_original"
  4
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/db/constants.py b/db/constants.py
  --- a/db/constants.py
  +++ b/db/constants.py
  @@ -1,3 +1,4 @@
   MATHESAR_PREFIX = "mathesar_"
   ID = "id"
   ID_ORIGINAL = "id_original"
  +INFERENCE_SCHEMA = f"{MATHESAR_PREFIX}inference_schema"
  diff --git a/db/schemas/operations/select.py b/db/schemas/operations/select.py
  --- a/db/schemas/operations/select.py
  +++ b/db/schemas/operations/select.py
  @@ -2,11 +2,12 @@
   
   from sqlalchemy import MetaData, select, and_, not_, or_, Table
   
  +from db import constants
   from db import types
   
  -
   TYPES_SCHEMA = types.base.SCHEMA
  -EXCLUDED_SCHEMATA = [TYPES_SCHEMA, "information_schema"]
  +TEMP_INFER_SCHEMA = constants.INFERENCE_SCHEMA
  +EXCLUDED_SCHEMATA = [TYPES_SCHEMA, TEMP_INFER_SCHEMA, "information_schema"]
   
   
   def reflect_schema(engine, name=None, oid=None):
  diff --git a/db/tables/operations/infer_types.py b/db/tables/operations/infer_types.py
  --- a/db/tables/operations/infer_types.py
  +++ b/db/tables/operations/infer_types.py
  @@ -10,7 +10,7 @@
   from db.tables.operations.select import reflect_table
   
   
  -TEMP_SCHEMA = f"{constants.MATHESAR_PREFIX}temp_schema"
  +TEMP_SCHEMA = constants.INFERENCE_SCHEMA
   TEMP_TABLE = f"{constants.MATHESAR_PREFIX}temp_table_%s"
  
verification_info: {"golden_diff": "diff --git a/db/constants.py b/db/constants.py\n--- a/db/constants.py\n+++ b/db/constants.py\n@@ -1,3 +1,4 @@\n MATHESAR_PREFIX = \"mathesar_\"\n ID = \"id\"\n ID_ORIGINAL = \"id_original\"\n+INFERENCE_SCHEMA = f\"{MATHESAR_PREFIX}inference_schema\"\ndiff --git a/db/schemas/operations/select.py b/db/schemas/operations/select.py\n--- a/db/schemas/operations/select.py\n+++ b/db/schemas/operations/select.py\n@@ -2,11 +2,12 @@\n \n from sqlalchemy import MetaData, select, and_, not_, or_, Table\n \n+from db import constants\n from db import types\n \n-\n TYPES_SCHEMA = types.base.SCHEMA\n-EXCLUDED_SCHEMATA = [TYPES_SCHEMA, \"information_schema\"]\n+TEMP_INFER_SCHEMA = constants.INFERENCE_SCHEMA\n+EXCLUDED_SCHEMATA = [TYPES_SCHEMA, TEMP_INFER_SCHEMA, \"information_schema\"]\n \n \n def reflect_schema(engine, name=None, oid=None):\ndiff --git a/db/tables/operations/infer_types.py b/db/tables/operations/infer_types.py\n--- a/db/tables/operations/infer_types.py\n+++ b/db/tables/operations/infer_types.py\n@@ -10,7 +10,7 @@\n from db.tables.operations.select import reflect_table\n \n \n-TEMP_SCHEMA = f\"{constants.MATHESAR_PREFIX}temp_schema\"\n+TEMP_SCHEMA = constants.INFERENCE_SCHEMA\n TEMP_TABLE = f\"{constants.MATHESAR_PREFIX}temp_table_%s\"\n", "issue": "`mathesar_temp_schema` should be hidden\n## Description\r\n<!-- A clear and concise description of what the bug is. -->\r\n\r\nCurrently, the system schema `mathesar_temp_schema` is returned as a standard schema, and ends up displayed as a result in the UI.  This is confusing, since that schema is used for system operations, and shouldn't be available to the user.\r\n\r\n## Expected behavior\r\n<!-- A clear and concise description of what you expected to happen. -->\r\n\r\nThe schema `mathesar_temp_schema` should be hidden.\r\n\r\n## To Reproduce\r\n<!-- How can we recreate this bug? Please try to provide a Minimal, Complete, and Verifiable (http://stackoverflow.com/help/mcve) example if code-related. -->\r\n\r\nAfter starting the service and doing type inference on at least one CSV loading into a table, go to `http://localhost:8000/api/v0/schemas/`.  Note that `mathesar_temp_schema` will be one of the schemata in the `mathesar_tables` DB.\r\n\r\n## Additional context\r\n<!-- Add any other context about the problem or screenshots here. -->\r\n\r\nWe're already hiding some schemata, e.g., `mathesar_types`.  The implementer should figure out where the list of such schemata is, and add `mathesar_temp_schema` to that list.\n", "before_files": [{"content": "from time import time\n\nfrom sqlalchemy import select\n\nfrom db import constants\nfrom db.columns.base import MathesarColumn\nfrom db.columns.operations.infer_types import infer_column_type\nfrom db.schemas.operations.create import create_schema\nfrom db.tables.operations.create import CreateTableAs\nfrom db.tables.operations.select import reflect_table\n\n\nTEMP_SCHEMA = f\"{constants.MATHESAR_PREFIX}temp_schema\"\nTEMP_TABLE = f\"{constants.MATHESAR_PREFIX}temp_table_%s\"\n\n\ndef update_table_column_types(schema, table_name, engine):\n    table = reflect_table(table_name, schema, engine)\n    # we only want to infer (modify) the type of non-default columns\n    inferable_column_names = (\n        col.name for col in table.columns\n        if not MathesarColumn.from_column(col).is_default\n        and not col.primary_key\n        and not col.foreign_keys\n    )\n    for column_name in inferable_column_names:\n        infer_column_type(\n            schema,\n            table_name,\n            column_name,\n            engine,\n        )\n\n\ndef infer_table_column_types(schema, table_name, engine):\n    table = reflect_table(table_name, schema, engine)\n\n    temp_name = TEMP_TABLE % (int(time()))\n    create_schema(TEMP_SCHEMA, engine)\n    with engine.begin() as conn:\n        while engine.dialect.has_table(conn, temp_name, schema=TEMP_SCHEMA):\n            temp_name = TEMP_TABLE.format(int(time()))\n\n    full_temp_name = f\"{TEMP_SCHEMA}.{temp_name}\"\n\n    select_table = select(table)\n    with engine.begin() as conn:\n        conn.execute(CreateTableAs(full_temp_name, select_table))\n    temp_table = reflect_table(temp_name, TEMP_SCHEMA, engine)\n\n    try:\n        update_table_column_types(\n            TEMP_SCHEMA, temp_table.name, engine,\n        )\n    except Exception as e:\n        # Ensure the temp table is deleted\n        temp_table.drop()\n        raise e\n    else:\n        temp_table = reflect_table(temp_name, TEMP_SCHEMA, engine)\n        types = [c.type.__class__ for c in temp_table.columns]\n        temp_table.drop()\n        return types\n", "path": "db/tables/operations/infer_types.py"}, {"content": "import warnings\n\nfrom sqlalchemy import MetaData, select, and_, not_, or_, Table\n\nfrom db import types\n\n\nTYPES_SCHEMA = types.base.SCHEMA\nEXCLUDED_SCHEMATA = [TYPES_SCHEMA, \"information_schema\"]\n\n\ndef reflect_schema(engine, name=None, oid=None):\n    # If we have both arguments, the behavior is undefined.\n    try:\n        assert name is None or oid is None\n    except AssertionError as e:\n        raise e\n    metadata = MetaData()\n    with warnings.catch_warnings():\n        warnings.filterwarnings(\"ignore\", message=\"Did not recognize type\")\n        pg_namespace = Table(\"pg_namespace\", metadata, autoload_with=engine)\n    sel = (\n        select(pg_namespace.c.oid, pg_namespace.c.nspname.label(\"name\"))\n        .where(or_(pg_namespace.c.nspname == name, pg_namespace.c.oid == oid))\n    )\n    with engine.begin() as conn:\n        schema_info = conn.execute(sel).fetchone()\n    return schema_info\n\n\ndef get_mathesar_schemas_with_oids(engine):\n    metadata = MetaData()\n    with warnings.catch_warnings():\n        warnings.filterwarnings(\"ignore\", message=\"Did not recognize type\")\n        pg_namespace = Table(\"pg_namespace\", metadata, autoload_with=engine)\n    sel = (\n        select(pg_namespace.c.nspname.label('schema'), pg_namespace.c.oid)\n        .where(\n            and_(\n                *[pg_namespace.c.nspname != schema for schema in EXCLUDED_SCHEMATA],\n                not_(pg_namespace.c.nspname.like(\"pg_%\"))\n            )\n        )\n    )\n    with engine.begin() as conn:\n        result = conn.execute(sel).fetchall()\n    return result\n", "path": "db/schemas/operations/select.py"}, {"content": "MATHESAR_PREFIX = \"mathesar_\"\nID = \"id\"\nID_ORIGINAL = \"id_original\"\n", "path": "db/constants.py"}], "after_files": [{"content": "from time import time\n\nfrom sqlalchemy import select\n\nfrom db import constants\nfrom db.columns.base import MathesarColumn\nfrom db.columns.operations.infer_types import infer_column_type\nfrom db.schemas.operations.create import create_schema\nfrom db.tables.operations.create import CreateTableAs\nfrom db.tables.operations.select import reflect_table\n\n\nTEMP_SCHEMA = constants.INFERENCE_SCHEMA\nTEMP_TABLE = f\"{constants.MATHESAR_PREFIX}temp_table_%s\"\n\n\ndef update_table_column_types(schema, table_name, engine):\n    table = reflect_table(table_name, schema, engine)\n    # we only want to infer (modify) the type of non-default columns\n    inferable_column_names = (\n        col.name for col in table.columns\n        if not MathesarColumn.from_column(col).is_default\n        and not col.primary_key\n        and not col.foreign_keys\n    )\n    for column_name in inferable_column_names:\n        infer_column_type(\n            schema,\n            table_name,\n            column_name,\n            engine,\n        )\n\n\ndef infer_table_column_types(schema, table_name, engine):\n    table = reflect_table(table_name, schema, engine)\n\n    temp_name = TEMP_TABLE % (int(time()))\n    create_schema(TEMP_SCHEMA, engine)\n    with engine.begin() as conn:\n        while engine.dialect.has_table(conn, temp_name, schema=TEMP_SCHEMA):\n            temp_name = TEMP_TABLE.format(int(time()))\n\n    full_temp_name = f\"{TEMP_SCHEMA}.{temp_name}\"\n\n    select_table = select(table)\n    with engine.begin() as conn:\n        conn.execute(CreateTableAs(full_temp_name, select_table))\n    temp_table = reflect_table(temp_name, TEMP_SCHEMA, engine)\n\n    try:\n        update_table_column_types(\n            TEMP_SCHEMA, temp_table.name, engine,\n        )\n    except Exception as e:\n        # Ensure the temp table is deleted\n        temp_table.drop()\n        raise e\n    else:\n        temp_table = reflect_table(temp_name, TEMP_SCHEMA, engine)\n        types = [c.type.__class__ for c in temp_table.columns]\n        temp_table.drop()\n        return types\n", "path": "db/tables/operations/infer_types.py"}, {"content": "import warnings\n\nfrom sqlalchemy import MetaData, select, and_, not_, or_, Table\n\nfrom db import constants\nfrom db import types\n\nTYPES_SCHEMA = types.base.SCHEMA\nTEMP_INFER_SCHEMA = constants.INFERENCE_SCHEMA\nEXCLUDED_SCHEMATA = [TYPES_SCHEMA, TEMP_INFER_SCHEMA, \"information_schema\"]\n\n\ndef reflect_schema(engine, name=None, oid=None):\n    # If we have both arguments, the behavior is undefined.\n    try:\n        assert name is None or oid is None\n    except AssertionError as e:\n        raise e\n    metadata = MetaData()\n    with warnings.catch_warnings():\n        warnings.filterwarnings(\"ignore\", message=\"Did not recognize type\")\n        pg_namespace = Table(\"pg_namespace\", metadata, autoload_with=engine)\n    sel = (\n        select(pg_namespace.c.oid, pg_namespace.c.nspname.label(\"name\"))\n        .where(or_(pg_namespace.c.nspname == name, pg_namespace.c.oid == oid))\n    )\n    with engine.begin() as conn:\n        schema_info = conn.execute(sel).fetchone()\n    return schema_info\n\n\ndef get_mathesar_schemas_with_oids(engine):\n    metadata = MetaData()\n    with warnings.catch_warnings():\n        warnings.filterwarnings(\"ignore\", message=\"Did not recognize type\")\n        pg_namespace = Table(\"pg_namespace\", metadata, autoload_with=engine)\n    sel = (\n        select(pg_namespace.c.nspname.label('schema'), pg_namespace.c.oid)\n        .where(\n            and_(\n                *[pg_namespace.c.nspname != schema for schema in EXCLUDED_SCHEMATA],\n                not_(pg_namespace.c.nspname.like(\"pg_%\"))\n            )\n        )\n    )\n    with engine.begin() as conn:\n        result = conn.execute(sel).fetchall()\n    return result\n", "path": "db/schemas/operations/select.py"}, {"content": "MATHESAR_PREFIX = \"mathesar_\"\nID = \"id\"\nID_ORIGINAL = \"id_original\"\nINFERENCE_SCHEMA = f\"{MATHESAR_PREFIX}inference_schema\"\n", "path": "db/constants.py"}]}