RELEASE SAVEPOINT

This MySQL statement instructs the server to release a savepoint named earlier with the SAVEPOINT statement for the current transaction.

Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

RELEASE SAVEPOINT identifier

Explanation

This MySQL statement instructs the server to release a savepoint named earlier with the MySQL statement, SAVEPOINT for the current transaction. The MySQL statement does not commit the transaction, nor does it rollback the transaction to the savepoint. Instead, it merely eliminates the savepoint as a possible rollback point. See the our MySQL documentation on the SAVEPOINT statement for more information.

Examples

Below is an example of this MySQL statement:

START TRANSACTION;

LOCK TABLES orders WRITE;

INSERT DATA INFILE '/tmp/customer_info.sql'
INTO TABLE orders;

SAVEPOINT orders_import;

INSERT DATA INFILE '/tmp/customer_orders.sql'
INTO TABLE orders;

SAVEPOINT orders_import1;

INSERT DATA INFILE '/tmp/customer_orders1.sql'
INTO TABLE orders;

SELECT...

RELEASE SAVEPOINT orders_import1;

In this example, the MySQL database administrator has imported a customer information file and two files containing customer orders and has set up two savepoints. After running a few SELECT statements (not fully shown here), he decides that the results of the second batch of orders looks alright and he releases the savepoint for it. He hasn't yet decided that the first batch was imported properly. If he decides that there was a problem, he can still rollback all of the orders imported, but no longer just the second batch.