Files
doris/docs/en/sql-reference/sql-statements/Data Manipulation/SHOW-LAST-INSERT.md
Mingyu Chen 1e70f992e7 [improvement][fix](insert)(replay) support SHOW LAST INSERT stmt and fix json replay bug (#8355)
1. support SHOW LAST INSERT
    In the current implementation, the insert operation returns a json string to describe the result information
    of the insert. But this information is in the session track field of the mysql protocol,
    and it is difficult to obtain programmatically.

    Therefore, I provide a new syntax `show last insert` to explicitly obtain the result of the latest insert operation,
    and return a normal query result set to facilitate the user to obtain the result information of the insert.

2. the `ReturnRows` field in fe.audit.log of insert operation will be set to the loaded row num of the insert.

3.  Fix a bug described in #8354
2022-03-08 18:53:11 +08:00

1.8 KiB

title, language
title language
SHOW LAST INSERT en

SHOW LAST INSERT

description

This syntax is used to view the result of the last insert operation in the current session connection.

Syntax:

SHOW LAST INSERT

Example of return result.

    TransactionId: 64067
            Label: insert_ba8f33aea9544866-8ed77e2844d0cc9b
         Database: default_cluster:db1
            Table: t1
TransactionStatus: VISIBLE
       LoadedRows: 2
     FilteredRows: 0
  • TransactionId: transaction id
  • Label: label corresponding to the insert task
  • Database: the database corresponding to the insert
  • Table: the table corresponding to the insert
  • TransactionStatus: the status of the transaction
    • PREPARE: preparation phase
    • PRECOMMITTED: Pre-committed stage
    • COMMITTED: The transaction is successful, but the data is not visible
    • VISIBLE: The transaction is successful and the data is visible
    • ABORTED: The transaction failed.
  • LoadedRows: Number of rows imported
  • FilteredRows: number of rows filtered

example

keyword

SHOW, LAST, INSERT