django-postgres-copy icon indicating copy to clipboard operation
django-postgres-copy copied to clipboard

Added client encoding to adapted SQL parameters.

Open osvill opened this issue 1 year ago • 3 comments

Fix & test for #158 .

osvill avatar Mar 13 '23 15:03 osvill

This is an awesome start. Would it be possible to run a test that raises the encoding error so we can verify the reverse circumstance here?

palewire avatar Mar 13 '23 16:03 palewire

It is hard to catch the error as a specific encoding error. I ended up adding a keyword argument client_encoding and raising a ValueError if client_encoding does not match the database encoding (2nd commit). What do you think?

osvill avatar Mar 13 '23 18:03 osvill

I ran some more tests and got errors for adapted parameters that do not have the encoding attribute. Therefore I added the hasattr check and the test filtering by a number in the 3rd commit.

osvill avatar Mar 14 '23 07:03 osvill