Skip to content

Commit fe5982c

Browse files
committed
Updated pgvector to 0.4.0 on CI
1 parent ebdf4f2 commit fe5982c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
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

test/pqxx_test.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
4353
int 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
}

0 commit comments

Comments
 (0)