Thread: BUG #14428: decode function don't return correct value when executed from agent's job or external program

VGhlIGZvbGxvd2luZyBidWcgaGFzIGJlZW4gbG9nZ2VkIG9uIHRoZSB3ZWJz
aXRlOgoKQnVnIHJlZmVyZW5jZTogICAgICAxNDQyOApMb2dnZWQgYnk6ICAg
ICAgICAgIFZhZGltIEJvY2hrb3YKRW1haWwgYWRkcmVzczogICAgICB2Ym9j
aGtvdkBlYXN0d2luZC5ydQpQb3N0Z3JlU1FMIHZlcnNpb246IDkuNS41Ck9w
ZXJhdGluZyBzeXN0ZW06ICAgQ2VudE9TIDcuMgpEZXNjcmlwdGlvbjogICAg
ICAgIAoKV2UgaGF2ZSB0ZXN0IHN0b3JlZCBmdW5jdGlvbiANCkNSRUFURSAg
RlVOQ1RJT04gZGVjb2RlX3Rlc3QoKQ0KICBSRVRVUk5TIGludGVnZXIgQVMN
CkJFR0lOICANCmluc2VydCBpbnRvIHRlc3QyKHR4dCkNCnNlbGVjdCBkZWNv
ZGUoJzMwMzQzMTM0JywnaGV4Jyk6OnZhcmNoYXIoODAwMCk7DQpyZXR1cm4g
MDsNCg0KV2hlbiB3ZSBleGVjdXRlIGl0IGZyb20gcHNxbCBjb21tYW5kIHBy
b21wdCB2YWx1ZSAiMDQxNCIgaXMgaW5zZXNydGVkIGluCnRhYmxlLiBXaGVu
IHdlIGV4ZWN1dGUgZnVuY3Rpb24gZnJvbSBhZ2VudCBqb2IgIHZhbHVlICLR
hTMwMzQzMTM0IiBpcwppbnNlcnRlZCBpbiB0YWJsZS4NCkZ1bmN0aW9uIGRl
Y29kZSgpIGlzIGRldGVybWluaXN0aWMsIGJ1dCByZXN1bHQgaXMgbm90IHRo
ZSBzYW1lLiBJdCdzIGJ1Zy4KCg==
On Fri, Nov 18, 2016 at 3:49 AM, <vbochkov@eastwind.ru> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      14428
> Logged by:          Vadim Bochkov
> Email address:      vbochkov@eastwind.ru
> PostgreSQL version: 9.5.5
> Operating system:   CentOS 7.2
> Description:
>
> We have test stored function
> CREATE  FUNCTION decode_test()
>   RETURNS integer AS
> BEGIN
> insert into test2(txt)
> select decode('30343134','hex')::varchar(8000);
> return 0;
>
> When we execute it from psql command prompt value "0414" is insesrted in
> table. When we execute function from agent job  value "=D1=8530343134" is
> inserted in table.
> Function decode() is deterministic, but result is not the same. It's bug.
>
>
N
=E2=80=8Bot a bug - different configurations in the two environments.

See bytea_output

=E2=80=8B
https://www.postgresql.org/docs/9.5/static/runtime-config-client.html

=E2=80=8BDavid J.=E2=80=8B