Open
Description
Describe the bug
I'm using RecordSet to retrive column data, but it can not recognise UUID column
To Reproduce
both postgresq 16 and 17 , the same errors occurs.
step 1
create test table and insert data
create table tbl1(
id serial not null primary key,
uuid uuid not null
);
insert into tbl1("uuid") values('a380fa6f-1601-4ad3-a9ea-a2eb7b223db0'), ('9d099d64-b457-4d34-bdac-7329484eb93f');
step 2
using Poco to get data:
PostgreSQL::Connector::registerConnector();
Session session(PostgreSQL::Connector::KEY, "host='127.0.0.1' port=5432 dbname='t1'");
try {
Statement stmt(session);
stmt << "SELECT * FROM tbl1 ORDER BY id LIMIT 2";
stmt.execute();
RecordSet recordset(stmt);
for (auto it : recordset) {
// printing column type
std::cout << "uuid type: " << recordset.columnType("uuid") << "\n"
<< recordset.value("uuid").typeName() << "\n"
<< "length: " << recordset.value("uuid").size()
<< std::endl;
// try to get uuid data
// error occurs, convert to std::string also throws a exception
Poco::UUID uuidValue = recordset.value("uuid").convert<Poco::UUID>();
}
} catch (Poco::Exception e) {
std::cerr << "poco exception: " << e.message() << std::endl;
}
the result is:
uuid type: 13
uuid type name: Poco::Data::LOB<unsigned char>
length: 1
poco exception: Can not convert to UUID
Expected behavior
the recordset can recognise the uuid column type, and convert data to Poco::UUID or std::string, so I can handle it mannually.
Logs
see above please
Screenshots
Please add relevant environment information:
- OS Type and Version: archlinux, the latest updates
- POCO Version: 1.14.1
- Third-party product (eg. database or library) type and version:
- postgresql: 16.6 and 17.4
- gcc: 14.2.1
Additional context