Skip to content

useReturning is not correctly set for the SQLite DB dialect #14193

@WalkingPizza

Description

@WalkingPizza

Bug report

Required System information

  • Node.js version: v16.16.0
  • Yarn version: 1.22.19
  • Strapi version: 4.3.4
  • Database: SQLite
  • Operating system: MacOS 12

Describe the bug

The SQLite Dialect class does not definite a useReturning method, which defaults the value to false even though SQLite does support RETURNING statements.

This causes a series of issues, including insert queries not returning IDs appropriately from the query builder.

Steps to reproduce the behavior

  1. Launch a test Strapi instance with SQLite.
  2. Edit the entity-manager.js file to console.log the result of await this.createQueryBuilder(uid).insert(dataToInsert).execute().
  3. Try calling strapi.db.query(<UID>).createMany({ data: [<ENTRIES>] }).
  4. Notice how the line from step 2 is only returning one of the multiple IDs it should be returning.

Expected behavior

useReturning should be defined so that it returns true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked aroundsource: core:databaseSource is core/database packagestatus: confirmedConfirmed by a Strapi Team member or multiple community members

    Type

    No type

    Projects

    Status

    Archived

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions