I discovered today, to my horror, that Postgres accepts newline characters inside single- and double-quoted string literals:
postgres=# select 'a
postgres'# b';
┌──────────┐
│ ?column? │
├──────────┤
│ a ↵│
│ b │
└──────────┘
(1 row)
This lead to a really confusing syntax error today in a query with a typo:
SELECT "updateFields"->>'enumTypeName"
FROM input
...
I wish Postgres would report a syntax error at the end of the line after 'enumTypeName"
instead of in a random location way down in the query...is there any way to turn off tolerating newlines inside non-$$
-quoted string literals? It does more harm than good.
There is not a possibility in standard Postgres. But you can write a own extension and assign it to post analyze hook, and proposed check can be implemented there.
I don't know any database, that disallow new line in the string.