groonga - オープンソースのカラムストア機能付き全文検索エンジン

8.3.10. column_rename

8.3.10.1. 概要

column_rename コマンドは指定したテーブルのカラム名を変更します。

8.3.10.2. 構文

column_rename コマンドは引数を二つとります。

tablecolumn_name が必須の引数です。

column_rename table column

8.3.10.3. 使い方

以下は column_rename コマンドの簡単な使用例です。

実行例:

table_create Users TABLE_PAT_KEY ShortText
# [[0, 1337566253.89858, 0.000355720520019531], true]
column_create Users score COLUMN_SCALAR Int32
# [[0, 1337566253.89858, 0.000355720520019531], true]
load --table Users
[
{"_key": "Alice",  "score": 2},
{"_key": "Bob",    "score": 0},
{"_key": "Carlos", "score": -1}
]
# [[0, 1337566253.89858, 0.000355720520019531], 3]
column_rename Users score point
# [[0, 1337566253.89858, 0.000355720520019531], true]
column_list Users
# [
#   [
#     0,
#     1337566253.89858,
#     0.000355720520019531
#   ],
#   [
#     [
#       [
#         "id",
#         "UInt32"
#       ],
#       [
#         "name",
#         "ShortText"
#       ],
#       [
#         "path",
#         "ShortText"
#       ],
#       [
#         "type",
#         "ShortText"
#       ],
#       [
#         "flags",
#         "ShortText"
#       ],
#       [
#         "domain",
#         "ShortText"
#       ],
#       [
#         "range",
#         "ShortText"
#       ],
#       [
#         "source",
#         "ShortText"
#       ]
#     ],
#     [
#       256,
#       "_key",
#       "",
#       "",
#       "COLUMN_SCALAR",
#       "Users",
#       "ShortText",
#       []
#     ],
#     [
#       257,
#       "point",
#       "/tmp/groonga-databases/commands_column_rename.0000101",
#       "fix",
#       "COLUMN_SCALAR|PERSISTENT",
#       "Users",
#       "Int32",
#       []
#     ]
#   ]
# ]
select Users
# [
#   [
#     0,
#     1337566253.89858,
#     0.000355720520019531
#   ],
#   [
#     [
#       [
#         3
#       ],
#       [
#         [
#           "_id",
#           "UInt32"
#         ],
#         [
#           "_key",
#           "ShortText"
#         ],
#         [
#           "point",
#           "Int32"
#         ]
#       ],
#       [
#         1,
#         "Alice",
#         2
#       ],
#       [
#         2,
#         "Bob",
#         0
#       ],
#       [
#         3,
#         "Carlos",
#         -1
#       ]
#     ]
#   ]
# ]

8.3.10.4. 引数

このセクションでは column_rename の引数について説明します。

8.3.10.4.1. 必須引数

必須引数は二つあります。 table_namecolumn_name です。

8.3.10.4.1.1. table_name

テーブルの名前を指定します。

8.3.10.4.1.2. column_name

カラムの名前を指定します。

8.3.10.5. 戻り値

[HEADER, SUCCEEDED_OR_NOT]

HEADER

HEADERのフォーマットは [0, UNIX_TIME_WHEN_COMMAND_IS_STARTED, ELAPSED_TIME] です。HEADERについては 出力形式 を参照してください。

SUCCEEDED_OR_NOT

コマンドの実行が成功するとtrueを返します。失敗するとエラーとしてfalseを返します。

目次

前のトピックへ

8.3.9. column_remove

次のトピックへ

8.3.11. define_selector

このページ