Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion scripts/generate_fingerprint_outfuncs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ def initialize
['PrepareStmt', 'name'] => :skip,
['ExecuteStmt', 'name'] => :skip,
['DeallocateStmt', 'name'] => :skip,
['TransactionStmt', 'options'] => :skip,
['TransactionStmt', 'gid'] => :skip,
['TransactionStmt', 'savepoint_name'] => :skip,
['CreateFunctionStmt', 'options'] => :skip,
Expand Down
16 changes: 15 additions & 1 deletion src/include/pg_query_fingerprint_defs.c
Original file line number Diff line number Diff line change
Expand Up @@ -13704,8 +13704,22 @@ _fingerprintTransactionStmt(FingerprintContext *ctx, const TransactionStmt *node

// Intentionally ignoring node->location for fingerprinting

// Intentionally ignoring node->options for fingerprinting
if (node->options != NULL && node->options->length > 0) {
XXH3_state_t* prev = XXH3_createState();
XXH64_hash_t hash;

XXH3_copyState(prev, ctx->xxh_state);
_fingerprintString(ctx, "options");

hash = XXH3_64bits_digest(ctx->xxh_state);
_fingerprintNode(ctx, node->options, node, "options", depth + 1);
if (hash == XXH3_64bits_digest(ctx->xxh_state) && !(list_length(node->options) == 1 && linitial(node->options) == NIL)) {
XXH3_copyState(ctx->xxh_state, prev);
if (ctx->write_tokens)
dlist_delete(dlist_tail_node(&ctx->tokens));
}
XXH3_freeState(prev);
}
// Intentionally ignoring node->savepoint_name for fingerprinting

}
Expand Down
6 changes: 6 additions & 0 deletions test/fingerprint_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ const char* tests[] = {
"PREPARE TRANSACTION 'some_id'",
"d993959a33d627d4",
"START TRANSACTION READ WRITE",
"d2bd82412b9a616d",
"START TRANSACTION",
"4ca25828c835d55a",
"BEGIN ISOLATION LEVEL REPEATABLE READ, READ ONLY, DEFERRABLE",
"4eadd452a5088d73",
"BEGIN",
"b16b431979fc3e05",
"DECLARE cursor_123 CURSOR FOR SELECT * FROM test WHERE id = 123",
"d2bec62d2a7ec7cb",
"FETCH 1000 FROM cursor_123",
Expand Down