Re: decode, base64 problem

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: gmail Vladimir Koković <vladimir(dot)kokovic(at)gmail(dot)com>
Cc: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: decode, base64 problem
Date: 2020-05-22 16:04:51
Message-ID: CAKFQuwY1HbbdR8Jq5SSoR3B92UcqDe4PHjh0Y8pYRkMYjNt-Rg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, May 22, 2020 at 8:49 AM gmail Vladimir Koković <
vladimir(dot)kokovic(at)gmail(dot)com> wrote:

> Hi,
>
> I don't know what this is about, so I could get from someone who knows
> more PostgreSQL than I do,
>
> some rational explanation of what the problem is.
>
> 2 -------------------------------------------------------
>
> select
>
> substring(encode(lice,'base64'), 110, 5) as Lokal0,
> length(substring(encode(lice,'base64'), 110, 5)) as Len05,
>
> decode(substring(encode(lice,'base64'), 110, 5),'base64') as Lokal0decode
>
> from grupa002.ispp_partner
> where obrisan=0 and maticnibroj=30643;
>
> ERROR: 22023: invalid end sequence
> LOCATION: b64_decode, encode.c:327
>
My question is how to make a decode for a field for which encode text is
> known and the length is 5?
>
What makes you believe that you should be able to get a decoded result
after you've corrupted the encoded data? You no longer have an encoded
value, of any length, after doing substring - you now just have a sequence
of five characters chosen from a subset of ASCII.

David J.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message gmail Vladimir Koković 2020-05-22 16:24:24 Re: decode, base64 problem
Previous Message Tom Lane 2020-05-22 15:57:13 Re: decode, base64 problem