Skip to content

Commit

Permalink
Grammar for create_extension_stmt drop_extension_stmt alter_extension…
Browse files Browse the repository at this point in the history
…_stmt

Extensions with fixture tests for supported syntax

CreateExtensionTests removed as not needed in this change
  • Loading branch information
griffio committed Feb 2, 2024
1 parent 7292c3c commit c34f49e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"static com.alecstrong.sql.psi.core.psi.SqlTypes.AS"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.ASC"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.BY"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.CASCADE"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.COLLATE"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.COLUMN"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.COMMA"
Expand Down Expand Up @@ -371,12 +372,22 @@ json_expression ::= {column_name} ( jsona_binary_operator | jsonb_binary_operato
jsona_binary_operator ::= '->' | '->>' | '#>'
jsonb_binary_operator ::= '@>' | '<@' | '?|' | '?&' | '?' | '#-'

extension_stmt ::= create_sequence_stmt | copy_stdin | truncate_stmt | set_stmt | drop_sequence_stmt | alter_sequence_stmt {
extension_stmt ::= create_sequence_stmt | copy_stdin | truncate_stmt | set_stmt | drop_sequence_stmt | alter_sequence_stmt | create_extension_stmt | drop_extension_stmt | alter_extension_stmt {
extends = "com.alecstrong.sql.psi.core.psi.impl.SqlExtensionStmtImpl"
implements = "com.alecstrong.sql.psi.core.psi.SqlExtensionStmt"
override = true
}

extension_name ::= id | string

extension_version ::= id | string

create_extension_stmt ::= CREATE 'EXTENSION' [ IF NOT EXISTS ] extension_name [ WITH ] [ 'SCHEMA' id ] [ 'VERSION' extension_version ] [ CASCADE ]

drop_extension_stmt ::= DROP 'EXTENSION' [ IF EXISTS ] extension_name [ ( COMMA extension_name ) * ] [ CASCADE | 'RESTRICT' ]

alter_extension_stmt ::= ALTER 'EXTENSION' [ IF EXISTS ] extension_name ( UPDATE [ TO extension_version ] | SET 'SCHEMA' id )

copy_stdin ::= 'COPY' [ {database_name} DOT ] {table_name} [ AS {table_alias} ] [ LP {column_name} ( COMMA {column_name} ) * RP ] FROM 'STDIN' [ [ WITH ] LP copy_option ( COMMA copy_option) * RP ] [ WHERE <<expr '-1'>> ] {
mixin = "app.cash.sqldelight.dialects.postgresql.grammar.mixins.CopyMixin"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION pg_trgm;
CREATE EXTENSION pg_stat_statements WITH SCHEMA pgss;
CREATE EXTENSION bool_plperlu CASCADE;
CREATE EXTENSION citext WITH VERSION '1.1';

ALTER EXTENSION hstore UPDATE TO '1.3';
ALTER EXTENSION IF EXISTS hstore UPDATE;
ALTER EXTENSION IF EXISTS hstore SET SCHEMA public;

DROP EXTENSION citext;
DROP EXTENSION hstore CASCADE;
DROP EXTENSION IF EXISTS hstore, pg_trgm, citext RESTRICT;

This file was deleted.

0 comments on commit c34f49e

Please sign in to comment.