Extended Syntax

GaussDB(DWS) provides some extended syntax. Currently, they are in the Beta phase and are for internal use only.

The following table lists the extended syntax supported by GaussDB(DWS) and they are for reference only.

Table 1 Extended SQL syntax

Category

Keywords

Description

Creating a table (CREATE TABLE)

[ WITH ( {storage_parameter = value} [, ... ] ) | WITH OIDS | WITHOUT OIDS ]

Specifies whether the attribute OIDS can be specified when you create a table.

INHERITS ( parent_table [, ... ] )

Specifies whether an inherited table is supported.

DISTRIBUTE BY { REPLICATION |ROUNDROBIN | {[HASH|MODULO ] ( column_name ) } }

When this switch is turned on, the local table supports roundrobin and modulo distribution modes.

TO { GROUP groupname | NODE ( nodename [, ... ] ) }

Specifies whether users can specify table data to the list of DNs to be distributed using TO NODE/GROUP.

column_constraint:

REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ][ ON DELETE action ] [ ON UPDATE action ]

Specifies whether users can use REFERENCES reftable [ (refcolumn) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE action ] [ ON UPDATE action ] to create a foreign key constraint for a table.

table_constraint:

EXCLUDE [ USING index_method ] ( exclude_element WITH operator [, ... ] ) index_parameters [ WHERE ( predicate ) ] | FOREIGN KEY ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... ] ) ]

[ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE action ] [ ON UPDATE action ]

Specifies that users cannot use EXCLUDE [ USING index_method ] (exclude_element WITH operator [,... ]) to create an excluding constraint for a table.

Altering a table (ALTER TABLE)

TO { GROUP groupname | NODE ( nodename [, ... ] ) }

Modifies the list of DNs where table data is distributed.

DELETE NODE ( nodename [, ... ] )

Deletes the DNs on which table data is distributed.

Loading a module

CREATE EXTENSION

Loads a new module (such as DBLINK) to the current database.

ALTER EXTENSION

Modifies the loaded module.

DROP EXTENSION

Deletes the loaded module.

Aggregate functions

CREATE AGGREGATE

Defines a new aggregation function.

ALTER AGGREGATE

Modifies the definition of an aggregate function.

DROP AGGREGATE

Drops an existing function.

Operators

CREATE OPERATOR

Defines a new operator.

ALTER OPERATOR

Modifies the definition of the operator.

DROP OPERATOR

Drops an existing operator from the database.

Operator classes

CREATE OPERATOR CLASS

Defines a new operator class.

ALTER OPERATOR CLASS

Modifies the definition of an operator class.

DROP OPERATOR CLASS

Drops an existing operator family.

Operator families

CREATE OPERATOR FAMILY

Defines a new operation family.

ALTER OPERATOR FAMILY

Modifies the definition of an operator family.

DROP OPERATOR FAMILY

Deletes an existing operator family.

Text search parsers

CREATE TEXT SEARCH PARSER

Creates a text retrieval parser.

ALTER TEXT SEARCH PARSER

Modifies a text retrieval parser.

DROP TEXT SEARCH PARSER

Deletes the existing text search parser.

Text search templates

CREATE TEXT SEARCH TEMPLATE

Creates a text search template.

ALTER TEXT SEARCH TEMPLATE

Modifies the text search template.

DROP TEXT SEARCH TEMPLATE

Deletes the existing text search template.

Collation rules

CREATE COLLATION

Creates a collation rule.

The collation rule allows users to define data in the column-level, or even the collation rule and character class behaviors at the operation level.

ALTER COLLATION

Modifies the collation rule.

DROP COLLATION

Deletes the collation rule.

Requirement

CREATE RULE

Creates a rule.

A rule indicates that you are to execute some other actions when performing operations on a specified table.

DROP RULE

Deletes a rule.

Generating a notification

NOTIFY

The NOTIFY command sends a notification together with an optional "payload" string to each client that has previously executed LISTEN for a specified channel in the current database.

Listening for a notification

LISTEN

Registers a listener for the current session.

Stopping listening for a notification

UNLISTEN

Clears all listeners of this session registration.

Loading or reloading a shared library file

LOAD

Loads a shared library file to the address space of the database server.

Releasing session resources in a database

DISCARD

Releases session resources in a database.

Procedural languages

CREATE LANGUAGE

Registers a new language.

ALTER LANGUAGE

Modifies the definition of a procedural language.

DROP LANGUAGE

Deletes a procedural language.

Domain

CREATE DOMAIN

Create a domain.

ALTER DOMAIN

Modifies the definition of the existing domain.

DROP DOMAIN

Deletes a domain.

Coding conversion

CREATE CONVERSION

Defines the character set conversion.

ALTER CONVERSION

Modifies the definition of code conversion.

DROP CONVERSION

Deletes a previously defined code conversion.

Type conversion

CREATE CAST

Defines a new type conversion. This conversion is used as an example to describe how to convert between two types.

DROP CAST

Deletes a previously defined type conversion.

Creating a cursor

CURSOR name [ BINARY ] [ INSENSITIVE ] [ [ NO ] SCROLL ] [ WITH HOLD ] FOR query

INSENSITIVE:

The keyword is used only for being compatible with the SQL standard.

SCROLL: declares that the cursor can be used for reverse search.

WITH HOLD indicates that a cursor can still be used after the transaction creating the cursor is successfully submitted.

Moving a cursor

MOVE BACKWARD

A reverse mobile cursor can be used only when it is used together with SCROLL.