@@ -98,8 +98,8 @@ func (p *Parser) parseCreateView(orReplace, temporary bool) (*ast.CreateViewStat
9898 stmt .IfNotExists = true
9999 }
100100
101- // Parse view name
102- if ! p .isType ( models . TokenTypeIdentifier ) {
101+ // Parse view name (supports double-quoted identifiers for PostgreSQL compatibility)
102+ if ! p .isIdentifier ( ) {
103103 return nil , p .expectedError ("view name" )
104104 }
105105 stmt .Name = p .currentToken .Literal
@@ -109,7 +109,7 @@ func (p *Parser) parseCreateView(orReplace, temporary bool) (*ast.CreateViewStat
109109 if p .isType (models .TokenTypeLParen ) {
110110 p .advance () // Consume (
111111 for {
112- if ! p .isType ( models . TokenTypeIdentifier ) {
112+ if ! p .isIdentifier ( ) {
113113 return nil , p .expectedError ("column name" )
114114 }
115115 stmt .Columns = append (stmt .Columns , p .currentToken .Literal )
@@ -202,8 +202,8 @@ func (p *Parser) parseCreateMaterializedView() (*ast.CreateMaterializedViewState
202202 stmt .IfNotExists = true
203203 }
204204
205- // Parse view name
206- if ! p .isType ( models . TokenTypeIdentifier ) {
205+ // Parse view name (supports double-quoted identifiers for PostgreSQL compatibility)
206+ if ! p .isIdentifier ( ) {
207207 return nil , p .expectedError ("materialized view name" )
208208 }
209209 stmt .Name = p .currentToken .Literal
@@ -213,7 +213,7 @@ func (p *Parser) parseCreateMaterializedView() (*ast.CreateMaterializedViewState
213213 if p .isType (models .TokenTypeLParen ) {
214214 p .advance () // Consume (
215215 for {
216- if ! p .isType ( models . TokenTypeIdentifier ) {
216+ if ! p .isIdentifier ( ) {
217217 return nil , p .expectedError ("column name" )
218218 }
219219 stmt .Columns = append (stmt .Columns , p .currentToken .Literal )
@@ -234,7 +234,7 @@ func (p *Parser) parseCreateMaterializedView() (*ast.CreateMaterializedViewState
234234 // Parse optional TABLESPACE
235235 if p .isTokenMatch ("TABLESPACE" ) {
236236 p .advance () // Consume TABLESPACE
237- if ! p .isType ( models . TokenTypeIdentifier ) {
237+ if ! p .isIdentifier ( ) {
238238 return nil , p .expectedError ("tablespace name" )
239239 }
240240 stmt .Tablespace = p .currentToken .Literal
@@ -307,8 +307,8 @@ func (p *Parser) parseCreateTable(temporary bool) (*ast.CreateTableStatement, er
307307 stmt .IfNotExists = true
308308 }
309309
310- // Parse table name
311- if ! p .isType ( models . TokenTypeIdentifier ) {
310+ // Parse table name (supports double-quoted identifiers for PostgreSQL compatibility)
311+ if ! p .isIdentifier ( ) {
312312 return nil , p .expectedError ("table name" )
313313 }
314314 stmt .Name = p .currentToken .Literal
@@ -398,7 +398,7 @@ func (p *Parser) parseCreateTable(temporary bool) (*ast.CreateTableStatement, er
398398 if p .isType (models .TokenTypeEq ) {
399399 p .advance () // Consume =
400400 }
401- if p .isType ( models . TokenTypeIdentifier ) || p .isType (models .TokenTypeString ) {
401+ if p .isIdentifier ( ) || p .isType (models .TokenTypeString ) {
402402 opt .Value = p .currentToken .Literal
403403 p .advance ()
404404 }
@@ -434,7 +434,7 @@ func (p *Parser) parsePartitionByClause() (*ast.PartitionBy, error) {
434434
435435 // Parse column list
436436 for {
437- if ! p .isType ( models . TokenTypeIdentifier ) {
437+ if ! p .isIdentifier ( ) {
438438 return nil , p .expectedError ("column name" )
439439 }
440440 partitionBy .Columns = append (partitionBy .Columns , p .currentToken .Literal )
@@ -466,8 +466,8 @@ func (p *Parser) parsePartitionDefinition() (*ast.PartitionDefinition, error) {
466466 }
467467 p .advance () // Consume PARTITION
468468
469- // Parse partition name
470- if ! p .isType ( models . TokenTypeIdentifier ) {
469+ // Parse partition name (supports double-quoted identifiers)
470+ if ! p .isIdentifier ( ) {
471471 return nil , p .expectedError ("partition name" )
472472 }
473473 partDef .Name = p .currentToken .Literal
@@ -581,7 +581,7 @@ func (p *Parser) parsePartitionDefinition() (*ast.PartitionDefinition, error) {
581581 // Parse optional TABLESPACE
582582 if p .isTokenMatch ("TABLESPACE" ) {
583583 p .advance () // Consume TABLESPACE
584- if ! p .isType ( models . TokenTypeIdentifier ) {
584+ if ! p .isIdentifier ( ) {
585585 return nil , p .expectedError ("tablespace name" )
586586 }
587587 partDef .Tablespace = p .currentToken .Literal
@@ -611,8 +611,8 @@ func (p *Parser) parseCreateIndex(unique bool) (*ast.CreateIndexStatement, error
611611 stmt .IfNotExists = true
612612 }
613613
614- // Parse index name
615- if ! p .isType ( models . TokenTypeIdentifier ) {
614+ // Parse index name (supports double-quoted identifiers)
615+ if ! p .isIdentifier ( ) {
616616 return nil , p .expectedError ("index name" )
617617 }
618618 stmt .Name = p .currentToken .Literal
@@ -624,8 +624,8 @@ func (p *Parser) parseCreateIndex(unique bool) (*ast.CreateIndexStatement, error
624624 }
625625 p .advance () // Consume ON
626626
627- // Parse table name
628- if ! p .isType ( models . TokenTypeIdentifier ) {
627+ // Parse table name (supports double-quoted identifiers for PostgreSQL compatibility)
628+ if ! p .isIdentifier ( ) {
629629 return nil , p .expectedError ("table name" )
630630 }
631631 stmt .Table = p .currentToken .Literal
@@ -634,7 +634,7 @@ func (p *Parser) parseCreateIndex(unique bool) (*ast.CreateIndexStatement, error
634634 // Parse optional USING
635635 if p .isType (models .TokenTypeUsing ) {
636636 p .advance () // Consume USING
637- if ! p .isType ( models . TokenTypeIdentifier ) {
637+ if ! p .isIdentifier ( ) {
638638 return nil , p .expectedError ("index method" )
639639 }
640640 stmt .Using = p .currentToken .Literal
@@ -650,7 +650,7 @@ func (p *Parser) parseCreateIndex(unique bool) (*ast.CreateIndexStatement, error
650650 // Parse column list
651651 for {
652652 col := ast.IndexColumn {}
653- if ! p .isType ( models . TokenTypeIdentifier ) {
653+ if ! p .isIdentifier ( ) {
654654 return nil , p .expectedError ("column name" )
655655 }
656656 col .Column = p .currentToken .Literal
@@ -739,9 +739,9 @@ func (p *Parser) parseDropStatement() (*ast.DropStatement, error) {
739739 stmt .IfExists = true
740740 }
741741
742- // Parse object names (can be comma-separated)
742+ // Parse object names (can be comma-separated, supports double-quoted identifiers )
743743 for {
744- if ! p .isType ( models . TokenTypeIdentifier ) {
744+ if ! p .isIdentifier ( ) {
745745 return nil , p .expectedError ("object name" )
746746 }
747747 stmt .Names = append (stmt .Names , p .currentToken .Literal )
@@ -788,8 +788,8 @@ func (p *Parser) parseRefreshStatement() (*ast.RefreshMaterializedViewStatement,
788788 p .advance ()
789789 }
790790
791- // Parse view name
792- if ! p .isType ( models . TokenTypeIdentifier ) {
791+ // Parse view name (supports double-quoted identifiers for PostgreSQL compatibility)
792+ if ! p .isIdentifier ( ) {
793793 return nil , p .expectedError ("materialized view name" )
794794 }
795795 stmt .Name = p .currentToken .Literal
@@ -827,9 +827,9 @@ func (p *Parser) parseTruncateStatement() (*ast.TruncateStatement, error) {
827827 p .advance () // Consume TABLE
828828 }
829829
830- // Parse table names (can be comma-separated)
830+ // Parse table names (can be comma-separated, supports double-quoted identifiers )
831831 for {
832- if ! p .isType ( models . TokenTypeIdentifier ) {
832+ if ! p .isIdentifier ( ) {
833833 return nil , p .expectedError ("table name" )
834834 }
835835 stmt .Tables = append (stmt .Tables , p .currentToken .Literal )
0 commit comments