# query.safeSqlSpaceCleanup() function · @imqueue/pg-sequelize

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

Collapses whitespace outside quoted literals, so a statement fits on one line.

**Signature:**

```typescript
export function safeSqlSpaceCleanup(input: string): string;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| input | string | Statement to normalise. |


**Returns:**

string

The statement with structural whitespace collapsed to single spaces.

## Remarks

Walks the string tracking whether a single quote is open, so runs of whitespace inside a literal are preserved and only structural whitespace is collapsed. Quote tracking is a simple toggle: it does not understand escaped or doubled quotes, so a literal containing one can throw the parity off.

