diff --git a/core/src/main/kotlin/com/alecstrong/sql/psi/core/postgresql/PostgreSql.bnf b/core/src/main/kotlin/com/alecstrong/sql/psi/core/postgresql/PostgreSql.bnf index e6408292..7b147729 100644 --- a/core/src/main/kotlin/com/alecstrong/sql/psi/core/postgresql/PostgreSql.bnf +++ b/core/src/main/kotlin/com/alecstrong/sql/psi/core/postgresql/PostgreSql.bnf @@ -60,6 +60,7 @@ column_constraint ::= [ CONSTRAINT {identifier} ] ( [ NOT ] NULL {conflict_clause} | UNIQUE {conflict_clause} | {check_constraint} | + generated_clause | {default_constraint} | COLLATE {collation_name} | {foreign_key_clause} @@ -93,6 +94,10 @@ bind_parameter ::= ( '?' | ':' {identifier} ) { override = true } +identity_clause ::= 'IDENTITY' + +generated_clause ::= 'GENERATED' ( ('ALWAYS' 'AS' <> 'STORED') | ( ('ALWAYS' | 'BY' 'DEFAULT') 'AS' identity_clause ) ) + small_int_data_type ::= 'SMALLINT' | 'INT2' int_data_type ::= 'INTEGER' | 'INT' | 'INT4' big_int_data_type ::= 'BIGINT' | 'INT8' diff --git a/core/src/test/fixtures_postgresql/column_types/Sample.s b/core/src/test/fixtures_postgresql/column_types/Sample.s index 411a8f19..defec99b 100644 --- a/core/src/test/fixtures_postgresql/column_types/Sample.s +++ b/core/src/test/fixtures_postgresql/column_types/Sample.s @@ -45,6 +45,12 @@ CREATE TABLE all_types( some_timestamptz_shorthand TIMESTAMPTZ, + some_always_generated_identity BIGINT GENERATED ALWAYS AS IDENTITY, + some_default_generated_identity BIGINT GENERATED BY DEFAULT AS IDENTITY, + + height_in_cm NUMERIC, + generated_height_in_inches_stored NUMERIC GENERATED ALWAYS AS ( height_in_cm / 2.54 ) STORED, + some_boolean BOOLEAN, some_bool BOOL, some_json JSON,