Skip to content

Commit 3ac2430

Browse files
authored
Patch dollar quote for jobs (#102)
* dollar quote jobs * bump ver * fix test * change ci path
1 parent b9e8de2 commit 3ac2430

6 files changed

Lines changed: 8 additions & 10 deletions

File tree

.github/workflows/extension_upgrade.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ on:
1111
- main
1212
paths:
1313
- ".github/workflows/extension_upgrade.yml"
14-
- "./extension/**"
14+
- "extension/**"
1515
push:
1616
branches:
1717
- main
1818
paths:
1919
- ".github/workflows/extension_upgrade.yml"
20-
- "./extension/**"
20+
- "extension/**"
2121

2222
jobs:
2323
test:

extension/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "vectorize"
3-
version = "0.14.1"
3+
version = "0.14.2"
44
edition = "2021"
55
publish = false
66

extension/Trunk.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description = "The simplest way to orchestrate vector search on Postgres."
66
homepage = "https://github.com/tembo-io/pg_vectorize"
77
documentation = "https://github.com/tembo-io/pg_vectorize"
88
categories = ["orchestration", "machine_learning"]
9-
version = "0.14.1"
9+
version = "0.14.2"
1010

1111
[build]
1212
postgres_version = "15"

extension/sql/vectorize--0.14.1--0.14.2.sql

Whitespace-only changes.

extension/src/job.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn _handle_table_update(job_name: &str, record_ids: Vec<String>, inputs: Vec<Str
4747

4848
// send the job message to the queue
4949
let query = format!(
50-
"select pgmq.send('{VECTORIZE_QUEUE}', '{}');",
50+
"select pgmq.send('{VECTORIZE_QUEUE}', $${}$$::jsonb);",
5151
serde_json::to_string(&job_message).unwrap()
5252
);
5353
let _ran: Result<_, spi::Error> = Spi::connect(|mut c| {
@@ -169,10 +169,8 @@ pub fn initalize_table_job(
169169
inputs: b,
170170
};
171171
let query = format!(
172-
"select pgmq.send('{VECTORIZE_QUEUE}', '{}');",
173-
serde_json::to_string(&job_message)
174-
.unwrap()
175-
.replace('\'', "''")
172+
"select pgmq.send('{VECTORIZE_QUEUE}', $${}$$::jsonb);",
173+
serde_json::to_string(&job_message).unwrap()
176174
);
177175
let _ran: Result<_, spi::Error> = Spi::connect(|mut c| {
178176
let _r = c.update(&query, None, None)?;

extension/tests/integration_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ async fn test_realtime_job() {
167167

168168
let insert_query = format!(
169169
"INSERT INTO \"{test_table_name}\"(product_id, product_name, description)
170-
VALUES ({random_product_id}, 'car tester', 'a product for testing cars');"
170+
VALUES ({random_product_id}, 'car tester', $$a product for testing car's components$$);"
171171
);
172172

173173
// insert a new row

0 commit comments

Comments
 (0)