Skip to content

Commit f426b11

Browse files
mpscholtenclaude
andcommitted
Fix sqlExecDiscardResult to use Decoders.noResult instead of rowsAffected
sqlExecDiscardResult was delegating to sqlExec which uses sqlExecHasqlCount (Decoders.rowsAffected). This fails for SQL commands like SET CONSTRAINTS ... DEFERRED that don't return a row count in their command tag, causing UnexpectedResultStatementError "Empty bytes". Now delegates to sqlExecHasql which uses Decoders.noResult instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 319b515 commit f426b11

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ihp/IHP/ModelSupport.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,9 @@ sqlExec theQuery theParameters = do
300300
-- > sqlExecDiscardResult "CREATE TABLE users ()" ()
301301
sqlExecDiscardResult :: (?modelContext :: ModelContext, ToSnippetParams q) => Query -> q -> IO ()
302302
sqlExecDiscardResult theQuery theParameters = do
303-
_ <- sqlExec theQuery theParameters
304-
pure ()
303+
let pool = ?modelContext.hasqlPool
304+
let snippet = sqlToSnippet (fromQuery theQuery) (toSnippetParams theParameters)
305+
sqlExecHasql pool snippet
305306
{-# INLINABLE sqlExecDiscardResult #-}
306307

307308

0 commit comments

Comments
 (0)