SQL Grammar

Warning:
As of October 4, 2019, CockroachDB v2.0 is no longer supported. For more details, refer to the Release Support Policy.
Tip:

This page describes the full CockroachDB SQL grammar. However, as a starting point, it's best to reference our SQL statements pages first, which provide detailed explanations and examples.

stmt_block:

stmt_list

no references


stmt_list:

stmt ;

referenced by:


stmt:

HELPTOKEN alter_stmt backup_stmt cancel_stmt copy_from_stmt create_stmt deallocate_stmt delete_stmt discard_stmt drop_stmt execute_stmt explain_stmt export_stmt grant_stmt insert_stmt import_stmt pause_stmt prepare_stmt restore_stmt resume_stmt revoke_stmt savepoint_stmt scrub_stmt select_stmt release_stmt reset_stmt set_stmt show_stmt transaction_stmt truncate_stmt update_stmt upsert_stmt

referenced by:


alter_stmt:

alter_ddl_stmt alter_user_stmt

referenced by:


backup_stmt:

BACKUP targets TO string_or_placeholder opt_as_of_clause opt_incremental opt_with_options

referenced by:


cancel_stmt:

cancel_job_stmt cancel_query_stmt cancel_session_stmt

referenced by:


copy_from_stmt:

COPY table_name opt_column_list FROM STDIN

referenced by:


create_stmt:

create_user_stmt create_role_stmt create_ddl_stmt create_stats_stmt

referenced by:


deallocate_stmt:

DEALLOCATE PREPARE name ALL

referenced by:


delete_stmt:

opt_with_clause DELETE FROM relation_expr_opt_alias where_clause opt_sort_clause opt_limit_clause returning_clause

referenced by:


discard_stmt:

DISCARD ALL

referenced by:


drop_stmt:

drop_ddl_stmt drop_role_stmt drop_user_stmt

referenced by:


execute_stmt:

EXECUTE table_alias_name execute_param_clause

referenced by:


explain_stmt:

EXPLAIN ( explain_option_list ) explainable_stmt

referenced by:


export_stmt:

EXPORT INTO CSV string_or_placeholder opt_with_options FROM select_stmt

referenced by:


grant_stmt:

GRANT privileges ON targets TO name_list privilege_list TO name_list WITH ADMIN OPTION

referenced by:


insert_stmt:

opt_with_clause INSERT INTO insert_target insert_rest on_conflict returning_clause

referenced by:


import_stmt:

IMPORT TABLE table_name CREATE USING string_or_placeholder ( table_elem_list ) CSV DATA ( string_or_placeholder_list ) opt_with_options

referenced by:


pause_stmt:

PAUSE JOB a_expr

referenced by:


prepare_stmt:

PREPARE table_alias_name prep_type_clause AS preparable_stmt

referenced by:


restore_stmt:

RESTORE targets FROM string_or_placeholder_list as_of_clause opt_with_options

referenced by:


resume_stmt:

RESUME JOB a_expr

referenced by:


revoke_stmt:

REVOKE privileges ON targets ADMIN OPTION FOR privilege_list FROM name_list

referenced by:


savepoint_stmt:

SAVEPOINT name

referenced by:


scrub_stmt:

scrub_table_stmt scrub_database_stmt

referenced by:


select_stmt:

select_no_parens select_with_parens

referenced by:


release_stmt:

RELEASE savepoint_name

referenced by:


reset_stmt:

reset_session_stmt reset_csetting_stmt

referenced by:


set_stmt:

set_session_stmt set_csetting_stmt set_transaction_stmt use_stmt

referenced by:


show_stmt:

show_backup_stmt show_columns_stmt show_constraints_stmt show_create_table_stmt show_create_view_stmt show_create_sequence_stmt show_csettings_stmt show_databases_stmt show_grants_stmt show_histogram_stmt show_indexes_stmt show_jobs_stmt show_queries_stmt show_ranges_stmt show_roles_stmt show_schemas_stmt show_session_stmt show_sessions_stmt show_stats_stmt show_tables_stmt show_trace_stmt show_users_stmt

referenced by:


transaction_stmt:

begin_stmt commit_stmt rollback_stmt abort_stmt

referenced by:


truncate_stmt:

TRUNCATE opt_table relation_expr_list opt_drop_behavior

referenced by:


update_stmt:

opt_with_clause UPDATE relation_expr_opt_alias SET set_clause_list where_clause opt_sort_clause opt_limit_clause returning_clause

referenced by:


upsert_stmt:

opt_with_clause UPSERT INTO insert_target insert_rest returning_clause

referenced by:


alter_ddl_stmt:

alter_table_stmt alter_index_stmt alter_view_stmt alter_sequence_stmt alter_database_stmt

referenced by:


alter_user_stmt:

alter_user_password_stmt

referenced by:


targets:

identifier col_name_keyword unreserved_keyword complex_table_pattern table_pattern , TABLE table_pattern_list DATABASE name_list

referenced by:


string_or_placeholder:

non_reserved_word_or_sconst PLACEHOLDER

referenced by:


opt_as_of_clause:

as_of_clause

referenced by:


opt_incremental:

INCREMENTAL FROM string_or_placeholder_list

referenced by:


opt_with_options:

WITH kv_option_list OPTIONS ( kv_option_list )

referenced by:


cancel_job_stmt:

CANCEL JOB a_expr

referenced by:


cancel_query_stmt:

CANCEL QUERY IF EXISTS a_expr

referenced by:


cancel_session_stmt:

CANCEL SESSION IF EXISTS a_expr

referenced by:


table_name:

db_object_name

referenced by:


opt_column_list:

( name_list )

referenced by:


create_user_stmt:

CREATE USER IF NOT EXISTS string_or_placeholder opt_password

referenced by:


create_role_stmt:

CREATE ROLE IF NOT EXISTS string_or_placeholder

referenced by:


create_ddl_stmt:

create_database_stmt create_index_stmt create_table_stmt create_table_as_stmt create_view_stmt create_sequence_stmt

referenced by:


create_stats_stmt:

CREATE STATISTICS statistics_name ON name_list FROM table_name

referenced by:


name:

identifier unreserved_keyword col_name_keyword

referenced by:


opt_with_clause:

with_clause

referenced by:


relation_expr_opt_alias:

relation_expr AS table_alias_name

referenced by:


where_clause:

WHERE a_expr

referenced by:


opt_sort_clause:

sort_clause

referenced by:


opt_limit_clause:

limit_clause

referenced by:


returning_clause:

RETURNING target_list NOTHING

referenced by:


drop_ddl_stmt:

drop_database_stmt drop_index_stmt drop_table_stmt drop_view_stmt drop_sequence_stmt

referenced by:


drop_role_stmt:

DROP ROLE IF EXISTS string_or_placeholder_list

referenced by:


drop_user_stmt:

DROP USER IF EXISTS string_or_placeholder_list

referenced by:


table_alias_name:

name

referenced by:


execute_param_clause:

( expr_list )

referenced by:


explainable_stmt:

preparable_stmt alter_ddl_stmt create_ddl_stmt create_stats_stmt drop_ddl_stmt execute_stmt

referenced by:


explain_option_list:

explain_option_name ,

referenced by:


privileges:

ALL privilege_list

referenced by:


name_list:

name ,

referenced by:


privilege_list:

privilege ,

referenced by:


insert_target:

table_name AS table_alias_name

referenced by:


insert_rest:

( insert_column_list ) select_stmt DEFAULT VALUES

referenced by:


on_conflict:

ON CONFLICT opt_conf_expr DO UPDATE SET set_clause_list where_clause NOTHING

referenced by:


string_or_placeholder_list:

string_or_placeholder ,

referenced by:


table_elem_list:

table_elem ,

referenced by:


a_expr:

c_expr + - ~ NOT a_expr DEFAULT MAXVALUE MINVALUE TYPECAST cast_target TYPEANNOTATE typename COLLATE collation_name + a_expr - a_expr * a_expr / a_expr FLOORDIV a_expr % a_expr ^ a_expr # a_expr & a_expr | a_expr < a_expr > a_expr ? a_expr JSON_SOME_EXISTS a_expr JSON_ALL_EXISTS a_expr CONTAINS a_expr CONTAINED_BY a_expr = a_expr CONCAT a_expr LSHIFT a_expr RSHIFT a_expr FETCHVAL a_expr FETCHTEXT a_expr FETCHVAL_PATH a_expr FETCHTEXT_PATH a_expr REMOVE_PATH a_expr INET_CONTAINED_BY_OR_EQUALS a_expr INET_CONTAINS_OR_CONTAINED_BY a_expr INET_CONTAINS_OR_EQUALS a_expr LESS_EQUALS a_expr GREATER_EQUALS a_expr NOT_EQUALS a_expr AND a_expr OR a_expr LIKE a_expr NOT LIKE a_expr ILIKE a_expr NOT ILIKE a_expr SIMILAR TO a_expr NOT SIMILAR TO a_expr ~ a_expr NOT_REGMATCH a_expr REGIMATCH a_expr NOT_REGIMATCH a_expr IS NAN IS NOT NAN IS NULL ISNULL IS NOT NULL NOTNULL IS TRUE IS NOT TRUE IS FALSE IS NOT FALSE IS UNKNOWN IS NOT UNKNOWN IS DISTINCT FROM a_expr IS NOT DISTINCT FROM a_expr IS OF ( type_list ) IS NOT OF ( type_list ) BETWEEN opt_asymmetric b_expr AND a_expr NOT BETWEEN opt_asymmetric b_expr AND a_expr BETWEEN SYMMETRIC b_expr AND a_expr NOT BETWEEN SYMMETRIC b_expr AND a_expr IN in_expr NOT IN in_expr subquery_op sub_type a_expr

referenced by:


prep_type_clause:

( type_list )

referenced by:


preparable_stmt:

alter_user_stmt backup_stmt cancel_stmt create_user_stmt create_role_stmt delete_stmt drop_role_stmt drop_user_stmt import_stmt insert_stmt pause_stmt reset_stmt restore_stmt resume_stmt select_stmt set_session_stmt set_csetting_stmt show_stmt update_stmt upsert_stmt

referenced by:


