Updated on 2023-10-23 GMT+08:00

ALTER FOREIGN TABLE

Function

ALTER FOREIGN TABLE modifies a foreign table.

Precautions

When multi-layer quotation marks are used for sensitive columns (such as password and secret_access_key) in OPTIONS, the semantics is different from that in the scenario where quotation marks are not used. Therefore, sensitive columns are not identified for anonymization.

Syntax

ALTER FOREIGN TABLE [ IF EXISTS ]  table_name
    OPTIONS ( {[ ADD | SET | DROP ] option ['value']}[, ... ]);

ALTER FOREIGN TABLE [ IF EXISTS ] table_name
    ALTER column_name OPTIONS;

Parameter Description

  • table_name

    Specifies the name of an existing foreign table to be modified.

    Value range: an existing foreign table name.

  • option

    Specifies the option of a foreign table or foreign table column to be modified. ADD, SET, and DROP are operations to be performed. If no operation is set explicitly, the default value ADD is used. The option name must be unique (although table options and table column options can share the same name). The name and value of the option are also validated by a class library of a foreign data wrapper.

    • Options supported by file_fdw are as follows:
      • filename

        File to be read. This parameter is mandatory and must be an absolute path.

      • format

        File format of the remote server, which is the same as the FORMAT option in the COPY statement. The value can be text, csv, binary, or fixed.

      • header

        Specifies whether a specified file has a header, which is the same as the HEADER option of the COPY statement.

        • delimiter

          File delimiter, which is the same as the DELIMITER option of the COPY statement.

        • quote

          Quote character of a file, which is the same as the QUOTE option of the COPY statement.

        • escape

          Escape character of a file, which is the same as the ESCAPE option of the COPY statement.

        • null

          Null string of a file, which is the same as the NULL option of the COPY statement.

        • encoding

          Encoding of a file, which is the same as the ENCODING option of the COPY statement.

        • force_not_null

          This is a Boolean option. If it is true, the value of the declared field cannot be an empty string. This option is the same as the FORCE_NOT_NULL option of the COPY statement.

  • value

    Specifies the new value of option.