7.3.29. lock_release — Groonga v14.1.2 documentation

Skip to main content
`Ctrl`+`K`

# 7.3.29. `lock_release`

## 7.3.29.1. Summary

Added in version 5.1.2.

`lock_release` command releases the lock of the target object. The target object is one of database, table and column.

Note

This is a dangerous command. You must only release locks that you acquire by lock_acquire. If you release locks without lock_acquire, your database may be broken.

## 7.3.29.2. Syntax

This command takes only one optional parameter:

    lock_release [target_name=null]

If `target_name` parameters is omitted, database is used for the target object.

## 7.3.29.3. Usage

Here is an example to release the lock of the database:

Execution example:

    lock_acquire
    # [[0,1337566253.89858,0.000355720520019531],true]
    lock_release
    # [[0,1337566253.89858,0.000355720520019531],true]

Here is an example to release the lock of `Entries` table:

Execution example:

    table_create Entries TABLE_NO_KEY
    # [[0,1337566253.89858,0.000355720520019531],true]
    lock_acquire Entries
    # [[0,1337566253.89858,0.000355720520019531],true]
    lock_release Entries
    # [[0,1337566253.89858,0.000355720520019531],true]

Here is an example to release the lock of `Sites.title` column:

Execution example:

    table_create Sites TABLE_HASH_KEY ShortText
    # [[0,1337566253.89858,0.000355720520019531],true]
    column_create Sites title COLUMN_SCALAR ShortText
    # [[0,1337566253.89858,0.000355720520019531],true]
    lock_acquire Sites.title
    # [[0,1337566253.89858,0.000355720520019531],true]
    lock_release Sites.title
    # [[0,1337566253.89858,0.000355720520019531],true]

## 7.3.29.4. Parameters

This section describes all parameters.

### 7.3.29.4.1. `target_name`

Specifies the name of table or column.

If you don’t specify it, database is used for the target object.

The default is none. It means that the target object is database.

## 7.3.29.5. Return value

`lock_release` command returns whether lock is released successfully or not:

    [HEADER, SUCCEEDED_OR_NOT]

### 7.3.29.5.1. `HEADER`

See Output format about `HEADER`.

### 7.3.29.5.2. `SUCCEEDED_OR_NOT`

If command succeeded, it returns true, otherwise it returns false on error.

## 7.3.29.6. See also

> - lock_acquire

> - lock_clear