char 0x00 - Mailing list pgsql-docs

From Brett Okken
Subject char 0x00
Date
Msg-id CANBJVOH31rJxU=6wYULRyRVg6QfbgWRrFPrxUw1Ss20CR+rcBQ@mail.gmail.com
Whole thread Raw
Responses Re: char 0x00  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-docs
There was a lot of a discussion recently on a pgjdbc issue[1] started by a user who was experiencing errors trying to insert string values containing the 0x00 char into text columns. We ultimately concluded that while this could be forced to work for SQL_ASCII, postgresql does not intend to support that character in text. I think it could be helpful to make that a bit clearer in the documentation.
For example, in the note[2] on SQL_ASCII, it currently states:

[T]he server interprets byte values 0-127 according to the ASCII standard, while byte values 128-255 are taken as uninterpreted characters...

It might be clearer to state:

[T]he server interprets byte values 1-127 according to the ASCII standard, while byte values 0 and 128-255 are taken as uninterpreted characters...

It might also be helpful to state in the opening paragraph about character set support that the NUL character is not supported in any character set (except SQL_ASCII).


The one place I found documentation on the 0x00 character is around string constants[3]. At the very bottom of section 4.1.2.2 String Constants with C-Style escapes it states:

The character with the code zero cannot be in a string constant.

I think it would be helpful to move that statement up to 4.1.2.1 String Constants, making it clearer that applies to all String Constants, not just c-style escapes.

Finally, I think it would be helpful to add a similar note to the Character Types[4] page so that it is clear that the String Constant limitation applies to the character data types as well.


While I have contributed some to the pgjdbc project, this is my first interaction with the postgresql community. Please let me know if there is another forum/mechansim I should be using to make these suggestions.

Thanks,

Brett

pgsql-docs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: optionally schema-qualified for table_name
Next
From: Tom Lane
Date:
Subject: Re: char 0x00