gpload update_columns
时间: 2023-11-20 13:06:59 浏览: 86
update columns
`gpload` is a utility in Greenplum Database that is used to load data into database tables in parallel. The `update_columns` parameter in `gpload` specifies the columns that are to be updated instead of inserted when loading data into an existing table. This parameter is used when performing an `UPSERT` operation, where a row is updated if it already exists in the table, and inserted if it doesn't.
The syntax for using `update_columns` in `gpload` is as follows:
```
UPDATE_COLUMNS ( column_name [, ...] )
```
Here, `column_name` refers to the name of the column that is to be updated. Multiple columns can be specified by separating them with commas.
For example, the following `gpload` configuration file loads data into a table called `my_table`, and updates the `value` column if the primary key `id` already exists in the table:
```
LOAD
TABLE my_table
(
id INTEGER,
value TEXT
)
SOURCE (
FILE='data.csv'
FORMAT='csv'
DELIMITER=','
HEADER='true'
)
MAPPING (
id = 1,
value = 2
)
ERROR_LIMIT = 100
UPDATE_COLUMNS ( value )
;
```
In this example, the `UPDATE_COLUMNS ( value )` parameter specifies that the `value` column should be updated if a row with the same `id` already exists in the `my_table` table.
阅读全文