Skip to content

undefined parameter passed to PreparedStatementInfo.execute cause rollback to get stuck #3293

@dolphinxx

Description

@dolphinxx

The following code gets stuck at conn.rollback(). If I change the undefined parameter to null(name is not nullable), it rolls back as expected. I know the parameters should not be undefined, but there is always a chance of accidents.

await conn.beginTransaction();
    try {
      const stmt = await conn.prepare("INSERT INTO foo(name)VALUES(?)");
      try {
        await stmt.execute([undefined]);
      } finally {
        await stmt.close();
      }
      console.log('commiting...');
      await conn.commit();
      console.log('committed.');
    } catch (e) {
      console.error(e);
      console.log('rolling back...');
      await conn.rollback();
      console.log('rolled back.');
    } finally {
      conn.release();
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions