pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Non working example
4+ messages / 3 participants
[nested] [flat]

* Non working example
@ 2019-06-29 10:45 PG Doc comments form <noreply@postgresql.org>
  2019-07-01 09:02 ` Re: Non working example Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 4+ messages in thread

From: PG Doc comments form @ 2019-06-29 10:45 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: maarten@vgijssel.nl

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


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Non working example
  2019-06-29 10:45 Non working example PG Doc comments form <noreply@postgresql.org>
@ 2019-07-01 09:02 ` Daniel Gustafsson <daniel@yesql.se>
  2019-07-01 10:19   ` Re: Non working example Maarten van Gijssel <maarten@vgijssel.nl>
  0 siblings, 1 reply; 4+ messages in thread

From: Daniel Gustafsson @ 2019-07-01 09:02 UTC (permalink / raw)
  To: maarten@vgijssel.nl; pgsql-docs@lists.postgresql.org

> 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




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Non working example
  2019-06-29 10:45 Non working example PG Doc comments form <noreply@postgresql.org>
  2019-07-01 09:02 ` Re: Non working example Daniel Gustafsson <daniel@yesql.se>
@ 2019-07-01 10:19   ` Maarten van Gijssel <maarten@vgijssel.nl>
  2019-07-01 10:28     ` Re: Non working example Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 4+ messages in thread

From: Maarten van Gijssel @ 2019-07-01 10:19 UTC (permalink / raw)
  To: Daniel Gustafsson <daniel@yesql.se>; +Cc: pgsql-docs@lists.postgresql.org

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

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Non working example
  2019-06-29 10:45 Non working example PG Doc comments form <noreply@postgresql.org>
  2019-07-01 09:02 ` Re: Non working example Daniel Gustafsson <daniel@yesql.se>
  2019-07-01 10:19   ` Re: Non working example Maarten van Gijssel <maarten@vgijssel.nl>
@ 2019-07-01 10:28     ` Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 0 replies; 4+ messages in thread

From: Daniel Gustafsson @ 2019-07-01 10:28 UTC (permalink / raw)
  To: Maarten van Gijssel <maarten@vgijssel.nl>; +Cc: pgsql-docs@lists.postgresql.org

> On 1 Jul 2019, at 12:19, Maarten van Gijssel <maarten@vgijssel.nl> wrote:
> 
> 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.

Aha, there we go.

> Sorry, my mistake!

No worries at all.

cheers ./daniel




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2019-07-01 10:28 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-06-29 10:45 Non working example PG Doc comments form <noreply@postgresql.org>
2019-07-01 09:02 ` Daniel Gustafsson <daniel@yesql.se>
2019-07-01 10:19   ` Maarten van Gijssel <maarten@vgijssel.nl>
2019-07-01 10:28     ` Daniel Gustafsson <daniel@yesql.se>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox