Re: char 0x00

From: Brett Okken <brett(dot)okken(dot)os(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-docs(at)lists(dot)postgresql(dot)org, Dave Cramer <davecramer(at)gmail(dot)com>
Subject: Re: char 0x00
Date: 2020-03-26 14:28:54
Message-ID: CANBJVOH+SL8d7D4buSOv9=H18KLCQf2r1GC7bfUnwC4NGgF6_Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Using a client and server encoding of SQL_ASCII makes it possible to get
0x00 into a text value column when using a bind variable.

Thanks,

Brett

On Thu, Mar 26, 2020 at 9:22 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Brett Okken <brett(dot)okken(dot)os(at)gmail(dot)com> writes:
> > 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).
>
> Uh, it's not supported *anywhere*, period. If you managed to get the
> server to accept a text string with an embedded NUL, I'd like to know
> how exactly, because that's a missed validation.
>
> As far as documentation goes, I'd be inclined to address the point
> in the page about string data types,
>
> https://www.postgresql.org/docs/current/datatype-character.html
>
> with text along the lines of "The contents of a string value must be
> validly encoded according to the database's encoding, and cannot include
> the character with code zero". I'd sort of thought we said that there
> already, but I don't see it.
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2020-03-26 15:21:52 Re: char 0x00
Previous Message Tom Lane 2020-03-26 14:22:06 Re: char 0x00