Thread
Commits
-
Doc: explain that the string types can't store \0 (ASCII NUL).
- c5ba66077054 13.2 landed
- b4a5d5406594 10.16 landed
- 9a2641911aea 14.0 landed
- 3410a9b57062 9.6.21 landed
- 10c601578a25 11.11 landed
- 101c8ae02cc0 12.6 landed
- 0921b86ca1e4 9.5.25 landed
-
Mention invalid null byte sequence
The Post Office <noreply@postgresql.org> — 2020-12-05T21:58:49Z
The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/13/datatype-character.html Description: I discovered accidentally that PostgreSQL doesn't accept null byte in text type. It seems that Oracle does (see https://www.postgresql.org/message-id/de752e01-f36c-821e-9181-cfba78c0fbc8%40propaas.com) and SQLite does it too. So it should written in the character type that null byte are not accepted, it would make like easier to migrate to PostgreSQL :)
-
Re: Mention invalid null byte sequence
Laurenz Albe <laurenz.albe@cybertec.at> — 2020-12-07T09:02:43Z
On Sat, 2020-12-05 at 21:58 +0000, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/13/datatype-character.html > Description: > > I discovered accidentally that PostgreSQL doesn't accept null byte in text > type. It seems that Oracle does (see > https://www.postgresql.org/message-id/de752e01-f36c-821e-9181-cfba78c0fbc8%40propaas.com) > and SQLite does it too. > > So it should written in the character type that null byte are not accepted, > it would make like easier to migrate to PostgreSQL :) +1; how about the attached patch? Yours, Laurenz Albe
-
Re: Mention invalid null byte sequence
Adrien CLERC <bugs-postgresql@antipoul.fr> — 2020-12-07T09:57:47Z
Le 07/12/2020 à 10:02, Laurenz Albe a écrit : > On Sat, 2020-12-05 at 21:58 +0000, PG Doc comments form wrote: >> The following documentation comment has been logged on the website: >> >> Page: https://www.postgresql.org/docs/13/datatype-character.html >> Description: >> >> I discovered accidentally that PostgreSQL doesn't accept null byte in text >> type. It seems that Oracle does (see >> https://www.postgresql.org/message-id/de752e01-f36c-821e-9181-cfba78c0fbc8%40propaas.com) >> and SQLite does it too. >> >> So it should written in the character type that null byte are not accepted, >> it would make like easier to migrate to PostgreSQL :) > +1; how about the attached patch? That would be a good start indeed. I don't know the policy for documentation redundancy in PostgreSQL, but it should be good to mention that also in https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE since the basic "SELECT E'la\x00la';" will fail while "SELECT E'la\x01la';" will not. And, as a lazy person, I also would like to see it in the general datatype page, since it's a common behavior. Anyway, merging the first patch will enable the search for "NUL character" to return a result, and that will be definitively a nice improvement! Have a nice day! Adrien
-
Re: Mention invalid null byte sequence
Tom Lane <tgl@sss.pgh.pa.us> — 2020-12-07T20:27:22Z
Laurenz Albe <laurenz.albe@cybertec.at> writes: > On Sat, 2020-12-05 at 21:58 +0000, PG Doc comments form wrote: >> The following documentation comment has been logged on the website: >> Page: https://www.postgresql.org/docs/13/datatype-character.html >> Description: >> >> So it should written in the character type that null byte are not accepted, >> it would make like easier to migrate to PostgreSQL :) > +1; how about the attached patch? I had thought that this was already documented, but after digging around I can only find it mentioned in the contexts of saying that literal strings and quoted identifiers can't contain \0. So yeah, we need to improve that. I agree with the submitter that the place one would expect to read about this is in datatype-character.html. So I'd propose the attached. Maybe there's reason to repeat the info in charset.sgml, but it seems like more of a datatype limitation than a character set issue. regards, tom lane
-
Re: Mention invalid null byte sequence
Laurenz Albe <laurenz.albe@cybertec.at> — 2020-12-08T10:34:15Z
On Mon, 2020-12-07 at 15:27 -0500, Tom Lane wrote: > Laurenz Albe <laurenz.albe@cybertec.at> writes: > > On Sat, 2020-12-05 at 21:58 +0000, PG Doc comments form wrote: > > > The following documentation comment has been logged on the website: > > > Page: https://www.postgresql.org/docs/13/datatype-character.html > > > Description: > > > > > > So it should written in the character type that null byte are not accepted, > > > it would make like easier to migrate to PostgreSQL :) > > > > +1; how about the attached patch? > > I had thought that this was already documented, but after digging around > I can only find it mentioned in the contexts of saying that literal > strings and quoted identifiers can't contain \0. So yeah, we need to > improve that. > > I agree with the submitter that the place one would expect to read about > this is in datatype-character.html. So I'd propose the attached. > Maybe there's reason to repeat the info in charset.sgml, but it seems > like more of a datatype limitation than a character set issue. +1 on your patch. Yours, Laurenz Albe
-
Re: Mention invalid null byte sequence
Tom Lane <tgl@sss.pgh.pa.us> — 2020-12-08T17:07:25Z
Laurenz Albe <laurenz.albe@cybertec.at> writes: > On Mon, 2020-12-07 at 15:27 -0500, Tom Lane wrote: >> I agree with the submitter that the place one would expect to read about >> this is in datatype-character.html. So I'd propose the attached. >> Maybe there's reason to repeat the info in charset.sgml, but it seems >> like more of a datatype limitation than a character set issue. > +1 on your patch. Pushed, thanks for looking it over. regards, tom lane