[Postgres] Handling NULL bytes
See original GitHub issueSQL:
INSERT INTO "content"(
"name"
)
VALUES
(
'happy\u0000',
);
Issue Analytics
- State:
- Created 7 years ago
- Comments:38 (33 by maintainers)
Top Results From Across the Web
Are null bytes allowed in unicode strings in PostgreSQL via ...
Python itself is perfectly capable of having both byte strings and Unicode strings with null characters having a value of zero.
Read more >Null Characters: Workarounds Aren't Good Enough
But today I'm here to discuss something that PostgreSQL can't do: handle null characters (also known as zero bytes) in text values.
Read more >Strings with null characters produce exceptions ... - PostgreSQL
Strings with null characters produce exceptions when selected or inserted. Attempts to select messages with null bytes produces "ERROR: ...
Read more >Null characters in Postgres: workarounds aren't good enough
A null byte in a json string may be intentional if perhaps questionable. JSON strings are frequently abused for various transport formats.
Read more >How NULL and empty strings are treated in PostgreSQL vs ...
What is interesting here is that, in Oracle, concatenating a NULL and a character together results in the character as the output value,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Not stale, keep it open.
@contra, it is serious problem. since PG does not give a wonderful solution, it just throws an error, I think sequelize should do something. At least to validate the text, or replace \u0000 to “” for TEXT and JSONB fields, as the code I wrote.