as_of_clause:

AS OF SYSTEM TIME a_expr_const

referenced by:


scrub_table_stmt:

EXPERIMENTAL SCRUB TABLE table_name opt_as_of_clause opt_scrub_options_clause

referenced by:


scrub_database_stmt:

EXPERIMENTAL SCRUB DATABASE database_name opt_as_of_clause

referenced by:


select_no_parens:

simple_select select_clause sort_clause opt_sort_clause select_limit with_clause select_clause sort_clause opt_sort_clause select_limit

referenced by:


select_with_parens:

( select_no_parens select_with_parens )

referenced by:


savepoint_name:

SAVEPOINT name

referenced by:


reset_session_stmt:

RESET SESSION session_var

referenced by:


reset_csetting_stmt:

RESET CLUSTER SETTING var_name

referenced by:


set_session_stmt:

SET SESSION set_rest_more CHARACTERISTICS AS TRANSACTION transaction_mode_list set_rest_more

referenced by:


set_csetting_stmt:

SET CLUSTER SETTING var_name = TO var_value

referenced by:


set_transaction_stmt:

SET SESSION TRANSACTION transaction_mode_list

referenced by:


use_stmt:

USE var_value

referenced by:


show_backup_stmt:

SHOW BACKUP string_or_placeholder

referenced by:


show_columns_stmt:

SHOW COLUMNS FROM table_name

referenced by:


show_constraints_stmt:

SHOW CONSTRAINT CONSTRAINTS FROM table_name

referenced by:


show_create_table_stmt:

SHOW CREATE TABLE table_name

referenced by:


show_create_view_stmt:

SHOW CREATE VIEW view_name

referenced by:


show_create_sequence_stmt:

SHOW CREATE SEQUENCE sequence_name

referenced by:


show_csettings_stmt:

SHOW CLUSTER SETTING var_name ALL ALL CLUSTER SETTINGS

referenced by:


show_databases_stmt:

SHOW DATABASES

referenced by:


show_grants_stmt:

SHOW GRANTS opt_on_targets_roles for_grantee_clause

referenced by:


show_histogram_stmt:

SHOW HISTOGRAM ICONST

referenced by:


show_indexes_stmt:

SHOW INDEX INDEXES KEYS FROM table_name

referenced by:


show_jobs_stmt:

SHOW JOBS

referenced by:


show_queries_stmt:

SHOW CLUSTER LOCAL QUERIES

referenced by:


show_ranges_stmt:

SHOW ranges_kw FROM TABLE table_name INDEX table_name_with_index

referenced by:


show_roles_stmt:

SHOW ROLES

referenced by:


show_schemas_stmt:

SHOW SCHEMAS FROM name

referenced by:


show_session_stmt:

SHOW SESSION session_var

referenced by:


show_sessions_stmt:

SHOW CLUSTER LOCAL SESSIONS

referenced by:


show_stats_stmt:

SHOW STATISTICS USING JSON FOR TABLE table_name

referenced by:


show_tables_stmt:

SHOW TABLES FROM name . name

referenced by:


show_trace_stmt:

SHOW opt_compact KV TRACE FOR SESSION explainable_stmt

referenced by:


show_users_stmt:

SHOW USERS

referenced by:


begin_stmt:

BEGIN opt_transaction START TRANSACTION begin_transaction

referenced by:


commit_stmt:

COMMIT END opt_transaction

referenced by:


rollback_stmt:

ROLLBACK opt_to_savepoint

referenced by:


abort_stmt:

ABORT opt_abort_mod

referenced by:


opt_table:

TABLE

referenced by:


relation_expr_list:

relation_expr ,

referenced by:


opt_drop_behavior:

CASCADE RESTRICT

referenced by:


set_clause_list:

set_clause ,

referenced by:


alter_table_stmt:

alter_onetable_stmt alter_split_stmt alter_scatter_stmt alter_rename_table_stmt

referenced by:


alter_index_stmt:

alter_oneindex_stmt alter_split_index_stmt alter_scatter_index_stmt alter_rename_index_stmt

referenced by:


alter_view_stmt:

alter_rename_view_stmt

referenced by:


alter_sequence_stmt:

alter_rename_sequence_stmt alter_sequence_options_stmt

referenced by:


alter_database_stmt:

alter_rename_database_stmt

referenced by:


alter_user_password_stmt:

ALTER USER IF EXISTS string_or_placeholder WITH PASSWORD string_or_placeholder

referenced by:


col_name_keyword:

ANNOTATE_TYPE BETWEEN BIGINT BIT BOOLEAN CHAR CHARACTER CHARACTERISTICS COALESCE DEC DECIMAL EXISTS EXTRACT EXTRACT_DURATION FLOAT GREATEST GROUPING IF IFNULL INT INTEGER INTERVAL LEAST NULLIF NUMERIC OUT OVERLAY POSITION PRECISION REAL ROW SMALLINT SUBSTRING TIME TIMESTAMP TREAT TRIM VALUES VARCHAR VIRTUAL WORK

referenced by:


unreserved_keyword:

ABORT ACTION ADD ADMIN ALTER AT BACKUP BEGIN BIGSERIAL BLOB BOOL BY BYTEA BYTES CACHE CANCEL CASCADE CLUSTER COLUMNS COMMENT COMMIT COMMITTED COMPACT CONFLICT CONFIGURATION CONFIGURATIONS CONFIGURE CONSTRAINTS COPY COVERING CSV CUBE CURRENT CYCLE DATA DATABASE DATABASES DATE DAY DEALLOCATE DELETE DISCARD DOUBLE DROP EMIT ENCODING EXECUTE EXPERIMENTAL EXPERIMENTAL_AUDIT EXPERIMENTAL_CHANGEFEED EXPERIMENTAL_FINGERPRINTS EXPERIMENTAL_RANGES EXPERIMENTAL_RELOCATE EXPERIMENTAL_REPLICA EXPLAIN EXPORT FILTER FIRST FLOAT4 FLOAT8 FOLLOWING FORCE_INDEX GIN GRANTS HIGH HISTOGRAM HOUR IMPORT INCREMENT INCREMENTAL INDEXES INET INJECT INSERT INT2 INT2VECTOR INT4 INT8 INT64 INTERLEAVE INVERTED ISOLATION JOB JOBS JSON JSONB KEY KEYS KV LC_COLLATE LC_CTYPE LESS LEVEL LIST LOCAL LOW MATCH MINUTE MONTH NAMES NAN NAME NEXT NO NORMAL NO_INDEX_JOIN NULLS OF OFF OID OIDVECTOR OPTION OPTIONS ORDINALITY OVER OWNED PARENT PARTIAL PARTITION PASSWORD PAUSE PHYSICAL PLANS PRECEDING PREPARE PRIORITY QUERIES QUERY RANGE READ RECURSIVE REF REGCLASS REGPROC REGPROCEDURE REGNAMESPACE REGTYPE RELEASE RENAME REPEATABLE RESET RESTORE RESTRICT RESUME REVOKE ROLE ROLES ROLLBACK ROLLUP ROWS SETTING SETTINGS STATUS SAVEPOINT SCATTER SCHEMA SCHEMAS SCRUB SEARCH SECOND SERIAL SERIALIZABLE SERIAL2 SERIAL4 SERIAL8 SEQUENCE SEQUENCES SESSION SESSIONS SET SHOW SIMPLE SMALLSERIAL SNAPSHOT SQL START STATISTICS STDIN STORE STORING STRICT STRING SPLIT SYNTAX SYSTEM TABLES TEMP TEMPLATE TEMPORARY TESTING_RANGES TESTING_RELOCATE TEXT THAN TIMESTAMPTZ TRACE TRANSACTION TRUNCATE TYPE UNBOUNDED UNCOMMITTED UNKNOWN UPDATE UPSERT UUID USE USERS VALID VALIDATE VALUE VARYING WITHIN WITHOUT WRITE YEAR ZONE

referenced by:


complex_table_pattern:

complex_db_object_name name . unrestricted_name . *

referenced by:


table_pattern:

simple_db_object_name complex_table_pattern

referenced by:


table_pattern_list:

table_pattern ,

referenced by:


non_reserved_word_or_sconst:

non_reserved_word SCONST

referenced by:


kv_option_list:

kv_option ,

referenced by:


db_object_name:

simple_db_object_name complex_db_object_name

referenced by:


opt_password:

opt_with PASSWORD string_or_placeholder

referenced by:


create_database_stmt:

CREATE DATABASE IF NOT EXISTS database_name opt_with opt_template_clause opt_encoding_clause opt_lc_collate_clause opt_lc_ctype_clause

referenced by:


create_index_stmt:

CREATE opt_unique INDEX opt_index_name IF NOT EXISTS index_name ON table_name opt_using_gin ( index_params ) opt_storing opt_interleave opt_partition_by INVERTED INDEX opt_index_name IF NOT EXISTS index_name ON table_name ( index_params )

referenced by:


create_table_stmt:

CREATE TABLE IF NOT EXISTS table_name ( opt_table_elem_list ) opt_interleave opt_partition_by

referenced by:


create_table_as_stmt:

CREATE TABLE IF NOT EXISTS table_name opt_column_list AS select_stmt

referenced by:


create_view_stmt:

CREATE VIEW view_name opt_column_list AS select_stmt

referenced by:


create_sequence_stmt:

CREATE SEQUENCE IF NOT EXISTS sequence_name opt_sequence_option_list

referenced by:


statistics_name:

name

referenced by:


with_clause:

WITH cte_list

referenced by:


relation_expr:

table_name * ONLY table_name ( table_name )

referenced by:


sort_clause:

ORDER BY sortby_list

referenced by:


limit_clause:

LIMIT select_limit_value FETCH first_or_next opt_select_fetch_first_value row_or_rows ONLY

referenced by:


target_list:

target_elem ,

referenced by:


drop_database_stmt:

DROP DATABASE IF EXISTS database_name opt_drop_behavior

referenced by:


drop_index_stmt:

DROP INDEX IF EXISTS table_name_with_index_list opt_drop_behavior

referenced by:


drop_table_stmt:

DROP TABLE IF EXISTS table_name_list opt_drop_behavior

