decode, base64 problem

Поиск
Список
Период
Сортировка
От gmail Vladimir Koković
Тема decode, base64 problem
Дата
Msg-id 59057a0b-530e-16aa-dea7-b0444d5ed5aa@gmail.com
обсуждение исходный текст
Ответы Re: decode, base64 problem  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: decode, base64 problem  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-novice

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.


I have a table that has a "lice" field that is of type byte and the following 5 selects:

1. OK

2. error !

3. error ?

4. error ?
5. error !!!


1 -------------------------------------------------------

select

substring(encode(lice,'base64'), 110, 5) as Lokal0,
length(substring(encode(lice,'base64'), 110, 5)) as Len05

from grupa002.ispp_partner
where obrisan=0 and maticnibroj=30643;

 lokal0 | len05
--------+-------
 ICAgI  |     5
(1 row)


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

3. -------------------------------------------------------

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: unexpected "="
LOCATION:  b64_decode, encode.c:295

4. -------------------------------------------------------

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: unexpected "="
LOCATION:  b64_decode, encode.c:295

5. -------------------------------------------------------

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) || '=='*/'ICAgI','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?


Vladimir Kokovic, DP senior (69)
Serbia, Belgrade, May 22, 2020


В списке pgsql-novice по дате отправления:

Предыдущее
От: Nam Nguyen
Дата:
Сообщение: connect to postgresql Server via two gateway Traffic Server instancesusing explicit proxying
Следующее
От: Tom Lane
Дата:
Сообщение: Re: decode, base64 problem