escape vs. bytea in config
От | Mathias Mayrhofer |
---|---|
Тема | escape vs. bytea in config |
Дата | |
Msg-id | ab608b9b-862b-c773-ea6f-298b9da6a898@mtmayr.com обсуждение исходный текст |
Ответы |
Re: escape vs. bytea in config
Re: escape vs. bytea in config |
Список | pgsql-general |
Dear Supportlist,
I came across the "bytea_output" configuration variable inside postgresql.conf. It seems to be affecting the "digest" function, but in a way I cannot understand.
When my postgresql 14 server executes the digest function, it considers the "bytea_output" variable, but the output of the function is *NOT* the same as the "encode" function. It differs only slightly.
Please have a view of the following two conditions: First with "bytea_output = hex", second with "bytea_output = escape". In both ways the result differs, which leads to my password-comparison to turn out false.
Regards,
Mathias
-- /etc/postgresql/14/main/postgresql.conf -- bytea_output = 'hex' db=> select digest('mtmayr', 'sha256'); ┌────────────────────────────────────────────────────────────────────┐ │ digest │ ├────────────────────────────────────────────────────────────────────┤ │ \xbf1995dd67c794df2de75983acd41f66c750682ab75ca3a935538b575884fd47 │ └────────────────────────────────────────────────────────────────────┘ db=> select encode(digest('mtmayr', 'sha256'), 'hex'); ┌──────────────────────────────────────────────────────────────────┐ │ encode │ ├──────────────────────────────────────────────────────────────────┤ │ bf1995dd67c794df2de75983acd41f66c750682ab75ca3a935538b575884fd47 │ └──────────────────────────────────────────────────────────────────┘ -- /etc/postgresql/14/main/postgresql.conf -- bytea_output = 'escape' db=> select encode(digest('mtmayr', 'sha256'), 'escape'); ┌────────────────────────────────────────────────────────────────────────────────────────────┐ │ encode │ ├────────────────────────────────────────────────────────────────────────────────────────────┤ │ \277\x19\225\335g\307\224\337-\347Y\203\254\324\x1Ff\307Ph*\267\\\243\2515S\213WX\204\375G │ └────────────────────────────────────────────────────────────────────────────────────────────┘ db=> select digest('mtmayr', 'sha256'); ┌────────────────────────────────────────────────────────────────────────────────────────────┐ │ digest │ ├────────────────────────────────────────────────────────────────────────────────────────────┤ │ \277\031\225\335g\307\224\337-\347Y\203\254\324\037f\307Ph*\267\\\243\2515S\213WX\204\375G │ └────────────────────────────────────────────────────────────────────────────────────────────┘ -- ^^ differences ^^^^
-- /\/\athias /\/\ayrhofer
В списке pgsql-general по дате отправления: