jackc / pgtype

MIT License
314 stars 112 forks source link

incorrect escaping of newlines (\n) in QuoteArrayElementIfNeeded #86

Open stephane-martin opened 3 years ago

stephane-martin commented 3 years ago

hello,

there: https://github.com/jackc/pgtype/blob/master/array.go#L351

it escapes when the argument starts or ends with a space, but it doesn't escape when the argument starts or ends with a newline

it has manifested in our product in the way that a line was not updated by an INSERT query with a WHERE clause involving TextArray, where as it should have been updated.

maybe there is the same problem with other "space like" characters, such as '\t'.