diff --git a/src/hive_fork_manager/update.sql b/src/hive_fork_manager/update.sql
index 4b44c8ac867b543d37d5b6410b5a455c49c464f3..40842d021c3e8be5f63605341e9cce45f233f427 100644
--- a/src/hive_fork_manager/update.sql
+++ b/src/hive_fork_manager/update.sql
@@ -326,10 +326,13 @@ AS
 $BODY$
 BEGIN
 
-    RETURN QUERY SELECT (hive_update.calculate_table_schema_hash( 'hafd', table_name)).*
-    FROM information_schema.tables
-    WHERE table_schema = 'hafd'
-    AND table_type = 'BASE TABLE';
+    RETURN QUERY SELECT (hive_update.calculate_table_schema_hash( 'hafd', ist.table_name)).*
+    FROM information_schema.tables ist
+    LEFT JOIN hafd.state_providers_registered spr ON ist.table_name ILIKE ANY( spr.tables )
+    WHERE ist.table_schema = 'hafd'
+    AND ist.table_type = 'BASE TABLE'
+    AND spr.tables IS NULL
+    AND ist.table_name NOT ILIKE 'shadow_hafd_%'; -- shadow tables, only possible for state providers
 END;
 $BODY$
 ;
diff --git a/tests/integration/functional/hive_fork_manager/test_update_script.sh b/tests/integration/functional/hive_fork_manager/test_update_script.sh
index 0834cbe5a50ae137b02a882d68c8b26faaf63b5a..58a39c0f3a86de41c6f9ed9d12f2897d4bb6c122 100755
--- a/tests/integration/functional/hive_fork_manager/test_update_script.sh
+++ b/tests/integration/functional/hive_fork_manager/test_update_script.sh
@@ -276,4 +276,13 @@ exec_sql "CREATE OR REPLACE FUNCTION hive.start_provider_keyauth( _context hafd.
              ;"
 failswith 1 update_database
 
+
+printf "\nTEST: Use state provider. This should pass\n"
+prepare_database
+exec_sql "CREATE SCHEMA workaround;
+          SELECT hive.app_create_context('workaround', 'workaround');
+          SELECT hive.app_state_provider_import( 'KEYAUTH', 'workaround' );
+          "
+update_database
+
 echo "Succeeded"