Debian Codegraph @

doc/source/reference/commands/column_rename.rst

raw
1 .. -*- rst -*-
2
3 .. groonga-command
4 .. database: commands_column_rename
5
6 ``column_rename``
7 =================
8
9 Summary
10 -------
11
12 ``column_rename`` command renames a column.
13
14 It is a light operation. It just changes a relationship between name
15 and the column object. It doesn't copy column values.
16
17 It is a dangerous operation. You must stop all operations including
18 read operations while you run ``column_rename``. If the following case
19 is occurred, Groonga process may be crashed:
20
21 * Starts an operation (like ``select``) that accesses the column to
22 be renamed by the current column name. The current column name is
23 called as ``the old column name`` in the below because the column
24 name is renamed.
25 * Runs ``column_rename``. The ``select`` is still running.
26 * The ``select`` accesses the column to be renamed by the old column
27 name. But the ``select`` can't find the column by the old name
28 because the column has been renamed to the new column name. It may
29 crash the Groonga process.
30
31 Syntax
32 ------
33
34 This command takes three parameters.
35
36 All parameters are required::
37
38 column_rename table name new_name
39
40 Usage
41 -----
42
43 Here is a simple example of ``column_rename`` command.
44
45 .. groonga-command
46 .. include:: ../../example/reference/commands/column_rename/column_rename.log
47 .. table_create Users TABLE_PAT_KEY ShortText
48 .. column_create Users score COLUMN_SCALAR Int32
49 .. load --table Users
50 .. [
51 .. {"_key": "Alice", "score": 2},
52 .. {"_key": "Bob", "score": 0},
53 .. {"_key": "Carlos", "score": -1}
54 .. ]
55 .. column_rename Users score point
56 .. column_list Users
57 .. select Users
58
59 Parameters
60 ----------
61
62 This section describes parameters of ``column_rename``.
63
64 Required parameters
65 ^^^^^^^^^^^^^^^^^^^
66
67 All parameters are required.
68
69 ``table``
70 """""""""
71
72 Specifies the name of table that has the column to be renamed.
73
74 ``name``
75 """"""""
76
77 Specifies the column name to be renamed.
78
79 ``new_name``
80 """"""""""""
81
82 Specifies the new column name.
83
84
85 Return value
86 ------------
87
88 ::
89
90 [HEADER, SUCCEEDED_OR_NOT]
91
92 ``HEADER``
93
94 See :doc:`/reference/command/output_format` about ``HEADER``.
95
96 ``SUCCEEDED_OR_NOT``
97
98 It is ``true`` on success, ``false`` otherwise.
99