-
Notifications
You must be signed in to change notification settings - Fork 323
Closed
Description
Given the following code:
await sql`create table tester (name text unique, age int)`
const r1 = await sql`insert into tester (name, age) values ('postgres', 1)`.describe()
const r2 = await sql`insert into tester (name, age) values ('postgres', 1)`.describe()
everything seems to work fine
But, changing it to use .unsafe
instead, will actually run these inserts into the database, and in this specific case - will fail on the second run due to a unique constraint.
Reproduction:
t('Describe an unsafe insert statement with unique constraint', async() => {
const q = "insert into tester (name, age) values ('postgres', 1)";
await sql`create table tester (name text unique, age int)`
await sql.unsafe(q).describe()
await sql.unsafe(q).describe()
return [undefined, undefined, await sql`drop table tester`]
})
Metadata
Metadata
Assignees
Labels
No labels