数据仓库服务 GAUSSDB(DWS)-ALTER FOREIGN TABLE (For HDFS or OBS):语法格式

时间:2024-01-26 16:15:17

语法格式

  • 设置外表属性:
    1
    2
    ALTER FOREIGN TABLE [ IF EXISTS ]  table_name
        OPTIONS ( {[ ADD | SET | DROP ] option ['value']} [, ... ]);
    
  • 设置外表的所有者:
    1
    2
    ALTER FOREIGN TABLE [ IF EXISTS ] tablename 
        OWNER TO new_owner;
    
  • 更新外表列:
    1
    2
    ALTER FOREIGN TABLE [ IF EXISTS ] table_name
        MODIFY ( { column_name data_type | column_name [ CONSTRAINT constraint_name ] NOT NULL [ ENABLE ] | column_name [ CONSTRAINT constraint_name ] NULL } [, ...] );
    
  • 修改外表的列:
    1
    2
    ALTER FOREIGN TABLE [ IF EXISTS ] tablename 
        action [, ... ];
    
    其中action语法为:
    1
    2
    3
    4
    5
    6
    7
    ALTER [ COLUMN ] column_name [ SET DATA ] TYPE data_type
       | ALTER [ COLUMN ] column_name { SET | DROP } NOT NULL
       | ALTER [ COLUMN ] column_name SET STATIS TICS  [PERCENT] integer
       | ALTER [ COLUMN ] column_name OPTIONS ( {[ ADD | SET | DROP ] option ['value'] } [, ... ])
       | MODIFY column_name data_type
       | MODIFY column_name [ CONSTRAINT constraint_name ] NOT NULL [ ENABLE ]
       | MODIFY column_name [ CONSTRAINT constraint_name ] NULL
    

    参考ALTER TABLE

support.huaweicloud.com/sqlreference-820-dws/dws_06_0124.html