Debian Codegraph @

doc/source/reference/commands/object_remove.rst

raw
1 .. -*- rst -*-
2
3 .. groonga-command
4 .. database: commands_object_remove
5
6 ``object_remove``
7 =================
8
9 Summary
10 -------
11
12 .. versionadded:: 6.0.0
13
14 ``object_remove`` removes an object. You can remove any object
15 including table, column, command and so on. Normally, you should use
16 specific remove command such as :doc:`table_remove` and
17 :doc:`column_remove`.
18
19 ``object_remove`` is danger because you can remove any object. You
20 should use ``object_remove`` carefully.
21
22 ``object_remove`` has "force mode". You can remove a broken object by
23 "force mode". "Force mode" is useful to resolve problems reported by
24 :doc:`/reference/executables/grndb`.
25
26 Syntax
27 ------
28
29 This command takes two parameters::
30
31 object_remove name
32 [force=no]
33
34 Usage
35 -----
36
37 You can remove an object in the database specified by ``name``:
38
39 .. groonga-command
40 .. include:: ../../example/reference/commands/object_remove/usage.log
41 .. object_remove Users
42 .. table_create Users TABLE_HASH_KEY ShortText
43 .. object_remove Users
44
45 The ``object_remove Users`` returns ``false`` before you create
46 ``Users`` table.
47
48 The ``object_remove Users`` returns ``true`` after you create ``Users``
49 table.
50
51 You can't remove a broken object by default:
52
53 .. groonga-command
54 .. include:: ../../example/reference/commands/object_remove/usage_broken_without_force.log
55 .. table_create Users TABLE_HASH_KEY ShortText
56 .. thread_limit 1
57 .. database_unmap
58 .. % echo "BROKEN" > ${DB_PATH}.0000100
59 .. object_remove Users
60 .. object_exist Users
61
62 You can remove a broken object by ``--force yes``:
63
64 .. groonga-command
65 .. include:: ../../example/reference/commands/object_remove/usage_broken_with_force.log
66 .. object_remove Users --force yes
67 .. object_exist Users
68
69 ``--force yes`` means you enable "force mode". You can remove a broken
70 object in "force mode".
71
72 Parameters
73 ----------
74
75 This section describes all parameters.
76
77 Required parameters
78 ^^^^^^^^^^^^^^^^^^^
79
80 There is only one required parameter.
81
82 .. _object-remove-name:
83
84 ``name``
85 """"""""
86
87 Specifies the object name to be removed.
88
89 If you want to remove a column, use ``TABLE_NAME.COLUMN_NAME`` format
90 like the following:
91
92 .. groonga-command
93 .. include:: ../../example/reference/commands/object_remove/name_column.log
94 .. table_create Logs TABLE_NO_KEY
95 .. column_create Logs timestamp COLUMN_SCALAR Time
96 .. object_remove Logs.timestamp
97
98 ``Logs`` is table name and ``timestamp`` is column name in
99 ``Logs.timestamp``.
100
101 Optional parameters
102 ^^^^^^^^^^^^^^^^^^^
103
104 There is one optional parameter.
105
106 ``force``
107 """""""""
108
109 Specifies whether removing the object in "force mode".
110
111 You can't remove a broken object by default. But you can remove a
112 broken object in "force mode".
113
114 ``force`` value must be ``yes`` or ``no``. ``yes`` means that "force
115 mode" is enabled. ``no`` means that "force mode" is disabled.
116
117 The default value is ``no``. It means that "force mode" is disabled by
118 default.
119
120 Return value
121 ------------
122
123 The command returns ``true`` as body when the command removed the
124 specified object without any error. For example::
125
126 [HEADER, true]
127
128 The command returns ``false`` as body when the command gets any
129 errors. For example::
130
131 [HEADER, false]
132
133 See :doc:`/reference/command/output_format` for ``HEADER``.
134
135 Note that ``false`` doesn't mean that "the command can't remove the
136 object". If you enable "force mode", the command removes the object
137 even if the object is broken. In the case, the object is removed and
138 ``false`` is returned as body.