All Products
Search
Document Center

Hologres:List of SQL statements

Last Updated:Aug 30, 2024

Hologres is compatible with PostgreSQL. This topic describes the SQL statements supported by Hologres.

Note

For more information about how to use the SQL statements that are compatible with PostgreSQL, see official PostgreSQL documentation.

A

SQL statement

Description

ALTER TABLE

Modifies a table. Modifications to a parent partitioned table are automatically applied to the child partitioned tables. For information about how to modify partitioned tables and foreign tables, see the following topics:

ALTER ROLE

Modifies a database role.

ANALYZE

Updates statistics.

ALTER DATABASE

Modifies a database.

ALTER DEFAULT PRIVILEGES

Defines default access privileges.

ALTER FOREIGN DATA WRAPPER

Modifies a foreign data wrapper (FDW).

ALTER FOREIGN TABLE

Modifies a foreign table.

ALTER GROUP

Modifies a group.

ALTER LANGUAGE

Changes the procedural language.

ALTER SCHEMA

Modifies a schema.

ALTER SERVER

Modifies an external server.

ALTER USER

Chanages a database role.

ALTER USER MAPPING

Modifies a user mapping.

ALTER VIEW

Changes a view.

B

SQL statement

Description

BEGIN

Starts a transaction. The BEGIN statement can be used with only data definition language (DDL) statements.

C

SQL statement

Description

CALL

Calls a stored procedure or function.

COMMIT

Commits a transaction. The COMMIT statement can be used with only DDL statements.

CREATE DATABASE

Creates a database.

CREATE EXTENSION

Creates an extension.

CREATE FOREIGN DATA WRAPPER

Creates an FDW.

CREATE FOREIGN TABLE

Creates a foreign table. Hologres supports only foreign tables that are sourced from MaxCompute.

CREATE GROUP

Creates a user group.

CREATE SERVER

Creates an external server.

CREATE TABLE

Creates a table. Hologres supports only specific features of the CREATE TABLE statement in PostgreSQL. The following features are not supported:

  • UNLOGGED

  • TEMP

  • IF NOT EXISTS

  • LIKE

  • CHECK

  • DEFAULT

  • GENERATED

  • UNIQUE

  • EXCLUDE

  • FOREIGN KEY

  • DEFERRABLE

  • WITH OIDS

  • GLOBAL

  • LOCAL

Hologres supports only list partitions. The partition fields that you specify in PARTITION BY LIST must be of the STRING type and contain unique values.

CREATE VIEW

Creates a view.

CREATE USER

Creates a user.

CREATE USER MAPPING

Creates a user mapping.

CLOSE

Disables a cursor.

COMMENT

Defines or modifies the comment of an object.

CREATE LANGUAGE

Creates a procedural language.

CREATE MATERIALIZED VIEW

Creates a materialized view.

CREATE ROLE

Creates a database role.

CREATE SCHEMA

Creates a schema.

CREATE TABLE AS

Creates a table from query results.

D

SQL statement

Description

DROP DATABASE

Drops a database.

DROP FOREIGN DATA WRAPPER

Drops an FDW.

DROP FOREIGN TABLE

Drops a foreign table.

DROP GROUP

Drops a user group.

DROP OWNED

Drops the database objects that are owned by a database role.

DROP ROLE

Drops a role.

DROP SERVER

Drops an external server.

DROP TABLE

Drops a table.

DROP USER

Drops a user.

DROP USER MAPPING

Drops a user mapping.

DEALLOCATE

Releases a prepared statement.

DELETE

Deletes a row of data from a table.

DISCARD

Clears the previous session.

DROP MATERIALIZED VIEW

Drops a materialized view.

DROP SCHEMA

Drops a schema.

DROP VIEW

Drops a view.

E

SQL statement

Description

END

Commits a transaction. The END statement can be used with only DDL statements.

EXPLAIN

Views an execution plan.

EXECUTE

Executes a prepared statement.

F

SQL statement

Description

FETCH

Uses a cursor to search for rows from a query.

G

SQL statement

Description

GRANT

Defines access privileges.

I

SQL statement

Description

INSERT

Inserts data into a table.

P

SQL statement

Description

PREPARE

Prepares a statement for execution.

R

SQL statement

Description

ROLLBACK

Rolls back a transaction.

REASSIGN OWNED

Changes the ownership of database objects that are owned by a database role.

RELEASE SAVEPOINT

Destroys a previously defined savepoint.

RESET

Sets runtime parameters to their default values.

REVOKE

Revokes access privileges.

S

SQL statement

Description

SELECT

Queries data from a table. Hologres supports only specific features of the SELECT statement in PostgreSQL. The following features are not supported:

  • WITH RECURSIVE

  • TABLESAMPLE

  • LOCKING

  • ONLY

SET

Configures Grand Unified Configuration (GUC) parameters. For more information, see GUC parameters.

SAVEPOINT

Defines a new savepoint in the current transaction.

SELECT INTO

Defines a new table from query results.

SET ROLE

Sets a session identifier for the current user.

SET SESSION AUTHORIZATION

Sets a session user identifier and a current user identifier for the current session.

SET TRANSACTION

Sets the characteristics of the current transaction.

SHOW

Shows the value of a runtime parameter.

START TRANSACTION

Starts a transaction block.

T

SQL statement

Description

TRUNCATE

Clears all data from a table or a group of tables.

U

SQL statement

Description

UPDATE

Updates a row in a table.

V

SQL statement

Description

VACUUM

Collects garbage and optionally analyzes a database.

VALUES

Calculates a set of rows.