-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Milestone
Description
I have found a bug when using a Poco::Data::Statement to read multiples rows of a table with a column data type of "BYTEA" in a PostgreSQL database.
I have created a table with a column of type BYTEA and loaded several rows (example using 'psql'):
test=# create table tbin (id serial primary key, data bytea);
CREATE TABLE
test=# insert into tbin (data) values ('\x111111'), ('\x222222'), ('\x333333');
INSERT 0 3
test=# select * from tbin;
id | data
----+----------
1 | \x111111
2 | \x222222
3 | \x333333
(3 filas)
When I try to read it using:
Statement stm(session);
stm << "SELECT * FROM tbin"s, now;
RecordSet rs(stm);
for (bool more = rs.moveFirst(); more; more = rs.moveNext())
{
std::cout << rs["id"].toString() << " ";
BLOB data = rs["data"];
for (auto it = data.begin(); it != data.end(); ++it)
std::cout << std::hex << unsigned(*it);
std::cout << std::endl;
}
I got:
1 111111222222333333
2 111111222222333333
3 111111222222333333
The three 'data' values has been concatenated.
Unfortunately, I have not been able to find in the code why this happens :-(
If someone proposes a patch I can recompile poco library and test it.
Best regards
Luis Recuerda
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels