File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3061,9 +3061,16 @@ export async function updateColumnConstraints(
30613061 requestId : string
30623062) : Promise < TableDefinition > {
30633063 return withLockedTable ( data . tableId , async ( table , trx ) => {
3064- await setTableTxTimeouts ( trx , {
3065- statementMs : scaledStatementTimeoutMs ( table . rowCount ?? 0 , { baseMs : 60_000 , perRowMs : 2 } ) ,
3064+ // Scale both statement and idle timeouts to row count: the required/unique
3065+ // validation runs between separate queries inside this transaction, leaving
3066+ // it briefly idle. Match `updateColumnType` so the default 5s
3067+ // `idle_in_transaction_session_timeout` can't abort a valid change on a
3068+ // large table.
3069+ const timeoutMs = scaledStatementTimeoutMs ( table . rowCount ?? 0 , {
3070+ baseMs : 60_000 ,
3071+ perRowMs : 2 ,
30663072 } )
3073+ await setTableTxTimeouts ( trx , { statementMs : timeoutMs , idleMs : timeoutMs } )
30673074
30683075 const schema = table . schema
30693076 const columnIndex = schema . columns . findIndex (
You can’t perform that action at this time.
0 commit comments