-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: sql expression when
where
parameter is empty array (#9691)
Closes: #9690 Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>
- Loading branch information
1 parent
7726f5a
commit 7df2ccf
Showing
3 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Entity, PrimaryGeneratedColumn } from "../../../../src" | ||
|
||
@Entity() | ||
export class Foo { | ||
@PrimaryGeneratedColumn({ name: "id" }) | ||
id: number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import "reflect-metadata" | ||
import { DataSource } from "../../../src" | ||
import { | ||
closeTestingConnections, | ||
createTestingConnections, | ||
} from "../../utils/test-utils" | ||
import { Foo } from "./entity/Foo" | ||
|
||
describe("github issues > #9690 Incorrect SQL expression if `where` parameter is empty array", () => { | ||
let dataSources: DataSource[] | ||
before(async () => { | ||
dataSources = await createTestingConnections({ | ||
enabledDrivers: ["postgres"], | ||
entities: [Foo], | ||
schemaCreate: true, | ||
dropSchema: true, | ||
}) | ||
}) | ||
after(() => closeTestingConnections(dataSources)) | ||
|
||
it("should run without throw error", () => | ||
Promise.all( | ||
dataSources.map(async (dataSource) => { | ||
const repository = dataSource.getRepository(Foo) | ||
await repository.find({ | ||
where: [], | ||
}) | ||
}), | ||
)) | ||
}) |