Repository: mathesar-foundation/mathesar

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.


Discussion:

Resolving patch:
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"
 
 


Test patch:
diff --git a/db/tests/schemas/operations/test_select.py b/db/tests/schemas/operations/test_select.py
--- a/db/tests/schemas/operations/test_select.py
+++ b/db/tests/schemas/operations/test_select.py
@@ -2,6 +2,7 @@
 from sqlalchemy import select, Table, MetaData
 
 from db import types
+from db.tables.operations import infer_types
 from db.schemas.operations.select import get_mathesar_schemas_with_oids
 
 
@@ -20,13 +21,19 @@ def test_get_mathesar_schemas_with_oids_avoids_pg_schemas(engine_with_schema):
 def test_get_mathesar_schemas_with_oids_avoids_information_schema(engine_with_schema):
     engine, schema = engine_with_schema
     actual_schemas = get_mathesar_schemas_with_oids(engine)
-    assert all([schema != "information_schema" for schema, oid in actual_schemas])
+    assert all([schema != "information_schema" for schema, _ in actual_schemas])
 
 
 def test_get_mathesar_schemas_with_oids_avoids_types_schema(engine_with_schema):
     engine, schema = engine_with_schema
     actual_schemas = get_mathesar_schemas_with_oids(engine)
-    assert all([schema != types.base.SCHEMA for schema, oid in actual_schemas])
+    assert all([schema != types.base.SCHEMA for schema, _ in actual_schemas])
+
+
+def test_get_mathesar_schemas_with_oids_avoids_temp_schema(engine_with_schema):
+    engine, schema = engine_with_schema
+    actual_schemas = get_mathesar_schemas_with_oids(engine)
+    assert all([schema != infer_types.TEMP_SCHEMA for schema, _ in actual_schemas])
 
 
 def test_get_mathesar_schemas_with_oids_gets_correct_oid(engine_with_schema):