Repository: GoogleCloudPlatform/pgadapter
Pull request #1565 (2024-03-20 16:00:17)

build(deps): update testcontainers requirement from ~=4.0.1 to ~=4.1.1 in /samples/python/psycopg3
Updates the requirements on [testcontainers](https://github.com/testcontainers/testcontainers-python) to permit the latest version.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/testcontainers/testcontainers-python/commits">compare view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/samples/python/psycopg3/requirements.txt b/samples/python/psycopg3/requirements.txt
index cc9232fb..5d2a97be 100644
--- a/samples/python/psycopg3/requirements.txt
+++ b/samples/python/psycopg3/requirements.txt
@@ -1,4 +1,4 @@
 psycopg~=3.1.18
-testcontainers~=4.0.1
+testcontainers~=4.1.1
 google~=3.0.0
 google.auth~=2.28.2
\ No newline at end of file
diff --git a/src/main/java/com/google/cloud/spanner/pgadapter/statements/PgCatalog.java b/src/main/java/com/google/cloud/spanner/pgadapter/statements/PgCatalog.java
index 3e60c318..58141d73 100644
--- a/src/main/java/com/google/cloud/spanner/pgadapter/statements/PgCatalog.java
+++ b/src/main/java/com/google/cloud/spanner/pgadapter/statements/PgCatalog.java
@@ -797,7 +797,7 @@ public class PgCatalog {
             + "                 group by c.constraint_catalog, c.constraint_schema,\n"
             + "                          c.constraint_name) fck on tc.constraint_catalog=fck.constraint_catalog and tc.constraint_schema=fck.constraint_schema and tc.constraint_name=fck.constraint_name\n"
             + "left outer join information_schema.check_constraints cc on cc.constraint_catalog=tc.constraint_catalog and cc.constraint_schema=tc.constraint_schema and cc.constraint_name=tc.constraint_name\n"
-            + "where tc.constraint_schema='public' and not substr(tc.constraint_name, 1, length('CK_IS_NOT_NULL_')) = 'CK_IS_NOT_NULL_'\n"
+            + "where tc.constraint_schema not in (select schema_name from information_schema.schemata where schema_owner='spanner_system') and not substr(tc.constraint_name, 1, length('CK_IS_NOT_NULL_')) = 'CK_IS_NOT_NULL_'\n"
             + ")";
 
     public static final String EMPTY_PG_CONSTRAINT_CTE =
diff --git a/src/main/resources/metadata/default_command_metadata.json b/src/main/resources/metadata/default_command_metadata.json
index 7249045c..7e711d23 100644
--- a/src/main/resources/metadata/default_command_metadata.json
+++ b/src/main/resources/metadata/default_command_metadata.json
@@ -154,7 +154,7 @@
     },
     {
       "input_pattern": "^SELECT n\\.nspname as \"[^\"]*\",[ \n]+c\\.relname as \"[^\"]*\",[ \n]+CASE c\\.relkind (WHEN '.' THEN '[^']*' )+END as \"[^\"]*\",[ \n]+pg_catalog\\.pg_get_userbyid\\(c\\.relowner\\) as \"[^\"]*\"\nFROM pg_catalog\\.pg_class c[ \n]+LEFT JOIN pg_catalog\\.pg_namespace n ON n\\.oid = c\\.relnamespace\nWHERE c\\.relkind IN \\('r'(?:,'p')?(?:,'t')?,'s',''\\)[ \n]+AND (?:n\\.nspname !~ '\\^pg_toast'[ \n]+AND )?c\\.relname OPERATOR\\(pg_catalog\\.~\\) '\\^\\((?<tablename>.*)\\)\\$'[ \n]+AND pg_catalog\\.pg_table_is_visible\\(c\\.oid\\)\nORDER BY 1,2;?$",
-      "output_pattern": "SELECT * FROM information_schema.tables WHERE LOWER(table_name) = LOWER('%s');",
+      "output_pattern": "SELECT * FROM information_schema.tables WHERE table_schema='public' AND LOWER(table_name) = LOWER('%s');",
       "matcher_array": [
         "tablename"
       ],
@@ -162,7 +162,7 @@
     },
     {
       "input_pattern": "(?s)^SELECT n\\.nspname as \"Schema\",\\s*c\\.relname as \"Name\",\\s*CASE c.relkind .* END as \"Type\",\\s*pg_catalog\\.pg_get_userbyid\\(c\\.relowner\\) as \"Owner\"\\s+FROM pg_catalog\\.pg_class c\\s+LEFT JOIN pg_catalog\\.pg_namespace n ON n\\.oid = c\\.relnamespace\\s+LEFT JOIN pg_catalog\\.pg_am am ON am\\.oid = c\\.relam\\s+WHERE c\\.relkind IN \\('r','p','t','s',''\\)\\s+AND c.relname OPERATOR\\(pg_catalog\\.~\\) '\\^\\((?<tablename>.*)\\)\\$' COLLATE pg_catalog\\.default\\s+AND pg_catalog\\.pg_table_is_visible\\(c\\.oid\\)\nORDER BY 1,2;?$",
-      "output_pattern": "SELECT * FROM information_schema.tables WHERE LOWER(table_name) = LOWER('%s');",
+      "output_pattern": "SELECT * FROM information_schema.tables WHERE table_schema='public' AND LOWER(table_name) = LOWER('%s');",
       "matcher_array": [
         "tablename"
       ],
@@ -170,7 +170,7 @@
     },
     {
       "input_pattern": "(?s)^SELECT n\\.nspname as \"Schema\",\\s*c\\.relname as \"Name\",\\s*CASE c.relkind .* END as \"Type\",\\s*pg_catalog\\.pg_get_userbyid\\(c\\.relowner\\) as \"Owner\"\\s+FROM pg_catalog\\.pg_class c\\s+LEFT JOIN pg_catalog\\.pg_namespace n ON n\\.oid = c.relnamespace\\s+WHERE c.relkind IN \\('r','p','s',''\\)\\s+AND n\\.nspname !~ '\\^pg_toast'\\s+AND c\\.relname OPERATOR\\(pg_catalog\\.~\\) '\\^\\((?<tablename>.*)\\)\\$' COLLATE pg_catalog\\.default\\s+AND pg_catalog\\.pg_table_is_visible\\(c.oid\\)\\s+ORDER BY 1,2;?$",
-      "output_pattern": "SELECT * FROM information_schema.tables WHERE LOWER(table_name) = LOWER('%s');",
+      "output_pattern": "SELECT * FROM information_schema.tables WHERE table_schema='public' AND LOWER(table_name) = LOWER('%s');",
       "matcher_array": [
         "tablename"
       ],
@@ -184,7 +184,7 @@
     },
     {
       "input_pattern": "^SELECT n\\.nspname as \"[^\"]*\",[ \n]+c\\.relname as \"[^\"]*\",[ \n]+CASE c\\.relkind (WHEN '.' THEN '[^']*' )+END as \"[^\"]*\",[ \n]+pg_catalog\\.pg_get_userbyid\\(c\\.relowner\\) as \"[^\"]*\",[ \n]+c2\\.relname as \"[^\"]*\"\nFROM pg_catalog\\.pg_class c[ \n]+LEFT JOIN pg_catalog\\.pg_namespace n ON n\\.oid = c\\.relnamespace\\s+(?:LEFT JOIN pg_catalog\\.pg_am am ON am\\.oid = c.relam\\s+)?LEFT JOIN pg_catalog\\.pg_index i ON i\\.indexrelid = c\\.oid[ \n]+LEFT JOIN pg_catalog\\.pg_class c2 ON i\\.indrelid = c2\\.oid\nWHERE c\\.relkind IN \\('i'(?:,'I')?,'s',''\\)[ \n]+AND (?:n\\.nspname !~ '\\^pg_toast'[ \n]+AND )?c\\.relname OPERATOR\\(pg_catalog\\.~\\) '\\^\\((?<indexname>.*)\\)\\$'[ \n]+AND pg_catalog\\.pg_table_is_visible\\(c\\.oid\\)\nORDER BY 1,2;?$",
-      "output_pattern": "SELECT table_catalog, table_schema, table_name, index_name, index_type, parent_table_name, is_unique, is_null_filtered, index_state, spanner_is_managed FROM information_schema.indexes WHERE LOWER(index_name) = LOWER('%s');",
+      "output_pattern": "SELECT table_catalog, table_schema, table_name, index_name, index_type, parent_table_name, is_unique, is_null_filtered, index_state, spanner_is_managed FROM information_schema.indexes WHERE table_schema='public' AND LOWER(index_name) = LOWER('%s');",
       "matcher_array": [
         "indexname"
       ],
@@ -192,7 +192,7 @@
     },
     {
       "input_pattern": "(?s)^SELECT n\\.nspname as \"Schema\",\\s*c\\.relname as \"Name\",\\s*CASE c\\.relkind WHEN .* END as \"Type\",\\s*pg_catalog\\.pg_get_userbyid\\(c\\.relowner\\) as \"Owner\",\\s*c2\\.relname as \"Table\"\\s+FROM pg_catalog\\.pg_class c\\s+LEFT JOIN pg_catalog\\.pg_namespace n ON n\\.oid = c\\.relnamespace(?:\\s+LEFT JOIN pg_catalog\\.pg_am am ON am\\.oid = c\\.relam)?\\s+LEFT JOIN pg_catalog\\.pg_index i ON i\\.indexrelid = c\\.oid\\s+LEFT JOIN pg_catalog\\.pg_class c2 ON i\\.indrelid = c2.oid\\s+WHERE c\\.relkind IN \\('i','I','s',''\\)\\s+AND n\\.nspname !~ '\\^pg_toast'\\s+AND c\\.relname OPERATOR\\(pg_catalog\\.~\\) '\\^\\((?<indexname>.*)\\)\\$' COLLATE pg_catalog\\.default\\s+AND pg_catalog\\.pg_table_is_visible\\(c\\.oid\\)\\s+ORDER BY 1,2;?$",
-      "output_pattern": "SELECT table_catalog, table_schema, table_name, index_name, index_type, parent_table_name, is_unique, is_null_filtered, index_state, spanner_is_managed FROM information_schema.indexes WHERE LOWER(index_name) = LOWER('%s');",
+      "output_pattern": "SELECT table_catalog, table_schema, table_name, index_name, index_type, parent_table_name, is_unique, is_null_filtered, index_state, spanner_is_managed FROM information_schema.indexes WHERE table_schema='public' AND LOWER(index_name) = LOWER('%s');",
       "matcher_array": [
         "indexname"
       ],
@@ -200,7 +200,7 @@
     },
     {
       "input_pattern": "(?s)^SELECT n\\.nspname as \"Schema\",\\s*c\\.relname as \"Name\",\\s*CASE c\\.relkind WHEN .* END as \"Type\",\\s*pg_catalog\\.pg_get_userbyid\\(c\\.relowner\\) as \"Owner\",\\s*c2\\.relname as \"Table\"\\s+FROM pg_catalog\\.pg_class c\\s+LEFT JOIN pg_catalog\\.pg_namespace n ON n\\.oid = c\\.relnamespace\\s+LEFT JOIN pg_catalog\\.pg_am am ON am.oid = c\\.relam\\s+LEFT JOIN pg_catalog\\.pg_index i ON i\\.indexrelid = c\\.oid\\s+LEFT JOIN pg_catalog\\.pg_class c2 ON i\\.indrelid = c2\\.oid\\s+WHERE c\\.relkind IN \\('i','I','s',''\\)\\s+AND c\\.relname OPERATOR\\(pg_catalog\\.~\\) '\\^\\((?<indexname>.*)\\)\\$' COLLATE pg_catalog\\.default\\s+AND pg_catalog\\.pg_table_is_visible\\(c\\.oid\\)\\s+ORDER BY 1,2;?$",
-      "output_pattern": "SELECT table_catalog, table_schema, table_name, index_name, index_type, parent_table_name, is_unique, is_null_filtered, index_state, spanner_is_managed FROM information_schema.indexes WHERE LOWER(index_name) = LOWER('%s');",
+      "output_pattern": "SELECT table_catalog, table_schema, table_name, index_name, index_type, parent_table_name, is_unique, is_null_filtered, index_state, spanner_is_managed FROM information_schema.indexes WHERE table_schema='public' AND LOWER(index_name) = LOWER('%s');",
       "matcher_array": [
         "indexname"
       ],
@@ -238,7 +238,7 @@
     },
     {
       "input_pattern": "^SELECT pg_catalog\\.quote_ident\\(attname\\)[ \n]+FROM pg_catalog\\.pg_attribute a, pg_catalog\\.pg_class c[ \n]+WHERE c\\.oid = a\\.attrelid[ \n]+AND a\\.attnum > \\d+[ \n]+AND NOT a\\.attisdropped[ \n]+AND substring\\(pg_catalog\\.quote_ident\\(attname\\),\\d+,\\d+\\)='(?<attrprefix>.*)'[ \n]+AND \\(pg_catalog\\.quote_ident\\(relname\\)='(?<tablename>.*)'[ \n]+OR '\"' \\|\\| relname \\|\\| '\"'='.*'\\)[ \n]+AND pg_catalog\\.pg_table_is_visible\\(c\\.oid\\)\nLIMIT 1000$",
-      "output_pattern": "SELECT column_name AS quote_ident FROM information_schema.columns WHERE table_name = '%s' AND STARTS_WITH(LOWER(COLUMN_NAME), LOWER('%s')) LIMIT 1000;",
+      "output_pattern": "SELECT column_name AS quote_ident FROM information_schema.columns WHERE table_schema='public' AND table_name = '%s' AND STARTS_WITH(LOWER(COLUMN_NAME), LOWER('%s')) LIMIT 1000;",
       "matcher_array": [
         "tablename",
         "attrprefix"
@@ -255,7 +255,7 @@
     },
     {
       "input_pattern": "^SELECT pg_catalog\\.quote_ident\\(c\\.relname\\) FROM pg_catalog\\.pg_class c WHERE c\\.relkind IN \\('r', 'p'\\) AND substring\\(pg_catalog\\.quote_ident\\(c\\.relname\\),\\d+,\\d+\\)='(?<prefix>.*)' AND pg_catalog\\.pg_table_is_visible\\(c\\.oid\\) AND c\\.relnamespace <> \\(SELECT oid FROM pg_catalog\\.pg_namespace WHERE nspname = 'pg_catalog'\\)\nUNION\nSELECT pg_catalog\\.quote_ident\\(n\\.nspname\\) \\|\\| '\\.' FROM pg_catalog\\.pg_namespace n WHERE substring\\(pg_catalog\\.quote_ident\\(n\\.nspname\\) \\|\\| '\\.',\\d+,\\d+\\)='(.*) AND \\(SELECT pg_catalog\\.count\\(\\*\\) FROM pg_catalog\\.pg_namespace WHERE substring\\(pg_catalog\\.quote_ident\\(nspname\\) \\|\\| '\\.',\\d+,\\d+\\) = substring\\('(.*),\\d+,pg_catalog\\.length\\(pg_catalog\\.quote_ident\\(nspname\\)\\)\\+\\d+\\)\\) > \\d+\nUNION\nSELECT pg_catalog\\.quote_ident\\(n\\.nspname\\) \\|\\| '\\.' \\|\\| pg_catalog\\.quote_ident\\(c\\.relname\\) FROM pg_catalog\\.pg_class c, pg_catalog\\.pg_namespace n WHERE c\\.relnamespace = n\\.oid AND c\\.relkind IN \\('r', 'p'\\) AND substring\\(pg_catalog\\.quote_ident\\(n\\.nspname\\) \\|\\| '\\.' \\|\\| pg_catalog\\.quote_ident\\(c\\.relname\\),\\d+,\\d+\\)='(.*) AND substring\\(pg_catalog\\.quote_ident\\(n\\.nspname\\) \\|\\| '\\.',\\d+,\\d+\\) = substring\\('(.*),\\d+,pg_catalog\\.length\\(pg_catalog\\.quote_ident\\(n\\.nspname\\)\\)\\+\\d+\\) AND \\(SELECT pg_catalog\\.count\\(\\*\\) FROM pg_catalog\\.pg_namespace WHERE substring\\(pg_catalog\\.quote_ident\\(nspname\\) \\|\\| '\\.',\\d+,\\d+\\) = substring\\('(.*),\\d+,pg_catalog\\.length\\(pg_catalog\\.quote_ident\\(nspname\\)\\)\\+\\d+\\)\\) = \\d+\nLIMIT \\d+$",
-      "output_pattern": "SELECT table_name AS quote_ident FROM INFORMATION_SCHEMA.TABLES WHERE STARTS_WITH(LOWER(table_name), LOWER('%s')) LIMIT 1000;",
+      "output_pattern": "SELECT table_name AS quote_ident FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='public' AND STARTS_WITH(LOWER(table_name), LOWER('%s')) LIMIT 1000;",
       "matcher_array": [
         "prefix"
       ],
@@ -263,7 +263,7 @@
     },
     {
       "input_pattern": "^SELECT pg_catalog\\.quote_ident\\(c\\.relname\\) FROM pg_catalog\\.pg_class c WHERE c\\.relkind IN \\('i', 'I'\\) AND substring\\(pg_catalog\\.quote_ident\\(c\\.relname\\),\\d+,\\d+\\)='(?<prefix>.*)' AND pg_catalog\\.pg_table_is_visible\\(c\\.oid\\) AND c\\.relnamespace <> \\(SELECT oid FROM pg_catalog\\.pg_namespace WHERE nspname = 'pg_catalog'\\)\nUNION\nSELECT pg_catalog\\.quote_ident\\(n\\.nspname\\) \\|\\| '\\.' FROM pg_catalog\\.pg_namespace n WHERE substring\\(pg_catalog\\.quote_ident\\(n\\.nspname\\) \\|\\| '\\.',\\d+,\\d+\\)='(.*)' AND \\(SELECT pg_catalog\\.count\\(\\*\\) FROM pg_catalog\\.pg_namespace WHERE substring\\(pg_catalog\\.quote_ident\\(nspname\\) \\|\\| '\\.',\\d+,\\d+\\) = substring\\('(.*)',\\d+,pg_catalog\\.length\\(pg_catalog\\.quote_ident\\(nspname\\)\\)\\+\\d+\\)\\) > \\d+\nUNION\nSELECT pg_catalog\\.quote_ident\\(n\\.nspname\\) \\|\\| '\\.' \\|\\| pg_catalog\\.quote_ident\\(c\\.relname\\) FROM pg_catalog\\.pg_class c, pg_catalog\\.pg_namespace n WHERE c\\.relnamespace = n\\.oid AND c\\.relkind IN \\('i', 'I'\\) AND substring\\(pg_catalog\\.quote_ident\\(n\\.nspname\\) \\|\\| '\\.' \\|\\| pg_catalog\\.quote_ident\\(c\\.relname\\),\\d+,\\d+\\)='(.*)' AND substring\\(pg_catalog\\.quote_ident\\(n\\.nspname\\) \\|\\| '\\.',\\d+,\\d+\\) = substring\\('(.*)',\\d+,pg_catalog\\.length\\(pg_catalog\\.quote_ident\\(n\\.nspname\\)\\)\\+\\d+\\) AND \\(SELECT pg_catalog\\.count\\(\\*\\) FROM pg_catalog\\.pg_namespace WHERE substring\\(pg_catalog\\.quote_ident\\(nspname\\) \\|\\| '\\.',\\d+,\\d+\\) = substring\\('(.*)',\\d+,pg_catalog\\.length\\(pg_catalog\\.quote_ident\\(nspname\\)\\)\\+\\d+\\)\\) = \\d+\nLIMIT \\d+$",
-      "output_pattern": "SELECT index_name AS quote_ident FROM INFORMATION_SCHEMA.INDEXES WHERE STARTS_WITH(LOWER(index_name), LOWER('%s')) LIMIT 1000;",
+      "output_pattern": "SELECT index_name AS quote_ident FROM INFORMATION_SCHEMA.INDEXES WHERE table_schema='public' AND STARTS_WITH(LOWER(index_name), LOWER('%s')) LIMIT 1000;",
       "matcher_array": [
         "prefix"
       ],


Test patch:
diff --git a/src/test/java/com/google/cloud/spanner/pgadapter/statements/PSQLTest.java b/src/test/java/com/google/cloud/spanner/pgadapter/statements/PSQLTest.java
index 45533ed1..7a65bb7a 100644
--- a/src/test/java/com/google/cloud/spanner/pgadapter/statements/PSQLTest.java
+++ b/src/test/java/com/google/cloud/spanner/pgadapter/statements/PSQLTest.java
@@ -376,7 +376,7 @@ public class PSQLTest {
             + "  AND pg_catalog.pg_table_is_visible(c.oid)\n"
             + "ORDER BY 1,2;";
     String expected =
-        "SELECT * FROM information_schema.tables WHERE LOWER(table_name) = LOWER('users')";
+        "SELECT * FROM information_schema.tables WHERE table_schema='public' AND LOWER(table_name) = LOWER('users')";
 
     assertEquals(expected, translate(sql));
   }
@@ -400,7 +400,7 @@ public class PSQLTest {
             + "  AND pg_catalog.pg_table_is_visible(c.oid)\n"
             + "ORDER BY 1,2;";
     String expected =
-        "SELECT * FROM information_schema.tables WHERE LOWER(table_name) ="
+        "SELECT * FROM information_schema.tables WHERE table_schema='public' AND LOWER(table_name) ="
             + " LOWER('bobby''; DROP TABLE USERS; SELECT''')";
 
     assertEquals(expected, translate(sql));
@@ -456,7 +456,7 @@ public class PSQLTest {
             + "  AND pg_catalog.pg_table_is_visible(c.oid)\n"
             + "ORDER BY 1,2;";
     String expected =
-        "SELECT table_catalog, table_schema, table_name, index_name, index_type, parent_table_name, is_unique, is_null_filtered, index_state, spanner_is_managed FROM information_schema.indexes WHERE LOWER(index_name) ="
+        "SELECT table_catalog, table_schema, table_name, index_name, index_type, parent_table_name, is_unique, is_null_filtered, index_state, spanner_is_managed FROM information_schema.indexes WHERE table_schema='public' AND LOWER(index_name) ="
             + " LOWER('index')";
 
     assertEquals(expected, translate(sql));
@@ -484,7 +484,7 @@ public class PSQLTest {
             + "  AND pg_catalog.pg_table_is_visible(c.oid)\n"
             + "ORDER BY 1,2;";
     String expected =
-        "SELECT table_catalog, table_schema, table_name, index_name, index_type, parent_table_name, is_unique, is_null_filtered, index_state, spanner_is_managed FROM information_schema.indexes WHERE LOWER(index_name) ="
+        "SELECT table_catalog, table_schema, table_name, index_name, index_type, parent_table_name, is_unique, is_null_filtered, index_state, spanner_is_managed FROM information_schema.indexes WHERE table_schema='public' AND LOWER(index_name) ="
             + " LOWER('bobby''; DROP TABLE USERS; SELECT''')";
 
     assertEquals(expected, translate(sql));
@@ -617,7 +617,7 @@ public class PSQLTest {
             + "LIMIT 1000";
     String expected =
         "SELECT column_name AS quote_ident FROM information_schema.columns WHERE"
-            + " table_name = 'user' AND STARTS_WITH(LOWER(COLUMN_NAME), LOWER('age')) LIMIT 1000";
+            + " table_schema='public' AND table_name = 'user' AND STARTS_WITH(LOWER(COLUMN_NAME), LOWER('age')) LIMIT 1000";
 
     assertEquals(expected, translate(sql));
   }
@@ -681,7 +681,7 @@ public class PSQLTest {
             + "LIMIT 1000";
     String expected =
         "SELECT table_name AS quote_ident FROM INFORMATION_SCHEMA.TABLES WHERE"
-            + " STARTS_WITH(LOWER(table_name), LOWER('user')) LIMIT 1000";
+            + " table_schema='public' AND STARTS_WITH(LOWER(table_name), LOWER('user')) LIMIT 1000";
 
     assertEquals(expected, translate(sql));
   }
@@ -713,7 +713,7 @@ public class PSQLTest {
             + "LIMIT 1000";
     String expected =
         "SELECT index_name AS quote_ident FROM INFORMATION_SCHEMA.INDEXES WHERE"
-            + " STARTS_WITH(LOWER(index_name), LOWER('index')) LIMIT 1000";
+            + " table_schema='public' AND STARTS_WITH(LOWER(index_name), LOWER('index')) LIMIT 1000";
 
     assertEquals(expected, translate(sql));
   }