File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
src/main/java/com/google/cloud/spanner/pgadapter Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class JdbcMetadataStatementHelper {
3636 static boolean isPotentialJdbcMetadataStatement (String sql ) {
3737 // All JDBC metadata queries that need any replacements reference the pg_catalog schema or the
3838 // pg_settings table.
39- return sql .contains ("pg_catalog." ) || sql .contains ("pg_settings" );
39+ return sql .contains ("pg_catalog." ) || sql .contains ("pg_settings" ) || sql . contains ( "pg_class" ) ;
4040 }
4141
4242 static String replaceJdbcMetadataStatement (String sql ) {
@@ -146,6 +146,9 @@ static String replaceJdbcMetadataStatement(String sql) {
146146 if (sql .startsWith (PgJdbcCatalog .PG_JDBC_GET_TYPE_INFO_SIMPLE_PREFIX_42_3 )) {
147147 return PgJdbcCatalog .PG_JDBC_GET_TYPE_INFO_REPLACEMENT_42_3 ;
148148 }
149+ if (sql .startsWith (PgJdbcCatalog .PG_JDBC_GET_SEQUENCES )) {
150+ return PgJdbcCatalog .PG_JDBC_GET_SEQUENCES_REPLACEMENT ;
151+ }
149152
150153 // The query that is used to fetch the primary keys of a table was re-written when the PG driver
151154 // went from 42.2.x to 42.3.x. We translate the 42.3.x query back to the 42.2.x version here,
Original file line number Diff line number Diff line change @@ -965,4 +965,9 @@ public class PgJdbcCatalog {
965965 + "inner join pg_catalog.pg_class rel on a.attrelid=rel.oid\n "
966966 + "inner join pg_catalog.pg_namespace n on rel.relnamespace=n.oid\n "
967967 + "inner join information_schema.columns c on n.nspname=c.table_schema and rel.relname=c.table_name and a.attname=c.column_name\n " ;
968+
969+ public static final String PG_JDBC_GET_SEQUENCES =
970+ "select relname from pg_class where relkind='S'" ;
971+ public static final String PG_JDBC_GET_SEQUENCES_REPLACEMENT =
972+ "select ''::varchar as relname LIMIT 0" ;
968973}
You can’t perform that action at this time.
0 commit comments