Closed tanscorpio7 closed 2 months ago
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
contrib/babelfishpg_tsql/src/prepare.c | 34 | 38 | 89.47% | ||
<!-- | Total: | 40 | 44 | 90.91% | --> |
Files with Coverage Reduction | New Missed Lines | % | ||
---|---|---|---|---|
contrib/babelfishpg_tds/src/backend/tds/tdscomm.c | 2 | 74.29% | ||
<!-- | Total: | 2 | --> |
Totals | |
---|---|
Change from base Build 9313151345: | 0.01% |
Covered Lines: | 41931 |
Relevant Lines: | 57510 |
This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Files with Coverage Reduction | New Missed Lines | % | ||
---|---|---|---|---|
contrib/babelfishpg_tsql/src/pltsql_bulkcopy.c | 23 | 88.33% | ||
contrib/babelfishpg_tsql/src/hooks.c | 165 | 79.69% | ||
<!-- | Total: | 188 | --> |
Totals | |
---|---|
Change from base Build 9956055141: | 0.01% |
Covered Lines: | 42905 |
Relevant Lines: | 58597 |
Description
Fix error portal snapshots (1) did not account for all active snapshots (2) when OUTPUT INTO table variable statement fires triggers.
pltsql statements that could fire trigger must always run inside a transaction block. If a txn block is not active, we create one. We exclude some types of statements from this, one of them being DML on table variables since they can never fire a trigger. We detect this using the variable
mod_stmt_tablevar
.Now an edge case here is OUTPUT into table variable stmt. Which we internally transform into two DML nodes. TOP INSERT NODE (signifies the output into clause) Another DELETE / UPDATE / INSERT node inside the top insert node -> with clause (specifies the first part of the output into clause )
As a fix we simply skip transaction commands inside pltsql UDFs and not rely on
mod_stmt_tablevar
on anymore.Also blocked certain cases of OUTPUT clause which should not be allowed inside pltsql UDFs.
Issues Resolved
[BABEL-4859]
Sign Off
Signed-off-by: Tanzeel Khan tzlkhan@amazon.com
Check List
By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.