question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Postgres] Handling NULL bytes

See original GitHub issue

SQL:

INSERT INTO "content"(
    "name"
)
VALUES
    (
        'happy\u0000',
    );

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:38 (33 by maintainers)

github_iconTop GitHub Comments

3reactions
yocontracommented, Sep 5, 2017

Not stale, keep it open.

1reaction
frogcjncommented, Aug 24, 2016

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found