Re: Non working example - Mailing list pgsql-docs

From Maarten van Gijssel
Subject Re: Non working example
Date
Msg-id CAK45R1suL2BiRCcd_3tt-nPU8+pJ8B8Mv=5MybZO6WepbEccvQ@mail.gmail.com
Whole thread Raw
In response to Re: Non working example  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: Non working example
List pgsql-docs
After I posted the question, I realised my mistake 😅. I was using the pg gem in Ruby to run the SQL "SELECT encode('123\000\001', 'base64')", the double quotes ensure the `\0` will be interpreted as a null byte hence throwing the error. Sorry, my mistake!

Regards,
Maarten

Op ma 1 jul. 2019 om 11:02 schreef Daniel Gustafsson <daniel@yesql.se>:
> On 29 Jun 2019, at 12:45, PG Doc comments form <noreply@postgresql.org> wrote:
>
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/10/functions-string.html
> Description:
>
> Either I'm doing something wrong or the example `encode('123\000\001',
> 'base64')` will always result in a parsing error "string contains null
> byte”.

I think it’s something in the former category, the example works fine:

db=# select encode('123\000\001', 'base64');
  encode
----------
 MTIzAAE=
(1 row)

How are you executing the example, via psql, another client or in some other
way?  Is the data perhaps being in some preprocessed along the way before it
reaches postgres?  If you copy/paste it in psql, does that work?

cheers ./daniel

pgsql-docs by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: Non working example
Next
From: Daniel Gustafsson
Date:
Subject: Re: Non working example