Skip to content

Toucan2 insert-returning-instance! Not Returning Inserted Record in MySQL #204

@AliSafiya

Description

@AliSafiya

I’m using Toucan2 with MySQL and running insert-returning-instance! to insert a new record while expecting it to return the inserted row. However, instead of getting the full record, the function only returns nil.

Debug Output Shows:

SELECT * FROM table_name WHERE id IN (NULL)
This suggests Toucan2 isn’t correctly capturing the generated ID from the insert.

When testing the same operation in PostgreSQL, the function correctly returns the full inserted row.

Expected Behavior:

  • insert-returning-instance! should return the inserted row as a map.

Actual Behavior:

  • The function doesn’t return the inserted record.
  • Debug logs show that a follow-up SELECT query is being run but incorrectly attempts to fetch the row with WHERE id IN (NULL).
  • My primary key (id) is auto-incremented, but Toucan2 isn’t capturing the generated key correctly.

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