Skip to main content
`Ctrl`+`K`

# 7.3.52. `reference_release`

## 7.3.52.1. Summary

Added in version 10.0.4.

`reference_release` releases a reference of target objects acquired by reference_acquire.

This command is meaningless unless you use the reference count mode. You can enable the reference count mode by the `GRN_ENABLE_REFERENCE_COUNT=yes` environment variable.

You must call a corresponding `reference_release` for a reference_acquire call. If you forget to call `reference_release`, target objects by reference_acquire are never closed automatically.

## 7.3.52.2. Syntax

This command takes two parameters.

All parameters are optional:

    reference_release [target_name=null]
                      [recursive=yes]

## 7.3.52.3. Usage

Here is a schema definition to show usage:

Execution example:

    table_create Users TABLE_HASH_KEY ShortText
    # [[0,1337566253.89858,0.000355720520019531],true]
    column_create Users age COLUMN_SCALAR UInt8
    # [[0,1337566253.89858,0.000355720520019531],true]
    column_create Users introduction COLUMN_SCALAR ShortText
    # [[0,1337566253.89858,0.000355720520019531],true]
    table_create Ages TABLE_PAT_KEY UInt8
    # [[0,1337566253.89858,0.000355720520019531],true]
    column_create Ages user_age COLUMN_INDEX Users age
    # [[0,1337566253.89858,0.000355720520019531],true]

You must call `reference_release` with the same arguments as corresponding reference_acquire.

If you call reference_acquire with `--target_name Users --recursive dependent`, you must call `reference_release` with `--target_name Users --recursive dependent`:

Execution example:

    reference_release --target_name Users --recursive dependent
    # [[0,1337566253.89858,0.000355720520019531],true]
    # select Users ...
    # load --table Users ...
    reference_release --target_name Users --recursive dependent
    # [[0,1337566253.89858,0.000355720520019531],true]

## 7.3.52.4. Parameters

This section describes all parameters.

### 7.3.52.4.1. Required parameters

There is no required parameter.

### 7.3.52.4.2. Optional parameters

There are optional parameters.

#### 7.3.52.4.2.1. `target_name`

Specifies a target object name. Target object is one of database, table or column.

If you omit this parameter, database is the target object:

Execution example:

    reference_release
    # [[0,1337566253.89858,0.000355720520019531],true]

If you specify a table name, the table is the target object:

Execution example:

    reference_release --target_name Users
    # [[0,1337566253.89858,0.000355720520019531],true]

If you specify a column name, the column is the target object:

Execution example:

    reference_release --target_name Users.age
    # [[0,1337566253.89858,0.000355720520019531],true]

#### 7.3.52.4.2.2. `recursive`

Specifies whether child objects of the target object are also target objects.

See recursive for details.

## 7.3.52.5. Return value

The command returns `true` as body on success such as:

    [HEADER, true]

If the command fails, error details are in `HEADER`.

See Output format for `HEADER`.