Skip to content

Commit

Permalink
Fix the issue that PIVOT execution not return row affected line (babe…
Browse files Browse the repository at this point in the history
…lfish-for-postgresql#2071)


Previous our implement of PIVOT has a issue that it didn't return the
row affected line as result, this fix has fixed the bug.

Task: BABEL-284
Signed-off-by: Zhibai Song <[email protected]>
  • Loading branch information
forestkeeper authored and Jason Teng committed Dec 28, 2023
1 parent 83a5c40 commit 41bbd8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions contrib/babelfishpg_tsql/src/pl_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -5062,11 +5062,10 @@ exec_stmt_execsql(PLtsql_execstate *estate,
/* If query affects IDENTITY_INSERT relation then update sequence */
pltsql_update_identity_insert_sequence(expr);

/* If current plan constains a pivot operator, we remove the plan */
/* If current plan constains a pivot operator, we set it as execute oneshot */
if (is_pivot)
{
SPI_freeplan(expr->plan);
expr->plan = NULL;
expr->plan->oneshot = true;
}

/* Expect SPI_tuptable to be NULL else complain */
Expand Down
2 changes: 2 additions & 0 deletions test/JDBC/expected/pivot-vu-verify.out
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,8 @@ PIVOT (
) AS pvt;
SELECT TOP 10 * FROM pivot_insert_into ORDER by 1, 2;
GO
~~ROW COUNT: 197~~

~~START~~
int#!#int#!#int#!#int#!#int#!#int#!#int
1200#!#200#!#0#!#0#!#0#!#0#!#0
Expand Down

0 comments on commit 41bbd8b

Please sign in to comment.