File: column_rename.rst

package info (click to toggle)
groonga 9.0.0-1%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 101,496 kB
  • sloc: ansic: 608,707; ruby: 35,042; xml: 23,643; cpp: 10,319; sh: 7,453; yacc: 5,968; python: 3,033; makefile: 2,609; perl: 133
file content (101 lines) | stat: -rw-r--r-- 2,197 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
.. -*- rst -*-

.. highlightlang:: none

.. groonga-command
.. database: commands_column_rename

``column_rename``
=================

Summary
-------

``column_rename`` command renames a column.

It is a light operation. It just changes a relationship between name
and the column object. It doesn't copy column values.

It is a dangerous operation. You must stop all operations including
read operations while you run ``column_rename``. If the following case
is occurred, Groonga process may be crashed:

  * Starts an operation (like ``select``) that accesses the column to
    be renamed by the current column name. The current column name is
    called as ``the old column name`` in the below because the column
    name is renamed.
  * Runs ``column_rename``. The ``select`` is still running.
  * The ``select`` accesses the column to be renamed by the old column
    name. But the ``select`` can't find the column by the old name
    because the column has been renamed to the new column name. It may
    crash the Groonga process.

Syntax
------

This command takes three parameters.

All parameters are required::

  column_rename table name new_name

Usage
-----

Here is a simple example of ``column_rename`` command.

.. groonga-command
.. include:: ../../example/reference/commands/column_rename/column_rename.log
.. table_create Users TABLE_PAT_KEY ShortText
.. column_create Users score COLUMN_SCALAR Int32
.. load --table Users
.. [
.. {"_key": "Alice",  "score": 2},
.. {"_key": "Bob",    "score": 0},
.. {"_key": "Carlos", "score": -1}
.. ]
.. column_rename Users score point
.. column_list Users
.. select Users

Parameters
----------

This section describes parameters of ``column_rename``.

Required parameters
^^^^^^^^^^^^^^^^^^^

All parameters are required.

``table``
"""""""""

Specifies the name of table that has the column to be renamed.

``name``
""""""""

Specifies the column name to be renamed.

``new_name``
""""""""""""

Specifies the new column name.


Return value
------------

::

 [HEADER, SUCCEEDED_OR_NOT]

``HEADER``

  See :doc:`/reference/command/output_format` about ``HEADER``.

``SUCCEEDED_OR_NOT``

  It is ``true`` on success, ``false`` otherwise.