Skip to content

Commit 4f926f1

Browse files
authored
fix: Update instrumentation pg to support merge statements (#1317)
* fix: support merge statement in pg versions 15+ * chore: fix json formatting for pg fixtures * chore: use aliases in pg fixtures table for merge statement
1 parent b1ea804 commit 4f926f1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

instrumentation/pg/lib/opentelemetry/instrumentation/pg/constants.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ module Constants
4040
LISTEN
4141
LOAD
4242
LOCK
43+
MERGE
4344
MOVE
4445
NOTIFY
4546
PREPARE
46-
PREPARE
4747
REASSIGN
4848
REFRESH
4949
REINDEX
@@ -54,7 +54,6 @@ module Constants
5454
SAVEPOINT
5555
SECURITY
5656
SELECT
57-
SELECT
5857
SET
5958
SHOW
6059
START

instrumentation/pg/test/fixtures/sql_table_name.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,9 @@
5454
{
5555
"name": "table_name_with_double_quotes",
5656
"sql": "SELECT columns FROM \"test_table\""
57+
},
58+
{
59+
"name": "merge",
60+
"sql": "MERGE INTO test_table AS t USING other_table AS o ON (o.id = t.id) WHEN MATCHED THEN UPDATE SET x = t.x + 1 WHEN NOT MATCHED THEN INSERT (id, x, status) VALUES (o.id, o.x, o.status)"
5761
}
5862
]

0 commit comments

Comments
 (0)