pgcrypto: Remove explicit hex encoding/decoding from tests

Started by Peter Eisentrautover 4 years ago5 messageshackers
Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

pgcrypto tests use encode() and decode() calls to convert to/from hex
encoding. This was from before the hex format was available in bytea.
Now we can remove the extra explicit encoding/decoding calls and rely on
the default output format.

Attachments:

0001-pgcrypto-Remove-explicit-hex-encoding-decoding-from-.patchtext/plain; charset=UTF-8; name=0001-pgcrypto-Remove-explicit-hex-encoding-decoding-from-.patchDownload+820-872
#2Daniel Gustafsson
daniel@yesql.se
In reply to: Peter Eisentraut (#1)
Re: pgcrypto: Remove explicit hex encoding/decoding from tests

On 2 Dec 2021, at 10:22, Peter Eisentraut <peter.eisentraut@enterprisedb.com> wrote:

pgcrypto tests use encode() and decode() calls to convert to/from hex encoding. This was from before the hex format was available in bytea. Now we can remove the extra explicit encoding/decoding calls and rely on the default output format.

My eyes glazed over a bit but definitely a +1 on the idea.

--
Daniel Gustafsson https://vmware.com/

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#1)
Re: pgcrypto: Remove explicit hex encoding/decoding from tests

Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:

pgcrypto tests use encode() and decode() calls to convert to/from hex
encoding. This was from before the hex format was available in bytea.
Now we can remove the extra explicit encoding/decoding calls and rely on
the default output format.

Generally +1, but I see you removed some instances of

--- ensure consistent test output regardless of the default bytea format
-SET bytea_output TO escape;

I think that the principle still applies that this should work regardless
of the installation's default bytea format, so I'd recommend putting

-- ensure consistent test output regardless of the default bytea format
SET bytea_output TO hex;

at the top of each file instead.

regards, tom lane

#4Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#3)
Re: pgcrypto: Remove explicit hex encoding/decoding from tests

On 02.12.21 19:30, Tom Lane wrote:

Generally +1, but I see you removed some instances of

--- ensure consistent test output regardless of the default bytea format
-SET bytea_output TO escape;

I think that the principle still applies that this should work regardless
of the installation's default bytea format, so I'd recommend putting

-- ensure consistent test output regardless of the default bytea format
SET bytea_output TO hex;

at the top of each file instead.

pg_regress.c sets bytea_output to hex already.

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#4)
Re: pgcrypto: Remove explicit hex encoding/decoding from tests

Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:

pg_regress.c sets bytea_output to hex already.

Ah, right. Nevermind that then.

regards, tom lane