-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
Postgres supports dollar quoted strings as an alternative to regular '<text>' strings. This is useful when you need to include the ' character itself but don't want to escape it.
The official documentation can be found here
Unfortunately, pg-minify's parser does not appear to support this.
Steps to reproduce
const minify = require('pg-minify');
const sql = `
comment on schema "public" is $$
It's an apostrophe!
$$;
`;
console.log(minify(sql));Expected behavior
comment on schema "public" is $$ It's an apostrophe! $$;Actual behavior
<src>/node_modules/pg-minify/lib/parser.js:186
throw new SQLParsingError(code, position);
^
SQLParsingError: Error parsing SQL at {line:3,col:5}: Unclosed text block.
at throwError (<src>/node_modules/pg-minify/lib/parser.js:186:15)
at minify (<src>/node_modules/pg-minify/lib/parser.js:124:17)
at Object.<anonymous> (<src>/index.js:9:13)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Module._load (node:internal/modules/cjs/loader:827:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
error: 'Unclosed text block.',
code: 1,
position: { line: 3, column: 5 }
}
Environment
- Version of pg-minify: 1.6.4
- OS type (Linux/Windows/Mac): Linux
- Version of Node.js: 18.0.0
Reactions are currently unavailable