# sql() function · @imqueue/pg-prisma

Source: https://imqueue.org/api/pg-prisma/latest/pg-prisma.sql/
Published: 2026-08-28
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/pg-prisma 2.0.0 — generated reference, not hand-written

SQL as a tagged template, with everything interpolated bound.

**Signature:**

```typescript
export declare function sql(strings: TemplateStringsArray, ...values: unknown[]): SqlFragment;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| strings | TemplateStringsArray | The literal parts of the template. |
| values | unknown\[\] | What was interpolated between them. |


**Returns:**

[SqlFragment](https://imqueue.org/api/pg-prisma/latest/pg-prisma.sqlfragment/)

The statement and its values.

## Remarks

This is what `Prisma.sql` was, and it exists for the same reason: a column cannot be a bind parameter, so a query built from a caller's choices has to be assembled — and assembling it by concatenation is how an injection gets written. Everything interpolated is bound unless it is itself a fragment, in which case it is spliced and its own placeholders renumbered.

Use [raw()](https://imqueue.org/api/pg-prisma/latest/pg-prisma.raw/) for the parts that genuinely cannot be bound, and read its warning first.

## Example


```typescript
const rows = await pool.query(
    ...toQuery(sql`SELECT * FROM "User" WHERE id = ${id}`),
);
```

