2

a bit newb question: in my DB I've got a table with a binary field. I'd like to fetch not that whole field in a request, but rather part of it, preferably using ODBC. Is it at all possible? I'm using PostgreSQL 8.3 - in case a solution exists for that specific DBMS. Thanks.

Getting data part-by-part seems to be possible with SQLGetData function, but I'd also like to just skip a part of the blob, without loading it. So the question can be formulated as follows: is it possible to skip some bytes when reading a blob by SQLGetData?

1 Answer 1

1

If by blob you mean PostgreSQL bytea, then you can just use select substring(bytea_column from ? for ?).

It is fast when data blob is not compressed - you should prevent automatic compression of bytea using alter table tablename alter column bytea_column set storage external. Only rows inserted after alter table will not be compressed so you should do it on empty table or delete and reinsert all data after this command.

I'm using it to retrieve blobs (binary file data like DOC or PDF) from database in chunks. Works well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.