referenced by:


drop_view_stmt:

DROP VIEW IF EXISTS table_name_list opt_drop_behavior

referenced by:


drop_sequence_stmt:

DROP SEQUENCE IF EXISTS table_name_list opt_drop_behavior

referenced by:


expr_list:

a_expr ,

referenced by:


explain_option_name:

non_reserved_word

referenced by:


privilege:

name CREATE GRANT SELECT

referenced by:


insert_column_list:

insert_column_item ,

referenced by:


opt_conf_expr:

( name_list ) where_clause

referenced by:


table_elem:

column_def index_def family_def table_constraint

referenced by:


c_expr:

d_expr array_subscripts case_expr EXISTS select_with_parens

referenced by:


cast_target:

typename postgres_oid

referenced by:


typename:

simple_typename opt_array_bounds ARRAY

referenced by:


collation_name:

unrestricted_name

referenced by:


type_list:

typename ,

referenced by:


opt_asymmetric:

ASYMMETRIC

referenced by:


b_expr:

c_expr + - ~ b_expr TYPECAST cast_target TYPEANNOTATE typename + - * / FLOORDIV % ^ # & | < > = CONCAT LSHIFT RSHIFT LESS_EQUALS GREATER_EQUALS NOT_EQUALS b_expr IS NOT DISTINCT FROM b_expr OF ( type_list )

referenced by:


in_expr:

select_with_parens ( expr_list )

referenced by:


subquery_op:

math_op NOT LIKE ILIKE

referenced by:


sub_type:

ANY SOME ALL

referenced by:


a_expr_const:

ICONST FCONST const_typename SCONST BCONST interval TRUE FALSE NULL

referenced by:


opt_scrub_options_clause:

WITH OPTIONS scrub_option_list

referenced by:


database_name:

name

referenced by:


simple_select:

simple_select_clause values_clause table_clause set_operation

referenced by:


select_clause:

simple_select select_with_parens

referenced by:


select_limit:

limit_clause offset_clause offset_clause limit_clause

referenced by:


session_var:

identifier ALL DATABASE NAMES SESSION_USER TIME ZONE

referenced by:


var_name:

name attrs

referenced by:


set_rest_more:

generic_set

referenced by:


transaction_mode_list:

transaction_mode opt_comma

referenced by:


var_value:

a_expr ON

referenced by:


view_name:

table_name

referenced by:


sequence_name:

db_object_name

referenced by:


opt_on_targets_roles:

ON targets_roles

referenced by:


for_grantee_clause:

FOR name_list

referenced by:


ranges_kw:

TESTING_RANGES EXPERIMENTAL_RANGES

referenced by:


table_name_with_index:

table_name @ index_name

referenced by:


opt_compact:

COMPACT

referenced by:


opt_transaction:

TRANSACTION

referenced by:


begin_transaction:

transaction_mode_list

referenced by:


opt_to_savepoint:

TRANSACTION TO savepoint_name

referenced by:


opt_abort_mod:

TRANSACTION WORK

referenced by:


set_clause:

single_set_clause multiple_set_clause

referenced by:


alter_onetable_stmt:

ALTER TABLE IF EXISTS relation_expr alter_table_cmds

referenced by:


alter_split_stmt:

ALTER TABLE table_name SPLIT AT select_stmt

referenced by:


alter_scatter_stmt:

ALTER TABLE table_name SCATTER FROM ( expr_list ) TO ( expr_list )

referenced by:


alter_rename_table_stmt:

ALTER TABLE IF EXISTS relation_expr RENAME TO table_name opt_column column_name TO column_name

referenced by:


alter_oneindex_stmt:

ALTER INDEX IF EXISTS table_name_with_index alter_index_cmds

referenced by:


alter_split_index_stmt:

ALTER INDEX table_name_with_index SPLIT AT select_stmt

referenced by:


alter_scatter_index_stmt:

ALTER INDEX table_name_with_index SCATTER FROM ( expr_list ) TO ( expr_list )

referenced by:


alter_rename_index_stmt:

ALTER INDEX IF EXISTS table_name_with_index RENAME TO index_name

referenced by:


alter_rename_view_stmt:

ALTER VIEW IF EXISTS relation_expr RENAME TO view_name

referenced by:


alter_rename_sequence_stmt:

ALTER SEQUENCE IF EXISTS relation_expr RENAME TO sequence_name

referenced by:


alter_sequence_options_stmt:

ALTER SEQUENCE IF EXISTS sequence_name sequence_option_list

referenced by:


alter_rename_database_stmt:

ALTER DATABASE database_name RENAME TO database_name

referenced by:


complex_db_object_name:

name . unrestricted_name . unrestricted_name

referenced by:


unrestricted_name:

identifier unreserved_keyword col_name_keyword type_func_name_keyword reserved_keyword

referenced by:


simple_db_object_name:

name

referenced by:


non_reserved_word:

identifier unreserved_keyword col_name_keyword type_func_name_keyword

referenced by:


kv_option:

name SCONST = string_or_placeholder

referenced by:


opt_with:

WITH

referenced by:


opt_template_clause:

TEMPLATE opt_equal non_reserved_word_or_sconst

