fix: init pg error error: CREATE INDEX CONCURRENTLY cannot run inside a transaction block (#684)

Co-authored-by: weifj <“weifj@tuyuansu.com.cn”>
This commit is contained in:
leoterry
2024-01-03 14:19:08 +08:00
committed by GitHub
parent d5b24eca57
commit c766a0ed8a

View File

@@ -22,7 +22,11 @@ export async function initPg() {
data_id VARCHAR(50) NOT NULL,
createTime TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX CONCURRENTLY IF NOT EXISTS vector_index ON ${PgDatasetTableName} USING hnsw (vector vector_ip_ops) WITH (m = 32, ef_construction = 64);
`);
await PgClient.query(`
CREATE INDEX CONCURRENTLY IF NOT EXISTS vector_index ON ${PgDatasetTableName}
USING hnsw (vector vector_ip_ops) WITH (m = 32, ef_construction = 64);
`);
console.log('init pg successful');