# formatSql() function · @imqueue/pg-sequelize

Source: https://imqueue.org/api/pg-sequelize/latest/pg-sequelize.formatsql/
Published: 2026-08-01
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/pg-sequelize 4.2.0 — generated reference, not hand-written

Reformats a SQL string for logging, when [SQL\_PRETTIFY](https://imqueue.org/api/pg-sequelize/latest/pg-sequelize.sql_prettify/) is on.

**Signature:**

```typescript
export declare function formatSql(sql: string): string;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| sql | string | Statement as sequelize reports it. |


**Returns:**

string

The reformatted statement, or `sql` unchanged when prettifying is off.

## Remarks

A pass-through when prettifying is off, so it is always safe to call. Otherwise `sql-formatter` does the work and a handful of substitutions tidy up what it does to Postgres-specific syntax — casts, `&&`, and bind-parameter markers, which the formatter would otherwise break across lines.

For logs only. It is not a parser and the result is not guaranteed to be executable.

