You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using {{ dbt_privacy.hash('my_field', salt_expr = 'my_salt') }} fails if the my_field or my_salt columns contain text with single backslashes in them. Postgres throws Postgres adapter: Postgres error: invalid input syntax for type bytea, because the macro tries to convert to bytea using a my_salt::varchar::bytea expression, which expects a string that can contain escapes. The value \xfoobar is an example of an invalid escape sequence that could be in the string, that will throw an error on this cast to bytea. The safe way to convert text to binary in postgres is something like convert_to(my_salt, pg_client_encoding()), which will handle escapes properly.
The text was updated successfully, but these errors were encountered:
Using
{{ dbt_privacy.hash('my_field', salt_expr = 'my_salt') }}
fails if themy_field
ormy_salt
columns contain text with single backslashes in them. Postgres throwsPostgres adapter: Postgres error: invalid input syntax for type bytea
, because the macro tries to convert tobytea
using amy_salt::varchar::bytea
expression, which expects a string that can contain escapes. The value\xfoobar
is an example of an invalid escape sequence that could be in the string, that will throw an error on this cast tobytea
. The safe way to convert text to binary in postgres is something likeconvert_to(my_salt, pg_client_encoding())
, which will handle escapes properly.The text was updated successfully, but these errors were encountered: