Splits Postgres SQL strings into statements by semicolons, correctly handling string literals, dollar-quoting, nested comments, and identifiers. Version 0.1.2 is stable. Uses sticky RegExps for efficient parsing. Ships TypeScript types. Minimal alternative to full SQL parsers for statement splitting.
npm install postgres-semicolonsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Splits SQL containing tricky semicolons (nested comments, dollar-quoting, escape strings) into non-empty statements.
Set to `true` unless you have `standard_conforming_strings = off` in Postgres.
Manually ensure Unicode escapes are not confused with string boundaries.
Avoid nested dollar tags; use distinct tag names.
Use `nonEmptyStatements` to trim whitespace or manually trim.
Ensure input SQL is syntactically correct, or catch errors from parseSplits.
Check that parseSplits returns an object with a 'positions' property. Verify arguments.
Use valid Postgres dollar-quote tags (alpha start, alphanumeric+underscore).
No dependency data recorded yet.