referenced by:


opt_encoding_clause:

ENCODING opt_equal non_reserved_word_or_sconst

referenced by:


opt_lc_collate_clause:

LC_COLLATE opt_equal non_reserved_word_or_sconst

referenced by:


opt_lc_ctype_clause:

LC_CTYPE opt_equal non_reserved_word_or_sconst

referenced by:


opt_unique:

UNIQUE

referenced by:


opt_index_name:

opt_name

referenced by:


opt_using_gin:

USING GIN

referenced by:


index_params:

index_elem ,

referenced by:


opt_storing:

storing ( name_list )

referenced by:


opt_interleave:

INTERLEAVE IN PARENT table_name ( name_list )

referenced by:


opt_partition_by:

partition_by

referenced by:


index_name:

unrestricted_name

referenced by:


opt_table_elem_list:

table_elem_list

referenced by:


opt_sequence_option_list:

sequence_option_list

referenced by:


cte_list:

common_table_expr ,

referenced by:


sortby_list:

sortby ,

referenced by:


select_limit_value:

a_expr ALL

referenced by:


first_or_next:

FIRST NEXT

referenced by:


opt_select_fetch_first_value:

signed_iconst ( a_expr )

referenced by:


row_or_rows:

ROW ROWS

referenced by:


target_elem:

a_expr AS target_name identifier *

referenced by:


table_name_with_index_list:

table_name_with_index ,

referenced by:


table_name_list:

table_name ,

referenced by:


insert_column_item:

column_name

referenced by:


column_def:

column_name typename col_qual_list

referenced by:


index_def:

UNIQUE INDEX opt_index_name ( index_params ) opt_storing opt_interleave opt_partition_by INVERTED INDEX opt_name ( index_params )

referenced by:


family_def:

FAMILY opt_family_name ( name_list )

referenced by:


table_constraint:

CONSTRAINT constraint_name constraint_elem

referenced by:


d_expr:

column_path_with_star a_expr_const @ ICONST PLACEHOLDER ( a_expr ) func_expr select_with_parens ARRAY select_with_parens array_expr explicit_row implicit_row

referenced by:


array_subscripts:

array_subscript

referenced by:


case_expr:

CASE case_arg when_clause_list case_default END

referenced by:


postgres_oid:

REGPROC REGPROCEDURE REGCLASS REGTYPE REGNAMESPACE

referenced by:


simple_typename:

const_typename bit_with_length character_with_length INTERVAL opt_interval

referenced by:


opt_array_bounds:

[ ]

referenced by:


math_op:

+ - * / FLOORDIV % & | ^ # < > = LESS_EQUALS GREATER_EQUALS NOT_EQUALS

referenced by:


const_typename:

numeric bit_without_length character_without_length const_datetime const_json BLOB BYTES BYTEA TEXT NAME SERIAL SERIAL2 SERIAL4 SERIAL8 SMALLSERIAL UUID INET BIGSERIAL OID OIDVECTOR INT2VECTOR identifier

referenced by:


interval:

INTERVAL SCONST opt_interval

referenced by:


scrub_option_list:

scrub_option ,

referenced by:


simple_select_clause:

SELECT opt_all_clause DISTINCT distinct_on_clause target_list from_clause where_clause group_clause having_clause window_clause

referenced by:


values_clause:

VALUES ( expr_list ) ,

referenced by:


table_clause:

TABLE table_ref

referenced by:


set_operation:

select_clause UNION INTERSECT EXCEPT all_or_distinct select_clause

referenced by:


offset_clause:

OFFSET a_expr c_expr row_or_rows

referenced by:


attrs:

. unrestricted_name

referenced by:


generic_set:

var_name TO = var_list

referenced by:


transaction_mode:

transaction_iso_level transaction_user_priority transaction_read_mode

referenced by:


opt_comma:

,

referenced by:


targets_roles:

ROLE name_list targets

referenced by:


single_set_clause:

column_name = a_expr

referenced by:


multiple_set_clause:

( insert_column_list ) = in_expr

referenced by:


alter_table_cmds:

alter_table_cmd ,

referenced by:


opt_column:

COLUMN

referenced by:


column_name:

name

referenced by:


alter_index_cmds:

alter_index_cmd ,

referenced by:


sequence_option_list:

sequence_option_elem

referenced by:


type_func_name_keyword:

COLLATION CROSS FAMILY FULL INNER ILIKE IS ISNULL JOIN LEFT LIKE MAXVALUE MINVALUE NATURAL NOTNULL OUTER OVERLAPS RIGHT SIMILAR

referenced by:


reserved_keyword:

ALL ANALYSE ANALYZE AND ANY ARRAY AS ASC ASYMMETRIC BOTH CASE CAST CHECK COLLATE COLUMN CONSTRAINT CREATE CURRENT_CATALOG CURRENT_DATE CURRENT_ROLE CURRENT_SCHEMA CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER DEFAULT DEFERRABLE DESC DISTINCT DO ELSE END EXCEPT FALSE FETCH FOR FOREIGN FROM GRANT GROUP HAVING IN INDEX INITIALLY INTERSECT INTO LATERAL LEADING LIMIT LOCALTIME LOCALTIMESTAMP NOT NOTHING NULL OFFSET ON ONLY OR ORDER PLACING PRIMARY REFERENCES RETURNING SELECT SESSION_USER SOME STORED SYMMETRIC TABLE THEN TO TRAILING TRUE UNION UNIQUE USER USING VARIADIC VIEW WHEN WHERE WINDOW WITH

referenced by:


opt_equal:

=

referenced by:


opt_name:

name

referenced by:


index_elem:

column_name opt_asc_desc

referenced by:


storing:

COVERING STORING

referenced by:


partition_by:

PARTITION BY LIST ( name_list ) ( list_partitions RANGE ( name_list ) ( range_partitions ) NOTHING

referenced by:


common_table_expr:

table_alias_name opt_column_list AS ( preparable_stmt )

referenced by:


sortby:

a_expr PRIMARY KEY table_name INDEX table_name @ index_name opt_asc_desc

referenced by:


signed_iconst:

+ - ICONST

referenced by:


target_name:

unrestricted_name

referenced by:


col_qual_list:

col_qualification

referenced by:


opt_family_name:

opt_name

referenced by:


constraint_name:

name

referenced by:


constraint_elem:

CHECK ( a_expr PRIMARY KEY ( index_params ) UNIQUE ( index_params ) opt_storing opt_interleave opt_partition_by FOREIGN KEY ( name_list ) REFERENCES table_name opt_column_list reference_actions

referenced by:


column_path_with_star:

column_path name . unrestricted_name . unrestricted_name . *

referenced by:


func_expr:

func_application filter_clause over_clause func_expr_common_subexpr

referenced by:


array_expr:

[ opt_expr_list array_expr_list ]

referenced by:


explicit_row:

ROW ( opt_expr_list )

referenced by:


implicit_row:

( expr_list , a_expr )

referenced by:


array_subscript:

[ a_expr opt_slice_bound : opt_slice_bound ]

referenced by:


case_arg:

a_expr

referenced by:


when_clause_list:

when_clause

referenced by:


case_default:

ELSE a_expr

referenced by:


bit_with_length:

BIT opt_varying ( ICONST )

referenced by:


character_with_length:

character_base ( ICONST )

referenced by:


opt_interval:

YEAR TO MONTH MONTH DAY TO HOUR MINUTE SECOND HOUR TO MINUTE SECOND MINUTE TO SECOND SECOND

referenced by:


numeric:

INT INT2 INT4 INT8 INT64 INTEGER SMALLINT BIGINT REAL FLOAT4 FLOAT8 FLOAT opt_float DOUBLE PRECISION DECIMAL DEC NUMERIC opt_numeric_modifiers BOOLEAN BOOL

referenced by:


bit_without_length:

BIT opt_varying

referenced by:


character_without_length:

character_base

referenced by:


const_datetime:

DATE TIME WITHOUT TIME ZONE TIMESTAMP WITHOUT WITH TIME ZONE TIMESTAMPTZ

referenced by:


const_json:

JSON JSONB

referenced by:


scrub_option:

INDEX CONSTRAINT ALL ( name_list ) PHYSICAL

referenced by:


opt_all_clause:

ALL

referenced by:


from_clause:

FROM from_list opt_as_of_clause

referenced by:


group_clause:

GROUP BY expr_list

referenced by:


having_clause:

HAVING a_expr

referenced by:


window_clause:

WINDOW window_definition_list

referenced by:


distinct_on_clause:

DISTINCT ON ( expr_list )

referenced by:


table_ref:

relation_expr opt_index_hints func_name ( opt_expr_list ) special_function select_with_parens [ explainable_stmt ] opt_ordinality opt_alias_clause joined_table ( joined_table ) opt_ordinality alias_clause

referenced by:


all_or_distinct:

ALL DISTINCT

referenced by:


var_list:

var_value ,

referenced by:


transaction_iso_level:

ISOLATION LEVEL iso_level

referenced by:


transaction_user_priority:

PRIORITY user_priority

referenced by:


transaction_read_mode:

READ ONLY WRITE

referenced by:


alter_table_cmd:

ADD COLUMN IF NOT EXISTS column_def table_constraint opt_validate_behavior ALTER opt_column column_name alter_column_default DROP NOT NULL DROP opt_column IF EXISTS column_name CONSTRAINT IF EXISTS constraint_name opt_drop_behavior VALIDATE CONSTRAINT constraint_name EXPERIMENTAL_AUDIT SET audit_mode partition_by INJECT STATISTICS a_expr

referenced by:


alter_index_cmd:

partition_by

referenced by:


sequence_option_elem:

NO CYCLE MINVALUE MAXVALUE INCREMENT BY MINVALUE MAXVALUE START WITH signed_iconst64

referenced by:


opt_asc_desc:

ASC DESC

referenced by:


list_partitions:

list_partition ,

referenced by:


range_partitions:

range_partition ,

referenced by:


col_qualification:

CONSTRAINT constraint_name col_qualification_elem COLLATE collation_name FAMILY family_name CREATE FAMILY family_name IF NOT EXISTS FAMILY family_name

referenced by:


reference_actions:

reference_on_update reference_on_delete reference_on_delete reference_on_update

referenced by:


column_path:

name prefixed_column_path

referenced by:


func_application:

func_name ( ALL DISTINCT expr_list opt_sort_clause * )

referenced by:


filter_clause:

FILTER ( WHERE a_expr )

referenced by:


over_clause:

OVER window_specification window_name

referenced by:


func_expr_common_subexpr:

CURRENT_DATE CURRENT_SCHEMA CURRENT_CATALOG CURRENT_TIMESTAMP CURRENT_USER CURRENT_ROLE SESSION_USER USER CAST ( a_expr AS cast_target ANNOTATE_TYPE ( a_expr , typename IF ( a_expr , NULLIF IFNULL ( a_expr , a_expr COALESCE ( expr_list ) special_function

referenced by:


opt_expr_list:

expr_list

referenced by:


array_expr_list:

array_expr ,

referenced by:


opt_slice_bound:

a_expr

referenced by:


when_clause:

WHEN a_expr THEN a_expr

referenced by:


opt_varying:

VARYING

referenced by:


character_base:

CHARACTER CHAR opt_varying VARCHAR STRING

referenced by:


opt_float:

( ICONST )

referenced by:


opt_numeric_modifiers:

( ICONST , ICONST )

referenced by:


from_list:

table_ref ,

referenced by:


window_definition_list:

window_definition ,

referenced by:


opt_index_hints:

@ index_name [ ICONST ] { index_hints_param_list }

referenced by:


opt_ordinality:

WITH ORDINALITY

referenced by:


opt_alias_clause:

alias_clause

referenced by:


func_name:

type_function_name prefixed_column_path

referenced by:


special_function:

CURRENT_DATE CURRENT_SCHEMA CURRENT_TIMESTAMP CURRENT_USER ( EXTRACT EXTRACT_DURATION ( extract_list OVERLAY ( overlay_list POSITION ( position_list SUBSTRING ( substr_list GREATEST LEAST ( expr_list TRIM ( BOTH LEADING TRAILING trim_list )

referenced by:


joined_table:

( joined_table ) table_ref CROSS NATURAL join_type JOIN table_ref join_type JOIN table_ref join_qual

referenced by:


alias_clause:

AS table_alias_name opt_column_list

referenced by:


iso_level:

READ UNCOMMITTED COMMITTED SNAPSHOT REPEATABLE READ SERIALIZABLE

referenced by:


user_priority:

LOW NORMAL HIGH

referenced by:


alter_column_default:

SET DEFAULT a_expr DROP DEFAULT

referenced by:


opt_validate_behavior:

NOT VALID

referenced by:


audit_mode:

READ WRITE OFF

referenced by:


signed_iconst64:

signed_iconst

referenced by:


list_partition:

partition VALUES IN ( expr_list ) opt_partition_by

referenced by:


range_partition:

partition VALUES FROM ( expr_list ) TO ( expr_list ) opt_partition_by

referenced by:


col_qualification_elem:

NOT NULL UNIQUE PRIMARY KEY CHECK ( a_expr ) DEFAULT b_expr REFERENCES table_name opt_name_parens reference_actions AS ( a_expr ) STORED

referenced by:


family_name:

name

referenced by:


reference_on_update:

ON UPDATE reference_action

referenced by:


reference_on_delete:

ON DELETE reference_action

referenced by:


prefixed_column_path:

name . unrestricted_name . unrestricted_name . unrestricted_name

referenced by:


window_specification:

( opt_existing_window_name opt_partition_clause opt_sort_clause )

referenced by:


window_name:

name

referenced by:


window_definition:

window_name AS window_specification

referenced by:


index_hints_param_list:

index_hints_param ,

referenced by:


type_function_name:

identifier unreserved_keyword type_func_name_keyword

referenced by:


extract_list:

extract_arg FROM a_expr expr_list

referenced by:


overlay_list:

a_expr overlay_placing substr_from substr_for expr_list

referenced by:


position_list:

b_expr IN b_expr

referenced by:


substr_list:

a_expr substr_from substr_for substr_for substr_from opt_expr_list

referenced by:


trim_list:

a_expr FROM expr_list

referenced by:


join_type:

FULL LEFT RIGHT join_outer INNER

referenced by:


join_qual:

USING ( name_list ) ON a_expr

referenced by:


partition:

PARTITION partition_name

referenced by:


opt_name_parens:

( name )

referenced by:


reference_action:

NO ACTION RESTRICT CASCADE SET NULL DEFAULT

referenced by:


opt_existing_window_name:

name

referenced by:


opt_partition_clause:

PARTITION BY expr_list

referenced by:


index_hints_param:

FORCE_INDEX = index_name NO_INDEX_JOIN

referenced by:


extract_arg:

identifier YEAR MONTH DAY HOUR MINUTE SECOND

referenced by:


overlay_placing:

PLACING a_expr

referenced by:


substr_from:

FROM a_expr

referenced by:


substr_for:

FOR a_expr

referenced by:


join_outer:

OUTER

referenced by:


partition_name:

unrestricted_name

referenced by:


generated by Railroad Diagram Generator


Yes No