File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 1010 database : pgvector_cpp_test
1111 - run : |
1212 sudo apt-get update && sudo apt-get install postgresql-server-dev-14
13- git clone --branch v0.3.2 https://github.com/pgvector/pgvector.git
13+ git clone --branch v0.4.0 https://github.com/pgvector/pgvector.git
1414 cd pgvector
1515 make
1616 sudo make install
Original file line number Diff line number Diff line change @@ -40,12 +40,23 @@ void test_stream(pqxx::connection &conn) {
4040 txn.commit ();
4141}
4242
43+ void test_precision (pqxx::connection &conn) {
44+ pqxx::work txn{conn};
45+ auto factors = pgvector::Vector ({1.23456789 , 0 , 0 });
46+ txn.exec_params (" INSERT INTO items (factors) VALUES ($1)" , factors);
47+ txn.exec0 (" SET extra_float_digits = 3" );
48+ pqxx::result res{txn.exec_params (" SELECT factors FROM items ORDER BY id DESC LIMIT 1" )};
49+ assert (res[0 ][0 ].as <pgvector::Vector>() == factors);
50+ txn.commit ();
51+ }
52+
4353int main () {
4454 pqxx::connection conn (" dbname=pgvector_cpp_test" );
4555 setup (conn);
4656
4757 test_works (conn);
4858 test_stream (conn);
59+ test_precision (conn);
4960
5061 return 0 ;
5162}
You can’t perform that action at this time.
0 commit comments