Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bytea is not implemented #61

Open
jonaskello opened this issue May 1, 2015 · 1 comment
Open

bytea is not implemented #61

jonaskello opened this issue May 1, 2015 · 1 comment

Comments

@jonaskello
Copy link

I want to store binary data in a postgres database. For space saving I don't want to store it as a text field (base64 encoded). So I created a column of type bytea (which seemed like the correct type, although I have not used postgres a lot so not sure). Next I tried to execute an INSERT command with a parameter as a Uint8List but it threw an exception "Postgresql array types not implemented yet.".

I could do some work on this and create a pull request but I would need some pointers on how it should be implemented. Specifically about the function String encodeArray(List value) in type_converter.dart. I understand it needs to encode the incoming List to a string, but not sure of the format it should return.

@xxgreg
Copy link
Owner

xxgreg commented May 1, 2015

I'm happy to take patches ;)

Without large changes to the library, the binary data will be sent across the wire as base64 anyway. So you will not get a performance benefit from using a bytea instead of base64 in a string.

One problem is that postgresql also supports array types. So List<int> should be interpreted as the postgresql type Integer[]. A Uint8List is a List<int>, so to be consistent should probably be treated the same.

So perhaps bytea data should only be used when declared explicitly. i.e.

conn.execute("insert into foo values (@1:bytea)", [bytes]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants