SQL Syntax Summary

SQL Syntax Summary

ABORT

放弃当前事务.

ABORT [WORK | TRANSACTION]

See ABORT for more information.

ALTER AGGREGATE

修改聚集函数的定义。

ALTER AGGREGATE name ( type [ , ... ] ) RENAME TO new_name

ALTER AGGREGATE name ( type [ , ... ] ) OWNER TO new_owner

ALTER AGGREGATE name ( type [ , ... ] ) SET SCHEMA new_schema

See ALTER AGGREGATE for more information.

ALTER COLLATION

修改字符集的定义。

ALTER COLLATION name RENAME TO new_name

ALTER COLLATION name OWNER TO new_owner

ALTER COLLATION name SET SCHEMA new_schema

See ALTER COLLATION for more information.

ALTER CONVERSION

更改一个转换的定义。

ALTER CONVERSION name RENAME TO newname

ALTER CONVERSION name OWNER TO newowner

ALTER CONVERSION name SET SCHEMA new_schema

See ALTER CONVERSION for more information.

ALTER DATABASE

修改数据库的属性

ALTER DATABASE name [ WITH CONNECTION LIMIT connlimit ]

ALTER DATABASE name RENAME TO newname

ALTER DATABASE name OWNER TO new_owner

ALTER DATABASE name SET TABLESPACE new_tablespace

ALTER DATABASE name SET parameter { TO | = } { value | DEFAULT }
ALTER DATABASE name SET parameter FROM CURRENT
ALTER DATABASE name RESET parameter
ALTER DATABASE name RESET ALL

See ALTER DATABASE for more information.

ALTER DEFAULT PRIVILEGES

修改默认的访问权限。

ALTER DEFAULT PRIVILEGES
    [ FOR { ROLE | USER } target_role [, ...] ]
    [ IN SCHEMA schema_name [, ...] ]
    abbreviated_grant_or_revoke

where abbreviated_grant_or_revoke is one of:

GRANT { { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER }
    [, ...] | ALL [ PRIVILEGES ] }
    ON TABLES
    TO { [ GROUP ] role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ]

GRANT { { USAGE | SELECT | UPDATE }
    [, ...] | ALL [ PRIVILEGES ] }
    ON SEQUENCES
    TO { [ GROUP ] role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ]

GRANT { EXECUTE | ALL [ PRIVILEGES ] }
    ON FUNCTIONS
    TO { [ GROUP ] role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ]

GRANT { USAGE | ALL [ PRIVILEGES ] }
    ON TYPES
    TO { [ GROUP ] role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ]

REVOKE [ GRANT OPTION FOR ]
    { { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES | TRIGGER }
    [, ...] | ALL [ PRIVILEGES ] }
    ON TABLES
    FROM { [ GROUP ] role_name | PUBLIC } [, ...]
    [ CASCADE | RESTRICT ]

REVOKE [ GRANT OPTION FOR ]
    { { USAGE | SELECT | UPDATE }
    [, ...] | ALL [ PRIVILEGES ] }
    ON SEQUENCES
    FROM { [ GROUP ] role_name | PUBLIC } [, ...]
    [ CASCADE | RESTRICT ]

REVOKE [ GRANT OPTION FOR ]
    { EXECUTE | ALL [ PRIVILEGES ] }
    ON FUNCTIONS
    FROM { [ GROUP ] role_name | PUBLIC } [, ...]
    [ CASCADE | RESTRICT ]

REVOKE [ GRANT OPTION FOR ]
    { USAGE | ALL [ PRIVILEGES ] }
    ON TYPES
    FROM { [ GROUP ] role_name | PUBLIC } [, ...]
    [ CASCADE | RESTRICT ]

See ALTER DEFAULT PRIVILEGES for more information.

ALTER DOMAIN

更改现有域的定义。

ALTER DOMAIN name { SET DEFAULT expression | DROP DEFAULT }

ALTER DOMAIN name { SET | DROP } NOT NULL

ALTER DOMAIN name ADD domain_constraint [ NOT VALID ]

ALTER DOMAIN name DROP CONSTRAINT [ IF EXISTS ] constraint_name [RESTRICT | CASCADE]

ALTER DOMAIN name RENAME CONSTRAINT constraint_name TO new_constraint_name

ALTER DOMAIN name VALIDATE CONSTRAINT constraint_name
  
ALTER DOMAIN name OWNER TO new_owner
  
ALTER DOMAIN name RENAME TO new_name

ALTER DOMAIN name SET SCHEMA new_schema

See ALTER DOMAIN for more information.

ALTER EXTENSION

更改在Greenplum数据库中注册的扩展的定义。

ALTER EXTENSION name UPDATE [ TO new_version ]
ALTER EXTENSION name SET SCHEMA new_schema
ALTER EXTENSION name ADD member_object
ALTER EXTENSION name DROP member_object

where member_object is:

  ACCESS METHOD object_name |
  AGGREGATE aggregate_name ( aggregate_signature ) |
  CAST (source_type AS target_type) |
  COLLATION object_name |
  CONVERSION object_name |
  DOMAIN object_name |
  EVENT TRIGGER object_name |
  FOREIGN DATA WRAPPER object_name |
  FOREIGN TABLE object_name |
  FUNCTION function_name ( [ [ argmode ] [ argname ] argtype [, ...] ] ) |
  MATERIALIZED VIEW object_name |
  OPERATOR operator_name (left_type, right_type) |
  OPERATOR CLASS object_name USING index_method |
  OPERATOR FAMILY object_name USING index_method |
  [ PROCEDURAL ] LANGUAGE object_name |
  SCHEMA object_name |
  SEQUENCE object_name |
  SERVER object_name |
  TABLE object_name |
  TEXT SEARCH CONFIGURATION object_name |
  TEXT SEARCH DICTIONARY object_name |
  TEXT SEARCH PARSER object_name |
  TEXT SEARCH TEMPLATE object_name |
  TRANSFORM FOR type_name LANGUAGE lang_name |
  TYPE object_name |
  VIEW object_name

and aggregate_signature is:

* | [ argmode ] [ argname ] argtype [ , ... ] |
  [ [ argmode ] [ argname ] argtype [ , ... ] ] 
    ORDER BY [ argmode ] [ argname ] argtype [ , ... ]

See ALTER EXTENSION for more information.

ALTER EXTERNAL TABLE

更改一个外部表的定义。

ALTER EXTERNAL TABLE name action [, ... ]

where action is one of:

  ADD [COLUMN] new_column type
  DROP [COLUMN] column [RESTRICT|CASCADE]
  ALTER [COLUMN] column TYPE type
  OWNER TO new_owner

See ALTER EXTERNAL TABLE for more information.

ALTER FOREIGN DATA WRAPPER

修改一个外部数据包装的定义。

ALTER FOREIGN DATA WRAPPER name
    [ HANDLER handler_function | NO HANDLER ]
    [ VALIDATOR validator_function | NO VALIDATOR ]
    [ OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] ) ]

ALTER FOREIGN DATA WRAPPER name OWNER TO new_owner
ALTER FOREIGN DATA WRAPPER name RENAME TO new_name

See ALTER FOREIGN DATA WRAPPER for more information.

ALTER FOREIGN TABLE

修改外表的定义。

ALTER FOREIGN TABLE [ IF EXISTS ] name
    action [, ... ]
ALTER FOREIGN TABLE [ IF EXISTS ] name
    RENAME [ COLUMN ] column_name TO new_column_name
ALTER FOREIGN TABLE [ IF EXISTS ] name
    RENAME TO new_name
ALTER FOREIGN TABLE [ IF EXISTS ] name
    SET SCHEMA new_schema

See ALTER FOREIGN TABLE for more information.

ALTER FUNCTION

修改函数的定义。

ALTER FUNCTION name ( [ [argmode] [argname] argtype [, ...] ] ) 
   action [, ... ] [RESTRICT]

ALTER FUNCTION name ( [ [argmode] [argname] argtype [, ...] ] )
   RENAME TO new_name

ALTER FUNCTION name ( [ [argmode] [argname] argtype [, ...] ] ) 
   OWNER TO new_owner

ALTER FUNCTION name ( [ [argmode] [argname] argtype [, ...] ] ) 
   SET SCHEMA new_schema

See ALTER FUNCTION for more information.

ALTER GROUP

更改角色名称或成员关系。

ALTER GROUP groupname ADD USER username [, ... ]

ALTER GROUP groupname DROP USER username [, ... ]

ALTER GROUP groupname RENAME TO newname

See ALTER GROUP for more information.

ALTER INDEX

更改一个索引的定义。

ALTER INDEX [ IF EXISTS ] name RENAME TO new_name

ALTER INDEX [ IF EXISTS ] name SET TABLESPACE tablespace_name

ALTER INDEX [ IF EXISTS ] name SET ( storage_parameter = value [, ...] )

ALTER INDEX [ IF EXISTS ] name RESET ( storage_parameter  [, ...] )

ALTER INDEX ALL IN TABLESPACE name [ OWNED BY role_name [, ... ] ]
  SET TABLESPACE new_tablespace [ NOWAIT ]

See ALTER INDEX for more information.

ALTER LANGUAGE

更改过程语言的名称。

ALTER LANGUAGE name RENAME TO newname
ALTER LANGUAGE name OWNER TO new_owner

See ALTER LANGUAGE for more information.

ALTER OPERATOR

更改操作符的定义。

ALTER OPERATOR name ( {left_type | NONE} , {right_type | NONE} ) 
   OWNER TO new_owner

ALTER OPERATOR name ( {left_type | NONE} , {right_type | NONE} ) 
    SET SCHEMA new_schema

See ALTER OPERATOR for more information.

ALTER OPERATOR CLASS

更改一个操作符类的定义。

ALTER OPERATOR CLASS name USING index_method RENAME TO new_name

ALTER OPERATOR CLASS name USING index_method OWNER TO new_owner

ALTER OPERATOR CLASS name USING index_method SET SCHEMA new_schema

See ALTER OPERATOR CLASS for more information.

ALTER OPERATOR FAMILY

更改操作符族的定义。

ALTER OPERATOR FAMILY name USING index_method ADD
  {  OPERATOR strategy_number operator_name ( op_type, op_type ) [ FOR SEARCH | FOR ORDER BY sort_family_name ]
    | FUNCTION support_number [ ( op_type [ , op_type ] ) ] funcname ( argument_type [, ...] )
  } [, ... ]

ALTER OPERATOR FAMILY name USING index_method DROP
  {  OPERATOR strategy_number ( op_type, op_type ) 
    | FUNCTION support_number [ ( op_type [ , op_type ] ) 
  } [, ... ]

ALTER OPERATOR FAMILY name USING index_method RENAME TO new_name

ALTER OPERATOR FAMILY name USING index_method OWNER TO new_owner

ALTER OPERATOR FAMILY name USING index_method SET SCHEMA new_schema

See ALTER OPERATOR FAMILY for more information.

ALTER PROTOCOL

更改一个协议的定义。

ALTER PROTOCOL name RENAME TO newname

ALTER PROTOCOL name OWNER TO newowner

See ALTER PROTOCOL for more information.

ALTER RESOURCE GROUP

更改一个资源组的限制项。

ALTER RESOURCE GROUP name SET group_attribute value

See ALTER RESOURCE GROUP for more information.

ALTER RESOURCE QUEUE

更改资源队列的限制。

ALTER RESOURCE QUEUE name WITH ( queue_attribute=value [, ... ] ) 

See ALTER RESOURCE QUEUE for more information.

ALTER ROLE

更改一个数据库角色(用户或组)。

ALTER ROLE name [ [ WITH ] option [ ... ] ]

其中 option 可以是:

    SUPERUSER | NOSUPERUSER
  | CREATEDB | NOCREATEDB
  | CREATEROLE | NOCREATEROLE
  | CREATEEXTTABLE | NOCREATEEXTTABLE  [ ( attribute='value' [, ...] )
     where attributes and values are:
       type='readable'|'writable'
       protocol='gpfdist'|'http'
  | INHERIT | NOINHERIT
  | LOGIN | NOLOGIN
  | REPLICATION | NOREPLICATION
  | CONNECTION LIMIT connlimit
  | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password'
  | VALID UNTIL 'timestamp'

ALTER ROLE name RENAME TO new_name

ALTER ROLE { name | ALL } [ IN DATABASE database_name ] SET configuration_parameter { TO | = } { value | DEFAULT }
ALTER ROLE { name | ALL } [ IN DATABASE database_name ] SET configuration_parameter FROM CURRENT
ALTER ROLE { name | ALL } [ IN DATABASE database_name ] RESET configuration_parameter
ALTER ROLE { name | ALL } [ IN DATABASE database_name ] RESET ALL
ALTER ROLE name RESOURCE QUEUE {queue_name | NONE}
ALTER ROLE name RESOURCE GROUP {group_name | NONE}

See ALTER ROLE for more information.

ALTER RULE

修改一个规则的定义。

ALTER RULE name ON table_name RENAME TO new_name

See ALTER RULE for more information.

ALTER SCHEMA

更改一个模式定义。

ALTER SCHEMA name RENAME TO newname

ALTER SCHEMA name OWNER TO newowner

See ALTER SCHEMA for more information.

ALTER SEQUENCE

更改一个序列发生器的定义。

ALTER SEQUENCE [ IF EXISTS ] name [INCREMENT [ BY ] increment] 
     [MINVALUE minvalue | NO MINVALUE] 
     [MAXVALUE maxvalue | NO MAXVALUE] 
     [START [ WITH ] start ]
     [RESTART [ [ WITH ] restart] ]
     [CACHE cache] [[ NO ] CYCLE] 
     [OWNED BY {table.column | NONE}]

ALTER SEQUENCE [ IF EXISTS ] name OWNER TO new_owner

ALTER SEQUENCE [ IF EXISTS ] name RENAME TO new_name

ALTER SEQUENCE [ IF EXISTS ] name SET SCHEMA new_schema

See ALTER SEQUENCE for more information.

ALTER SERVER

修改一个外部服务器的定义。

ALTER SERVER server_name [ VERSION 'new_version' ]
    [ OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] ) ]

ALTER SERVER server_name OWNER TO new_owner
                
ALTER SERVER server_name RENAME TO new_name

See ALTER SERVER for more information.

ALTER TABLE

更改一个表的定义。

ALTER TABLE [IF EXISTS] [ONLY] name 
    action [, ... ]

ALTER TABLE [IF EXISTS] [ONLY] name 
    RENAME [COLUMN] column_name TO new_column_name

ALTER TABLE [ IF EXISTS ] [ ONLY ] name 
    RENAME CONSTRAINT constraint_name TO new_constraint_name

ALTER TABLE [IF EXISTS] name 
    RENAME TO new_name

ALTER TABLE [IF EXISTS] name 
    SET SCHEMA new_schema

ALTER TABLE ALL IN TABLESPACE name [ OWNED BY role_name [, ... ] ]
    SET TABLESPACE new_tablespace [ NOWAIT ]

ALTER TABLE [IF EXISTS] [ONLY] name SET 
     WITH (REORGANIZE=true|false)
   | DISTRIBUTED BY ({column_name [opclass]} [, ... ] )
   | DISTRIBUTED RANDOMLY
   | DISTRIBUTED REPLICATED 

ALTER TABLE name
   [ ALTER PARTITION { partition_name | FOR (RANK(number)) 
   | FOR (value) } partition_action [...] ] 
   partition_action

其中 action 是下列之一:
                        
  ADD [COLUMN] column_name data_type [ DEFAULT default_expr ]
      [column_constraint [ ... ]]
      [ COLLATE collation ]
      [ ENCODING ( storage_directive [,...] ) ]
  DROP [COLUMN] [IF EXISTS] column_name [RESTRICT | CASCADE]
  ALTER [COLUMN] column_name [ SET DATA ] TYPE type [COLLATE collation] [USING expression]
  ALTER [COLUMN] column_name SET DEFAULT expression
  ALTER [COLUMN] column_name DROP DEFAULT
  ALTER [COLUMN] column_name { SET | DROP } NOT NULL
  ALTER [COLUMN] column_name SET STATISTICS integer
  ALTER [COLUMN] column SET ( attribute_option = value [, ... ] )
  ALTER [COLUMN] column RESET ( attribute_option [, ... ] )
  ADD table_constraint [NOT VALID]
  ADD table_constraint_using_index
  VALIDATE CONSTRAINT constraint_name
  DROP CONSTRAINT [IF EXISTS] constraint_name [RESTRICT | CASCADE]
  DISABLE TRIGGER [trigger_name | ALL | USER]
  ENABLE TRIGGER [trigger_name | ALL | USER]
  CLUSTER ON index_name
  SET WITHOUT CLUSTER
  SET WITH OIDS
  SET WITHOUT OIDS
  SET (storage_parameter = value)
  RESET (storage_parameter [, ... ])
  INHERIT parent_table
  NO INHERIT parent_table
  OF type_name
  NOT OF
  OWNER TO new_owner
  SET TABLESPACE new_tablespace

See ALTER TABLE for more information.

ALTER TABLESPACE

更改表空间的定义。

ALTER TABLESPACE name RENAME TO new_name

ALTER TABLESPACE name OWNER TO new_owner

ALTER TABLESPACE name SET ( tablespace_option = value [, ... ] )

ALTER TABLESPACE name RESET ( tablespace_option [, ... ] )

See ALTER TABLESPACE for more information.

ALTER TEXT SEARCH CONFIGURATION

更改文本搜索配置的定义。

ALTER TEXT SEARCH CONFIGURATION name
    ALTER MAPPING FOR token_type [, ... ] WITH dictionary_name [, ... ]
ALTER TEXT SEARCH CONFIGURATION name
    ALTER MAPPING REPLACE old_dictionary WITH new_dictionary
ALTER TEXT SEARCH CONFIGURATION name
    ALTER MAPPING FOR token_type [, ... ] REPLACE old_dictionary WITH new_dictionary
ALTER TEXT SEARCH CONFIGURATION name
    DROP MAPPING [ IF EXISTS ] FOR token_type [, ... ]
ALTER TEXT SEARCH CONFIGURATION name RENAME TO new_name
ALTER TEXT SEARCH CONFIGURATION name OWNER TO new_owner
ALTER TEXT SEARCH CONFIGURATION name SET SCHEMA new_schema

See ALTER TEXT SEARCH CONFIGURATION for more information.

ALTER TEXT SEARCH DICTIONARY

更改文本搜索词典的定义。

ALTER TEXT SEARCH DICTIONARY name (
    option [ = value ] [, ... ]
)
ALTER TEXT SEARCH DICTIONARY name RENAME TO new_name
ALTER TEXT SEARCH DICTIONARY name OWNER TO new_owner
ALTER TEXT SEARCH DICTIONARY name SET SCHEMA new_schema

See ALTER TEXT SEARCH DICTIONARY for more information.

ALTER TEXT SEARCH PARSER

更改文本搜索解析器的定义。

ALTER TEXT SEARCH PARSER name RENAME TO new_name
ALTER TEXT SEARCH PARSER name SET SCHEMA new_schema

See ALTER TEXT SEARCH PARSER for more information.

ALTER TEXT SEARCH TEMPLATE

更改文本搜索模板的定义。

ALTER TEXT SEARCH TEMPLATE name RENAME TO new_name
ALTER TEXT SEARCH TEMPLATE name SET SCHEMA new_schema

See ALTER TEXT SEARCH TEMPLATE for more information.

ALTER TYPE

更改一个数据类型的定义。

ALTER TYPE name action [, ... ]
ALTER TYPE name OWNER TO new_owner
ALTER TYPE name RENAME ATTRIBUTE attribute_name TO new_attribute_name [ CASCADE | RESTRICT ]
ALTER TYPE name RENAME TO new_name
ALTER TYPE name SET SCHEMA new_schema
ALTER TYPE name ADD VALUE [ IF NOT EXISTS ] new_enum_value [ { BEFORE | AFTER } existing_enum_value ]
ALTER TYPE name SET DEFAULT ENCODING ( storage_directive )

其中 action是下列选项之一:
  
  ADD ATTRIBUTE attribute_name data_type [ COLLATE collation ] [ CASCADE | RESTRICT ]
  DROP ATTRIBUTE [ IF EXISTS ] attribute_name [ CASCADE | RESTRICT ]
  ALTER ATTRIBUTE attribute_name [ SET DATA ] TYPE data_type [ COLLATE collation ] [ CASCADE | RESTRICT ]

See ALTER TYPE for more information.

ALTER USER

更改数据库用户(角色)的定义。

ALTER USER name RENAME TO newname

ALTER USER name SET config_parameter {TO | =} {value | DEFAULT}

ALTER USER name RESET config_parameter

ALTER USER name RESOURCE QUEUE {queue_name | NONE}

ALTER USER name RESOURCE GROUP {group_name | NONE}

ALTER USER name [ [WITH] option [ ... ] ]

See ALTER USER for more information.

ALTER USER MAPPING

更改外部服务器的用户映射的定义。

ALTER USER MAPPING FOR { username | USER | CURRENT_USER | PUBLIC }
    SERVER servername
    OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] )

See ALTER USER MAPPING for more information.

ALTER VIEW

更改一个视图的定义。

ALTER VIEW [ IF EXISTS ] name ALTER [ COLUMN ] column_name SET DEFAULT expression

ALTER VIEW [ IF EXISTS ] name ALTER [ COLUMN ] column_name DROP DEFAULT

ALTER VIEW [ IF EXISTS ] name OWNER TO new_owner

ALTER VIEW [ IF EXISTS ] name RENAME TO new_name

ALTER VIEW [ IF EXISTS ] name SET SCHEMA new_schema

ALTER VIEW [ IF EXISTS ] name SET ( view_option_name [= view_option_value] [, ... ] )

ALTER VIEW [ IF EXISTS ] name RESET ( view_option_name [, ... ] )

See ALTER VIEW for more information.

ANALYZE

收集有关一个数据库的统计信息。

ANALYZE [VERBOSE] [table [ (column [, ...] ) ]]

ANALYZE [VERBOSE] {root_partition|leaf_partition} [ (column [, ...] )] 

ANALYZE [VERBOSE] ROOTPARTITION {ALL | root_partition [ (column [, ...] )]}

See ANALYZE for more information.

BEGIN

启动事务块。

BEGIN [WORK | TRANSACTION] [transaction_mode]

See BEGIN for more information.

CHECKPOINT

强制执行事务日志检查点。

CHECKPOINT

See CHECKPOINT for more information.

CLOSE

关闭游标。

CLOSE cursor_name

See CLOSE for more information.

CLUSTER

根据索引对磁盘上的堆存储表进行物理重新排序。 在Greenplum数据库中不建议执行此操作。

CLUSTER indexname ON tablename
CLUSTER [VERBOSE] tablename
CLUSTER [VERBOSE]

See CLUSTER for more information.

COMMENT

定义或更改对象的注释。

COMMENT ON
{ TABLE object_name |
  COLUMN relation_name.column_name |
  AGGREGATE agg_name (agg_type [, ...]) |
  CAST (source_type AS target_type) |
  COLLATION object_name
  CONSTRAINT constraint_name ON table_name |
  CONVERSION object_name |
  DATABASE object_name |
  DOMAIN object_name |
  EXTENSION object_name |
  FOREIGN DATA WRAPPER object_name |
  FOREIGN TABLE object_name |
  FUNCTION func_name ([[argmode] [argname] argtype [, ...]]) |
  INDEX object_name |
  LARGE OBJECT large_object_oid |
  OPERATOR operator_name (left_type, right_type) |
  OPERATOR CLASS object_name USING index_method |
  [PROCEDURAL] LANGUAGE object_name |
  RESOURCE GROUP object_name |
  RESOURCE QUEUE object_name |
  ROLE object_name |
  RULE rule_name ON table_name |
  SCHEMA object_name |
  SEQUENCE object_name |
  SERVER object_name |
  TABLESPACE object_name |
  TRIGGER trigger_name ON table_name |
  TYPE object_name |
  VIEW object_name }
IS 'text'

See COMMENT for more information.

COMMIT

提交当前事务。

COMMIT [WORK | TRANSACTION]

See COMMIT for more information.

COPY

在文件和表之间复制数据。

COPY table_name [(column_name [, ...])]
FROM {'filename' | PROGRAM 'command' | STDIN}
[ [ WITH ] ( option [, ...] ) ]
[ ON SEGMENT ]

COPY { table_name [(column_name [, ...])] | (query)}
     TO {'filename' | PROGRAM 'command' | STDOUT}
     [ [ WITH ] ( option [, ...] ) ]
     [ ON SEGMENT ]

See COPY for more information.

CREATE AGGREGATE

定义一个新的聚集函数

CREATE AGGREGATE name ( [ argmode ] [ ] arg_data_type [ , ... ] ) (
    SFUNC = sfunc,
    STYPE = state_data_type
    [ , SSPACE = state_data_size ]
    [ , FINALFUNC = ffunc ]
    [ , FINALFUNC_EXTRA ]
    [ , COMBINEFUNC = combinefunc ]
    [ , SERIALFUNC = serialfunc ]
    [ , DESERIALFUNC = deserialfunc ]
    [ , INITCOND = initial_condition ]
    [ , MSFUNC = msfunc ]
    [ , MINVFUNC = minvfunc ]
    [ , MSTYPE = mstate_data_type ]
    [ , MSSPACE = mstate_data_size ]
    [ , MFINALFUNC = mffunc ]
    [ , MFINALFUNC_EXTRA ]
    [ , MINITCOND = minitial_condition ]
    [ , SORTOP = sort_operator ]
  )

  CREATE AGGREGATE name ( [ [ argmode ] [ argname ] arg_data_type [ , ... ] ]
      ORDER BY [ argmode ] [ argname ] arg_data_type [ , ... ] ) (
    SFUNC = sfunc,
    STYPE = state_data_type
    [ , SSPACE = state_data_size ]
    [ , FINALFUNC = ffunc ]
    [ , FINALFUNC_EXTRA ]
    [ , COMBINEFUNC = combinefunc ]
    [ , SERIALFUNC = serialfunc ]
    [ , DESERIALFUNC = deserialfunc ]
    [ , INITCOND = initial_condition ]
    [ , HYPOTHETICAL ]
  )

  or the old syntax

  CREATE AGGREGATE name (
    BASETYPE = base_type,
    SFUNC = sfunc,
    STYPE = state_data_type
    [ , SSPACE = state_data_size ]
    [ , FINALFUNC = ffunc ]
    [ , FINALFUNC_EXTRA ]
    [ , COMBINEFUNC = combinefunc ]
    [ , SERIALFUNC = serialfunc ]
    [ , DESERIALFUNC = deserialfunc ]
    [ , INITCOND = initial_condition ]
    [ , MSFUNC = msfunc ]
    [ , MINVFUNC = minvfunc ]
    [ , MSTYPE = mstate_data_type ]
    [ , MSSPACE = mstate_data_size ]
    [ , MFINALFUNC = mffunc ]
    [ , MFINALFUNC_EXTRA ]
    [ , MINITCOND = minitial_condition ]
    [ , SORTOP = sort_operator ]
  )

See CREATE AGGREGATE for more information.

CREATE CAST

定义一种新的造型。

CREATE CAST (sourcetype AS targettype)
       WITH FUNCTION funcname (argtype [, ...])
       [AS ASSIGNMENT | AS IMPLICIT]

CREATE CAST (sourcetype AS targettype)
       WITHOUT FUNCTION
       [AS ASSIGNMENT | AS IMPLICIT]

CREATE CAST (sourcetype AS targettype)
       WITH INOUT
       [AS ASSIGNMENT | AS IMPLICIT]

See CREATE CAST for more information.

CREATE COLLATION

使用指定的操作系统语言环境或通过复制现有的排序规则来定义新的排序规则。

CREATE COLLATION name (    
    [ LOCALE = locale, ]    
    [ LC_COLLATE = lc_collate, ]    
    [ LC_CTYPE = lc_ctype ])

CREATE COLLATION name FROM existing_collation

See CREATE COLLATION for more information.

CREATE CONVERSION

定义新的编码转换。

CREATE [DEFAULT] CONVERSION name FOR source_encoding TO
    dest_encoding FROM funcname

See CREATE CONVERSION for more information.

CREATE DATABASE

创建一个新的数据库。

CREATE DATABASE name [ [WITH] [OWNER [=] user_name]
                [TEMPLATE [=] template]
                [ENCODING [=] encoding]
                [LC_COLLATE [=] lc_collate]
                [LC_CTYPE [=] lc_ctype]
                [TABLESPACE [=] tablespace]
                [CONNECTION LIMIT [=] connlimit ] ]

See CREATE DATABASE for more information.

CREATE DOMAIN

定义一个新域。

CREATE DOMAIN name [AS] data_type [DEFAULT expression]
        [ COLLATE collation ]
        [ CONSTRAINT constraint_name
        | NOT NULL | NULL
        | CHECK (expression) [...]]

See CREATE DOMAIN for more information.

CREATE EXTENSION

Registers an extension in a Greenplum database.

CREATE EXTENSION [ IF NOT EXISTS ] extension_name
  [ WITH ] [ SCHEMA schema_name ]
           [ VERSION version ]
           [ FROM old_version ]
           [ CASCADE ]

See CREATE EXTENSION for more information.

CREATE EXTERNAL TABLE

定义一个新的外部表。

CREATE [READABLE] EXTERNAL [TEMPORARY | TEMP] TABLE table_name     
    ( column_name data_type [, ...] | LIKE other_table )
     LOCATION ('file://seghost[:port]/path/file' [, ...])
       | ('gpfdist://filehost[:port]/file_pattern[#transform=trans_name]'
           [, ...]
       | ('gpfdists://filehost[:port]/file_pattern[#transform=trans_name]'
           [, ...])
       | ('pxf://path-to-data?PROFILE=profile_name[&SERVER=server_name][&custom-option=value[...]]'))
       | ('s3://S3_endpoint[:port]/bucket_name/[S3_prefix] [region=S3-region] [config=config_file]')
     [ON MASTER]
     FORMAT 'TEXT' 
           [( [HEADER]
              [DELIMITER [AS] 'delimiter' | 'OFF']
              [NULL [AS] 'null string']
              [ESCAPE [AS] 'escape' | 'OFF']
              [NEWLINE [ AS ] 'LF' | 'CR' | 'CRLF']
              [FILL MISSING FIELDS] )]
          | 'CSV'
           [( [HEADER]
              [QUOTE [AS] 'quote'] 
              [DELIMITER [AS] 'delimiter']
              [NULL [AS] 'null string']
              [FORCE NOT NULL column [, ...]]
              [ESCAPE [AS] 'escape']
              [NEWLINE [ AS ] 'LF' | 'CR' | 'CRLF']
              [FILL MISSING FIELDS] )]
          | 'CUSTOM' (Formatter=<formatter_specifications>)
    [ ENCODING 'encoding' ]
      [ [LOG ERRORS] SEGMENT REJECT LIMIT count
      [ROWS | PERCENT] ]

CREATE [READABLE] EXTERNAL WEB [TEMPORARY | TEMP] TABLE table_name     
   ( column_name data_type [, ...] | LIKE other_table )
      LOCATION ('http://webhost[:port]/path/file' [, ...])
    | EXECUTE 'command' [ON ALL 
                          | MASTER
                          | number_of_segments
                          | HOST ['segment_hostname'] 
                          | SEGMENT segment_id ]
      FORMAT 'TEXT' 
            [( [HEADER]
               [DELIMITER [AS] 'delimiter' | 'OFF']
               [NULL [AS] 'null string']
               [ESCAPE [AS] 'escape' | 'OFF']
               [NEWLINE [ AS ] 'LF' | 'CR' | 'CRLF']
               [FILL MISSING FIELDS] )]
           | 'CSV'
            [( [HEADER]
               [QUOTE [AS] 'quote'] 
               [DELIMITER [AS] 'delimiter']
               [NULL [AS] 'null string']
               [FORCE NOT NULL column [, ...]]
               [ESCAPE [AS] 'escape']
               [NEWLINE [ AS ] 'LF' | 'CR' | 'CRLF']
               [FILL MISSING FIELDS] )]
           | 'CUSTOM' (Formatter=<formatter specifications>)
     [ ENCODING 'encoding' ]
     [ [LOG ERRORS] SEGMENT REJECT LIMIT count
       [ROWS | PERCENT] ]

CREATE WRITABLE EXTERNAL [TEMPORARY | TEMP] TABLE table_name
    ( column_name data_type [, ...] | LIKE other_table )
     LOCATION('gpfdist://outputhost[:port]/filename[#transform=trans_name]'
          [, ...])
      | ('gpfdists://outputhost[:port]/file_pattern[#transform=trans_name]'
          [, ...])
      FORMAT 'TEXT' 
               [( [DELIMITER [AS] 'delimiter']
               [NULL [AS] 'null string']
               [ESCAPE [AS] 'escape' | 'OFF'] )]
          | 'CSV'
               [([QUOTE [AS] 'quote'] 
               [DELIMITER [AS] 'delimiter']
               [NULL [AS] 'null string']
               [FORCE QUOTE column [, ...]] | * ]
               [ESCAPE [AS] 'escape'] )]

           | 'CUSTOM' (Formatter=<formatter specifications>)
    [ ENCODING 'write_encoding' ]
    [ DISTRIBUTED BY ({column [opclass]}, [ ... ] ) | DISTRIBUTED RANDOMLY ]

CREATE WRITABLE EXTERNAL [TEMPORARY | TEMP] TABLE table_name
    ( column_name data_type [, ...] | LIKE other_table )
     LOCATION('s3://S3_endpoint[:port]/bucket_name/[S3_prefix] [region=S3-region] [config=config_file]')
      [ON MASTER]
      FORMAT 'TEXT' 
               [( [DELIMITER [AS] 'delimiter']
               [NULL [AS] 'null string']
               [ESCAPE [AS] 'escape' | 'OFF'] )]
          | 'CSV'
               [([QUOTE [AS] 'quote'] 
               [DELIMITER [AS] 'delimiter']
               [NULL [AS] 'null string']
               [FORCE QUOTE column [, ...]] | * ]
               [ESCAPE [AS] 'escape'] )]

CREATE WRITABLE EXTERNAL WEB [TEMPORARY | TEMP] TABLE table_name
    ( column_name data_type [, ...] | LIKE other_table )
    EXECUTE 'command' [ON ALL]
    FORMAT 'TEXT' 
               [( [DELIMITER [AS] 'delimiter']
               [NULL [AS] 'null string']
               [ESCAPE [AS] 'escape' | 'OFF'] )]
          | 'CSV'
               [([QUOTE [AS] 'quote'] 
               [DELIMITER [AS] 'delimiter']
               [NULL [AS] 'null string']
               [FORCE QUOTE column [, ...]] | * ]
               [ESCAPE [AS] 'escape'] )]
           | 'CUSTOM' (Formatter=<formatter specifications>)
    [ ENCODING 'write_encoding' ]
    [ DISTRIBUTED BY ({column [opclass]}, [ ... ] ) | DISTRIBUTED RANDOMLY ]

See CREATE EXTERNAL TABLE for more information.

CREATE FOREIGN DATA WRAPPER

定义一个新的外部数据包装器。

CREATE FOREIGN DATA WRAPPER name
    [ HANDLER handler_function | NO HANDLER ]
    [ VALIDATOR validator_function | NO VALIDATOR ]
    [ OPTIONS ( [ mpp_execute { 'master' | 'any' | 'all segments' } [, ] ] option 'value' [, ... ] ) ]

See CREATE FOREIGN DATA WRAPPER for more information.

CREATE FOREIGN TABLE

定义一个新的外部表。

CREATE FOREIGN TABLE [ IF NOT EXISTS ] table_name ( [
    column_name data_type [ OPTIONS ( option 'value' [, ... ] ) ] [ COLLATE collation ] [ column_constraint [ ... ] ]
      [, ... ]
] )
    SERVER server_name
  [ OPTIONS ( [ mpp_execute { 'master' | 'any' | 'all segments' } [, ] ] option 'value' [, ... ] ) ]

See CREATE FOREIGN TABLE for more information.

CREATE FUNCTION

定义一个新函数。

CREATE [OR REPLACE] FUNCTION name    
    ( [ [argmode] [argname] argtype [ { DEFAULT | = } default_expr ] [, ...] ] )
      [ RETURNS rettype
        | RETURNS TABLE ( column_name column_type [, ...] ) ]
    { LANGUAGE langname
    | WINDOW
    | IMMUTABLE | STABLE | VOLATILE | [NOT] LEAKPROOF
    | CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
    | [EXTERNAL] SECURITY INVOKER | [EXTERNAL] SECURITY DEFINER
    | EXECUTE ON { ANY | MASTER | ALL SEGMENTS }
    | COST execution_cost
    | SET configuration_parameter { TO value | = value | FROM CURRENT }
    | AS 'definition'
    | AS 'obj_file', 'link_symbol' } ...
    [ WITH ({ DESCRIBE = describe_function
           } [, ...] ) ]

See CREATE FUNCTION for more information.

CREATE GROUP

定义一个新的数据库角色。

CREATE GROUP name [[WITH] option [ ... ]]

See CREATE GROUP for more information.

CREATE INDEX

定义一个新索引。

CREATE [UNIQUE] INDEX [name] ON table_name [USING method]
       ( {column_name | (expression)} [COLLATE parameter] [opclass] [ ASC | DESC ] [ NULLS { FIRST | LAST } ] [, ...] )
       [ WITH ( storage_parameter = value [, ... ] ) ]
       [ TABLESPACE tablespace ]
       [ WHERE predicate ]

See CREATE INDEX for more information.

CREATE LANGUAGE

定义一种新的过程语言。

CREATE [ OR REPLACE ] [ PROCEDURAL ] LANGUAGE name

CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE name
    HANDLER call_handler [ INLINE inline_handler ] 
   [ VALIDATOR valfunction ]
            

See CREATE LANGUAGE for more information.

CREATE OPERATOR

定义一个新的运算符。

CREATE OPERATOR name (
        PROCEDURE = funcname
        [, LEFTARG = lefttype] [, RIGHTARG = righttype]
        [, COMMUTATOR = com_op] [, NEGATOR = neg_op]
        [, RESTRICT = res_proc] [, JOIN = join_proc]
        [, HASHES] [, MERGES] )

See CREATE OPERATOR for more information.

CREATE OPERATOR CLASS

定义一个新的运算符类。

CREATE OPERATOR CLASS name [DEFAULT] FOR TYPE data_type  
  USING index_method [ FAMILY family_name ] AS
  { OPERATOR strategy_number operator_name [ ( op_type, op_type ) ] [ FOR SEARCH | FOR ORDER BY sort_family_name ]
  | FUNCTION support_number funcname (argument_type [, ...] )
  | STORAGE storage_type
  } [, ... ]

See CREATE OPERATOR CLASS for more information.

CREATE OPERATOR FAMILY

定义一个新的运算符族。

CREATE OPERATOR FAMILY name  USING index_method

See CREATE OPERATOR FAMILY for more information.

CREATE PROTOCOL

注册自定义数据访问协议,该协议可以在定义Greenplum数据库外部表时指定。

CREATE [TRUSTED] PROTOCOL name (
   [readfunc='read_call_handler'] [, writefunc='write_call_handler']
   [, validatorfunc='validate_handler' ])

See CREATE PROTOCOL for more information.

CREATE RESOURCE GROUP

定义一个新的资源组。

CREATE RESOURCE GROUP name WITH (group_attribute=value [, ... ])

See CREATE RESOURCE GROUP for more information.

CREATE RESOURCE QUEUE

定义一个新的资源队列。

CREATE RESOURCE QUEUE name WITH (queue_attribute=value [, ... ])

See CREATE RESOURCE QUEUE for more information.

CREATE ROLE

定义一个新的数据库角色(用户或组)。

CREATE ROLE name [[WITH] option [ ... ]]

See CREATE ROLE for more information.

CREATE RULE

定义新的重写规则。

CREATE [OR REPLACE] RULE name AS ON event
  TO table_name [WHERE condition]
  DO [ALSO | INSTEAD] { NOTHING | command | (command; command
  ...) }

See CREATE RULE for more information.

CREATE SCHEMA

定义一个新的模式。

CREATE SCHEMA schema_name [AUTHORIZATION username]
    [schema_element [ ... ]]

CREATE SCHEMA AUTHORIZATION rolename [schema_element [ ... ]]

CREATE SCHEMA IF NOT EXISTS schema_name [ AUTHORIZATION user_name ]

CREATE SCHEMA IF NOT EXISTS AUTHORIZATION user_name

See CREATE SCHEMA for more information.

CREATE SEQUENCE

定义一个新的序列生成器。

CREATE [TEMPORARY | TEMP] SEQUENCE name
        [INCREMENT [BY] value]
        [MINVALUE minvalue | NO MINVALUE]
        [MAXVALUE maxvalue | NO MAXVALUE]
        [START [ WITH ] start]
        [CACHE cache]
        [[NO] CYCLE]
        [OWNED BY { table.column | NONE }]

See CREATE SEQUENCE for more information.

CREATE SERVER

定义一个新的外部服务器。

CREATE SERVER server_name [ TYPE 'server_type' ] [ VERSION 'server_version' ]
    FOREIGN DATA WRAPPER fdw_name
    [ OPTIONS ( [ mpp_execute { 'master' | 'any' | 'all segments' } [, ] ] option 'value' [, ... ] ) ]

See CREATE SERVER for more information.

CREATE TABLE

定义一个新表。

CREATE [ [GLOBAL | LOCAL] {TEMPORARY | TEMP } | UNLOGGED] TABLE [IF NOT EXISTS]
    table_name (
    [ { column_name data_type [ COLLATE collation ] [column_constraint [ ... ] ]
[ ENCODING ( storage_directive [, ...] ) ]
    | table_constraint
    | LIKE source_table [ like_option ... ] }
    | [ column_reference_storage_directive [, ...]
    [, ... ]
] )
[ INHERITS ( parent_table [, ... ] ) ]
[ WITH ( storage_parameter [=value] [, ... ] ) 
       | WITH OIDS | WITHOUT OIDS ]
[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
[ TABLESPACE tablespace_name ]
[ DISTRIBUTED BY (column [opclass], [ ... ] ) 
       | DISTRIBUTED RANDOMLY | DISTRIBUTED REPLICATED ]
[ PARTITION BY partition_type (column)
       [ SUBPARTITION BY partition_type (column) ] 
          [ SUBPARTITION TEMPLATE ( template_spec ) ]
       [...]
    ( partition_spec ) 
        | [ SUBPARTITION BY partition_type (column) ]
          [...]
    ( partition_spec
      [ ( subpartition_spec
           [(...)] 
         ) ] 
    ) ]

CREATE [ [GLOBAL | LOCAL] {TEMPORARY | TEMP} | UNLOGGED ] TABLE [IF NOT EXISTS] 
   table_name
    OF type_name [ (
  { column_name WITH OPTIONS [ column_constraint [ ... ] ]
    | table_constraint } 
    [, ... ]
) ]
[ WITH ( storage_parameter [=value] [, ... ] ) | WITH OIDS | WITHOUT OIDS ]
[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
[ TABLESPACE tablespace_name ]

See CREATE TABLE for more information.

CREATE TABLE AS

根据查询结果定义一个新表。

CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE table_name
        [ (column_name [, ...] ) ]
        [ WITH ( storage_parameter [= value] [, ... ] ) | WITH OIDS | WITHOUT OIDS ]
        [ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
        [ TABLESPACE tablespace_name ]
        AS query
        [ WITH [ NO ] DATA ]
        [ DISTRIBUTED BY (column [, ... ] ) | DISTRIBUTED RANDOMLY | DISTRIBUTED REPLICATED ]
      

See CREATE TABLE AS for more information.

CREATE TABLESPACE

定义一个新的表空间。

CREATE TABLESPACE tablespace_name [OWNER username]  LOCATION '/path/to/dir' 
   [WITH (contentID_1='/path/to/dir1'[, contentID_2='/path/to/dir2' ... ])]

See CREATE TABLESPACE for more information.

CREATE TEXT SEARCH CONFIGURATION

定义新的文本搜索配置。

CREATE TEXT SEARCH CONFIGURATION name (
    PARSER = parser_name |
    COPY = source_config
)

See CREATE TEXT SEARCH CONFIGURATION for more information.

CREATE TEXT SEARCH DICTIONARY

定义一个新的文本搜索字典。

CREATE TEXT SEARCH DICTIONARY name (
    TEMPLATE = template
    [, option = value [, ... ]]
)

See CREATE TEXT SEARCH DICTIONARY for more information.

CREATE TEXT SEARCH PARSER

定义一个新的文本搜索解析器。

CREATE TEXT SEARCH PARSER name (
    START = start_function ,
    GETTOKEN = gettoken_function ,
    END = end_function ,
    LEXTYPES = lextypes_function
    [, HEADLINE = headline_function ]
)

See CREATE TEXT SEARCH PARSER for more information.

CREATE TEXT SEARCH TEMPLATE

定义一个新的文本搜索模板。

CREATE TEXT SEARCH TEMPLATE name (
    [ INIT = init_function , ]
    LEXIZE = lexize_function
)

See CREATE TEXT SEARCH TEMPLATE for more information.

CREATE TYPE

定义新的数据类型。

CREATE TYPE name AS
( attribute_name data_type [ COLLATE collation ] [, ... ] ] )

CREATE TYPE name AS ENUM 
    ( [ 'label' [, ... ] ] )

CREATE TYPE name AS RANGE (
    SUBTYPE = subtype
    [ , SUBTYPE_OPCLASS = subtype_operator_class ]
    [ , COLLATION = collation ]
    [ , CANONICAL = canonical_function ]
    [ , SUBTYPE_DIFF = subtype_diff_function ]
)

CREATE TYPE name (
    INPUT = input_function,
    OUTPUT = output_function
    [, RECEIVE = receive_function]
    [, SEND = send_function]
    [, TYPMOD_IN = type_modifier_input_function ]
    [, TYPMOD_OUT = type_modifier_output_function ]
    [, INTERNALLENGTH = {internallength | VARIABLE}]
    [, PASSEDBYVALUE]
    [, ALIGNMENT = alignment]
    [, STORAGE = storage]
    [, LIKE = like_type
    [, CATEGORY = category]
    [, PREFERRED = preferred]
    [, DEFAULT = default]
    [, ELEMENT = element]
    [, DELIMITER = delimiter]
    [, COLLATABLE = collatable]
    [, COMPRESSTYPE = compression_type]
    [, COMPRESSLEVEL = compression_level]
    [, BLOCKSIZE = blocksize] )

CREATE TYPE name

See CREATE TYPE for more information.

CREATE USER

默认情况下,使用LOGIN特权定义一个新的数据库角色。

CREATE USER name [[WITH] option [ ... ]]

See CREATE USER for more information.

CREATE USER MAPPING

定义用户到外部服务器的新映射。

CREATE USER MAPPING FOR { username | USER | CURRENT_USER | PUBLIC }
    SERVER servername
    [ OPTIONS ( option 'value' [, ... ] ) ]

See CREATE USER MAPPING for more information.

CREATE VIEW

定义一个新的视图。

CREATE [OR REPLACE] [TEMP | TEMPORARY] [RECURSIVE] VIEW name
             [ ( column_name [, ...] ) ]
    [ WITH ( view_option_name [= view_option_value] [, ... ] ) ]
    AS query
    [ WITH [ CASCADED | LOCAL ] CHECK OPTION ]

See CREATE VIEW for more information.

DEALLOCATE

取消分配预编译语句。

DEALLOCATE [PREPARE] name

See DEALLOCATE for more information.

DECLARE

定义一个游标。

DECLARE name [BINARY] [INSENSITIVE] [NO SCROLL] CURSOR 
     [{WITH | WITHOUT} HOLD] 
     FOR query [FOR READ ONLY]

See DECLARE for more information.

DELETE

从表中删除行。

[ WITH [ RECURSIVE ] with_query [, ...] ]
DELETE FROM [ONLY] table [[AS] alias]
      [USING usinglist]
      [WHERE condition | WHERE CURRENT OF cursor_name]
      [RETURNING * | output_expression [[AS] output_name] [, …]]

See DELETE for more information.

DISCARD

放弃会话状态。

DISCARD { ALL | PLANS | TEMPORARY | TEMP }

See DISCARD for more information.

DROP AGGREGATE

删除聚合函数。

DROP AGGREGATE [IF EXISTS] name ( type [, ...] ) [CASCADE | RESTRICT]

See DROP AGGREGATE for more information.

DO

执行匿名代码块作为临时匿名函数。

DO [ LANGUAGE lang_name ] code

See DO for more information.

DROP CAST

删除一个造型。

DROP CAST [IF EXISTS] (sourcetype AS targettype) [CASCADE | RESTRICT]

See DROP CAST for more information.

DROP COLLATION

删除以前定义的排序规则。

DROP COLLATION [ IF EXISTS ] name [ CASCADE | RESTRICT ]

See DROP COLLATION for more information.

DROP CONVERSION

删除转换。

DROP CONVERSION [IF EXISTS] name [CASCADE | RESTRICT]

See DROP CONVERSION for more information.

DROP DATABASE

删除数据库。

DROP DATABASE [IF EXISTS] name

See DROP DATABASE for more information.

DROP DOMAIN

删除域。

DROP DOMAIN [IF EXISTS] name [, ...] [CASCADE | RESTRICT]

See DROP DOMAIN for more information.

DROP EXTENSION

从Greenplum数据库中删除扩展。

DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]

See DROP EXTENSION for more information.

DROP EXTERNAL TABLE

删除外部表定义。

DROP EXTERNAL [WEB] TABLE [IF EXISTS] name [CASCADE | RESTRICT]

See DROP EXTERNAL TABLE for more information.

DROP FOREIGN DATA WRAPPER

删除外部数据包装器。

DROP FOREIGN DATA WRAPPER [ IF EXISTS ] name [ CASCADE | RESTRICT ]

See DROP FOREIGN DATA WRAPPER for more information.

DROP FOREIGN TABLE

删除外部表。

DROP FOREIGN TABLE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]

See DROP FOREIGN TABLE for more information.

DROP FUNCTION

删除函数。

DROP FUNCTION [IF EXISTS] name ( [ [argmode] [argname] argtype
                [, ...] ] ) [CASCADE | RESTRICT]

See DROP FUNCTION for more information.

DROP GROUP

删除数据库角色。

DROP GROUP [IF EXISTS] name [, ...]

See DROP GROUP for more information.

DROP INDEX

删除索引。

DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]

See DROP INDEX for more information.

DROP LANGUAGE

删除过程语言。

DROP [PROCEDURAL] LANGUAGE [IF EXISTS] name [CASCADE | RESTRICT]

See DROP LANGUAGE for more information.

DROP OPERATOR

删除运算符。

DROP OPERATOR [IF EXISTS] name ( {lefttype | NONE} ,
    {righttype | NONE} ) [CASCADE | RESTRICT]

See DROP OPERATOR for more information.

DROP OPERATOR CLASS

删除运算符类。

DROP OPERATOR CLASS [IF EXISTS] name USING index_method [CASCADE | RESTRICT]

See DROP OPERATOR CLASS for more information.

DROP OPERATOR FAMILY

删除一个运算符族

DROP OPERATOR FAMILY [IF EXISTS] name USING index_method [CASCADE | RESTRICT]

See DROP OPERATOR FAMILY for more information.

DROP OWNED

删除数据库角色拥有的数据库对象。

DROP OWNED BY name [, ...] [CASCADE | RESTRICT]

See DROP OWNED for more information.

DROP PROTOCOL

从数据库中删除外部表数据访问协议。

DROP PROTOCOL [IF EXISTS] name

See DROP PROTOCOL for more information.

DROP RESOURCE GROUP

删除资源组。

DROP RESOURCE GROUP group_name

See DROP RESOURCE GROUP for more information.

DROP RESOURCE QUEUE

删除资源队列。

DROP RESOURCE QUEUE queue_name

See DROP RESOURCE QUEUE for more information.

DROP ROLE

删除数据库角色。

DROP ROLE [IF EXISTS] name [, ...]

See DROP ROLE for more information.

DROP RULE

删除重写规则。

DROP RULE [IF EXISTS] name ON table_name [CASCADE | RESTRICT]

See DROP RULE for more information.

DROP SCHEMA

删除模式。

DROP SCHEMA [IF EXISTS] name [, ...] [CASCADE | RESTRICT]

See DROP SCHEMA for more information.

DROP SEQUENCE

删除序列。

DROP SEQUENCE [IF EXISTS] name [, ...] [CASCADE | RESTRICT]

See DROP SEQUENCE for more information.

DROP SERVER

删除外部服务器描述符。

DROP SERVER [ IF EXISTS ] servername [ CASCADE | RESTRICT ]

See DROP SERVER for more information.

DROP TABLE

删除表。

DROP TABLE [IF EXISTS] name [, ...] [CASCADE | RESTRICT]

See DROP TABLE for more information.

DROP TABLESPACE

删除表空间。

DROP TABLESPACE [IF EXISTS] tablespacename

See DROP TABLESPACE for more information.

DROP TEXT SEARCH CONFIGURATION

删除文本搜索配置。

DROP TEXT SEARCH CONFIGURATION [ IF EXISTS ] name [ CASCADE | RESTRICT ]

See DROP TEXT SEARCH CONFIGURATION for more information.

DROP TEXT SEARCH DICTIONARY

删除文本搜索字典。

DROP TEXT SEARCH DICTIONARY [ IF EXISTS ] name [ CASCADE | RESTRICT ]

See DROP TEXT SEARCH DICTIONARY for more information.

DROP TEXT SEARCH PARSER

删除文本搜索解析器。

DROP TEXT SEARCH PARSER [ IF EXISTS ] name [ CASCADE | RESTRICT ]

See DROP TEXT SEARCH PARSER for more information.

DROP TEXT SEARCH TEMPLATE

删除文本搜索模板。

DROP TEXT SEARCH TEMPLATE [ IF EXISTS ] name [ CASCADE | RESTRICT ]

See DROP TEXT SEARCH TEMPLATE for more information.

DROP TYPE

删除数据类型。

DROP TYPE [IF EXISTS] name [, ...] [CASCADE | RESTRICT]

See DROP TYPE for more information.

DROP USER

删除数据库角色。

DROP USER [IF EXISTS] name [, ...]

See DROP USER for more information.

DROP USER MAPPING

删除外部服务器的用户映射。

DROP USER MAPPING [ IF EXISTS ] { username | USER | CURRENT_USER | PUBLIC } 
    SERVER servername

See DROP USER MAPPING for more information.

DROP VIEW

删除视图。

DROP VIEW [IF EXISTS] name [, ...] [CASCADE | RESTRICT]

See DROP VIEW for more information.

END

提交当前事务。

END [WORK | TRANSACTION]

See END for more information.

EXECUTE

执行准备好的SQL语句。

EXECUTE name [ (parameter [, ...] ) ]

See EXECUTE for more information.

EXPLAIN

显示语句的查询计划。

EXPLAIN [ ( option [, ...] ) ] statement
EXPLAIN [ANALYZE] [VERBOSE] statement

See EXPLAIN for more information.

FETCH

使用游标从查询中检索行。

FETCH [ forward_direction { FROM | IN } ]
                cursor_name
            

See FETCH for more information.

GRANT

定义访问权限。

GRANT { {SELECT | INSERT | UPDATE | DELETE | REFERENCES |
TRIGGER | TRUNCATE } [, ...] | ALL [PRIVILEGES] }
    ON { [TABLE] table_name [, ...]
         | ALL TABLES IN SCHEMA schema_name [, ...] }
    TO { [ GROUP ] role_name | PUBLIC} [, ...] [ WITH GRANT OPTION ]

GRANT { { SELECT | INSERT | UPDATE | REFERENCES } ( column_name [, ...] )
    [, ...] | ALL [ PRIVILEGES ] ( column_name [, ...] ) }
    ON [ TABLE ] table_name [, ...]
    TO { role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ]

GRANT { {USAGE | SELECT | UPDATE} [, ...] | ALL [PRIVILEGES] }
    ON { SEQUENCE sequence_name [, ...]
         | ALL SEQUENCES IN SCHEMA schema_name [, ...] }
    TO { [ GROUP ] role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ]

GRANT { {CREATE | CONNECT | TEMPORARY | TEMP} [, ...] | ALL
[PRIVILEGES] }
    ON DATABASE database_name [, ...]
    TO { [ GROUP ] role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ]

GRANT { USAGE | ALL [ PRIVILEGES ] }
    ON DOMAIN domain_name [, ...]
    TO { [ GROUP ] role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ]

GRANT { USAGE | ALL [ PRIVILEGES ] }
    ON FOREIGN DATA WRAPPER fdw_name [, ...]
    TO { [ GROUP ] role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ]

GRANT { USAGE | ALL [ PRIVILEGES ] }
    ON FOREIGN SERVER server_name [, ...]
    TO { [ GROUP ] role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ]

GRANT { EXECUTE | ALL [PRIVILEGES] }
    ON { FUNCTION function_name ( [ [ argmode ] [ argname ] argtype [, ...]
] ) [, ...]
         | ALL FUNCTIONS IN SCHEMA schema_name [, ...] }
    TO { [ GROUP ] role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ]

GRANT { USAGE | ALL [PRIVILEGES] }
    ON LANGUAGE lang_name [, ...]
    TO { [ GROUP ] role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ]

GRANT { { CREATE | USAGE } [, ...] | ALL [PRIVILEGES] }
    ON SCHEMA schema_name [, ...]
    TO { [ GROUP ] role_name | PUBLIC} [, ...] [ WITH GRANT OPTION ]

GRANT { CREATE | ALL [PRIVILEGES] }
    ON TABLESPACE tablespace_name [, ...]
    TO { [ GROUP ] role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ]

GRANT { USAGE | ALL [ PRIVILEGES ] }
    ON TYPE type_name [, ...]
    TO { [ GROUP ] role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ]

GRANT parent_role [, ...]
    TO member_role [, ...] [WITH ADMIN OPTION]

GRANT { SELECT | INSERT | ALL [PRIVILEGES] }
    ON PROTOCOL protocolname
    TO username

See GRANT for more information.

INSERT

在表中创建新行。

[ WITH [ RECURSIVE ] with_query [, ...] ]
INSERT INTO table [( column [, ...] )]
   {DEFAULT VALUES | VALUES ( {expression | DEFAULT} [, ...] ) [, ...] | query}
   [RETURNING * | output_expression [[AS] output_name] [, ...]]

See INSERT for more information.

LOAD

加载或重新加载共享库文件。

LOAD 'filename'

See LOAD for more information.

LOCK

锁表。

LOCK [TABLE] [ONLY] name [ * ] [, ...] [IN lockmode MODE] [NOWAIT]

See LOCK for more information.

MOVE

定位游标。

MOVE [ forward_direction [ FROM | IN ] ]
                cursor_name
            

See MOVE for more information.

PREPARE

准备要执行的语句。

PREPARE name [ (datatype [, ...] ) ] AS statement

See PREPARE for more information.

REASSIGN OWNED

更改数据库角色拥有的数据库对象的所有权。

REASSIGN OWNED BY old_role [, ...] TO new_role

See REASSIGN OWNED for more information.

REINDEX

重建索引。

REINDEX {INDEX | TABLE | DATABASE | SYSTEM} name

See REINDEX for more information.

RELEASE SAVEPOINT

销毁先前定义的保存点。

RELEASE [SAVEPOINT] savepoint_name

See RELEASE SAVEPOINT for more information.

RESET

将系统配置参数的值恢复为默认值。

RESET configuration_parameter

RESET ALL

See RESET for more information.

REVOKE

删除访问权限。

REVOKE [GRANT OPTION FOR] { {SELECT | INSERT | UPDATE | DELETE
        | REFERENCES | TRIGGER | TRUNCATE } [, ...] | ALL [PRIVILEGES] }

        ON { [TABLE] table_name [, ...]
            | ALL TABLES IN SCHEMA schema_name [, ...] }
        FROM { [ GROUP ] role_name | PUBLIC} [, ...]
        [CASCADE | RESTRICT]

REVOKE [ GRANT OPTION FOR ] { { SELECT | INSERT | UPDATE
       | REFERENCES } ( column_name [, ...] )
       [, ...] | ALL [ PRIVILEGES ] ( column_name [, ...] ) }
       ON [ TABLE ] table_name [, ...]
       FROM { [ GROUP ]  role_name | PUBLIC } [, ...]
       [ CASCADE | RESTRICT ]

REVOKE [GRANT OPTION FOR] { {USAGE | SELECT | UPDATE} [,...]
       | ALL [PRIVILEGES] }
       ON { SEQUENCE sequence_name [, ...]
            | ALL SEQUENCES IN SCHEMA schema_name [, ...] }
       FROM { [ GROUP ] role_name | PUBLIC } [, ...]
       [CASCADE | RESTRICT]

REVOKE [GRANT OPTION FOR] { {CREATE | CONNECT
       | TEMPORARY | TEMP} [, ...] | ALL [PRIVILEGES] }
       ON DATABASE database_name [, ...]
       FROM { [ GROUP ] role_name | PUBLIC} [, ...]
       [CASCADE | RESTRICT]

REVOKE [ GRANT OPTION FOR ]
       { USAGE | ALL [ PRIVILEGES ] }
       ON DOMAIN domain_name [, ...]
       FROM { [ GROUP ] role_name | PUBLIC } [, ...]
       [ CASCADE | RESTRICT ]

REVOKE [ GRANT OPTION FOR ]
       { USAGE | ALL [ PRIVILEGES ] }
       ON FOREIGN DATA WRAPPER fdw_name [, ...]
       FROM { [ GROUP ] role_name | PUBLIC } [, ...]
       [ CASCADE | RESTRICT ]

REVOKE [ GRANT OPTION FOR ]
       { USAGE | ALL [ PRIVILEGES ] }
       ON FOREIGN SERVER server_name [, ...]
       FROM { [ GROUP ] role_name | PUBLIC } [, ...]
       [ CASCADE | RESTRICT ]

REVOKE [GRANT OPTION FOR] {EXECUTE | ALL [PRIVILEGES]}
       ON { FUNCTION funcname ( [[argmode] [argname] argtype
                                                 [, ...]] ) [, ...]
            | ALL FUNCTIONS IN SCHEMA schema_name [, ...] }
       FROM { [ GROUP ] role_name | PUBLIC} [, ...]
       [CASCADE | RESTRICT]

REVOKE [GRANT OPTION FOR] {USAGE | ALL [PRIVILEGES]}
       ON LANGUAGE langname [, ...]
       FROM { [ GROUP ]  role_name | PUBLIC} [, ...]
       [ CASCADE | RESTRICT ]

REVOKE [GRANT OPTION FOR] { {CREATE | USAGE} [, ...]
       | ALL [PRIVILEGES] }
       ON SCHEMA schema_name [, ...]
       FROM { [ GROUP ] role_name | PUBLIC} [, ...]
       [CASCADE | RESTRICT]

REVOKE [GRANT OPTION FOR] { CREATE | ALL [PRIVILEGES] }
       ON TABLESPACE tablespacename [, ...]
       FROM { [ GROUP ] role_name | PUBLIC } [, ...]
       [CASCADE | RESTRICT]

REVOKE [ GRANT OPTION FOR ]
       { USAGE | ALL [ PRIVILEGES ] }
       ON TYPE type_name [, ...]
       FROM { [ GROUP ] role_name | PUBLIC } [, ...]
       [ CASCADE | RESTRICT ]

REVOKE [ADMIN OPTION FOR] parent_role [, ...]
       FROM [ GROUP ] member_role [, ...]
       [CASCADE | RESTRICT]

See REVOKE for more information.

ROLLBACK

中止当前事务。

ROLLBACK [WORK | TRANSACTION]

See ROLLBACK for more information.

ROLLBACK TO SAVEPOINT

将当前事务回滚到保存点。

ROLLBACK [WORK | TRANSACTION] TO [SAVEPOINT]
                savepoint_name
            

See ROLLBACK TO SAVEPOINT for more information.

SAVEPOINT

在当前事务中定义一个新的保存点。

SAVEPOINT savepoint_name

See SAVEPOINT for more information.

SELECT

从表或视图中检索行。

[ WITH [ RECURSIVE1 ] with_query [, ...] ]
SELECT [ALL | DISTINCT [ON (expression [, ...])]]
      * | expression[[AS] output_name] [, ...]
      [FROM from_item [, ...]]
      [WHERE condition]
      [GROUP BY grouping_element [, ...]]
      [HAVING condition [, ...]]
      [WINDOW window_name AS (window_definition) [, ...] ]
      [{UNION | INTERSECT | EXCEPT} [ALL | DISTINCT] select]
      [ORDER BY expression [ASC | DESC | USING operator] [NULLS {FIRST | LAST}] [, ...]]
      [LIMIT {count | ALL}]
      [OFFSET start [ ROW | ROWS ] ]
      [FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY]
      [FOR {UPDATE | NO KEY UPDATE | SHARE | KEY SHARE} [OF table_name [, ...]] [NOWAIT] [...]]

TABLE { [ ONLY ] table_name [ * ] | with_query_name }
            

See SELECT for more information.

SELECT INTO

根据查询结果定义一个新表。

[ WITH [ RECURSIVE ] with_query [, ...] ]
SELECT [ALL | DISTINCT [ON ( expression [, ...] )]]
    * | expression [AS output_name] [, ...]
    INTO [TEMPORARY | TEMP | UNLOGGED ] [TABLE] new_table
    [FROM from_item [, ...]]
    [WHERE condition]
    [GROUP BY expression [, ...]]
    [HAVING condition [, ...]]
    [{UNION | INTERSECT | EXCEPT} [ALL | DISTINCT ] select]
    [ORDER BY expression [ASC | DESC | USING operator] [NULLS {FIRST | LAST}] [, ...]]
    [LIMIT {count | ALL}]
    [OFFSET start [ ROW | ROWS ] ]
    [FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]
    [FOR {UPDATE | SHARE} [OF table_name [, ...]] [NOWAIT] 
    [...]]

See SELECT INTO for more information.

SET

更改Greenplum数据库配置参数的值。

SET [SESSION | LOCAL] configuration_parameter {TO | =} value | 'value' | DEFAULT}
SET [SESSION | LOCAL] TIME ZONE {timezone | LOCAL | DEFAULT}

See SET for more information.

SET CONSTRAINTS

设置当前事务的约束检查时间。

SET CONSTRAINTS { ALL | name [, ...] } { DEFERRED | IMMEDIATE }

See SET CONSTRAINTS for more information.

SET ROLE

设置当前会话的当前角色标识符。

SET [SESSION | LOCAL] ROLE rolename

SET [SESSION | LOCAL] ROLE NONE

RESET ROLE

See SET ROLE for more information.

SET SESSION AUTHORIZATION

设置会话角色标识符和当前会话的当前角色标识符。

SET [SESSION | LOCAL] SESSION AUTHORIZATION rolename

SET [SESSION | LOCAL] SESSION AUTHORIZATION DEFAULT

RESET SESSION AUTHORIZATION

See SET SESSION AUTHORIZATION for more information.

SET TRANSACTION

设置当前事务的特性。

SET TRANSACTION [transaction_mode] [READ ONLY | READ WRITE]

SET TRANSACTION SNAPSHOT snapshot_id

SET SESSION CHARACTERISTICS AS TRANSACTION transaction_mode 
     [READ ONLY | READ WRITE]
     [NOT] DEFERRABLE

See SET TRANSACTION for more information.

SHOW

显示系统配置参数的值。

SHOW configuration_parameter

SHOW ALL

See SHOW for more information.

START TRANSACTION

启动事务块。

START TRANSACTION [transaction_mode] [READ WRITE | READ ONLY]

See START TRANSACTION for more information.

TRUNCATE

清空表的所有行。

TRUNCATE [TABLE] [ONLY] name [ * ] [, ...]
     [ RESTART IDENTITY | CONTINUE IDENTITY ] [CASCADE | RESTRICT]
            

See TRUNCATE for more information.

UPDATE

更新表的行。

[ WITH [ RECURSIVE ] with_query [, ...] ]
                UPDATE [ONLY] table [[AS] alias]
                   SET {column = {expression | DEFAULT} |
                   (column [, ...]) = ({expression | DEFAULT} [, ...])} [, ...]
                   [FROM fromlist]
                   [WHERE condition| WHERE CURRENT OF cursor_name ]
            

See UPDATE for more information.

VACUUM

垃圾收集并可选地分析数据库。

VACUUM [({ FULL | FREEZE | VERBOSE | ANALYZE } [, ...])] [table [(column [, ...] )]]
        
VACUUM [FULL] [FREEZE] [VERBOSE] [table]

VACUUM [FULL] [FREEZE] [VERBOSE] ANALYZE
              [table [(column [, ...] )]]

See VACUUM for more information.

VALUES

计算一组行。

VALUES ( expression [, ...] ) [, ...]
                [ORDER BY sort_expression [ ASC | DESC | USING operator ] [, ...]
                ]
                [LIMIT { count | ALL } ]
                [OFFSET start [ ROW | ROWS ] ]
                [FETCH { FIRST | NEXT } [count ] { ROW | ROWS } ONLY ]
            

See VALUES for more information.