(stmt *pgquery.AlterTableStmt)
| 997 | } |
| 998 | |
| 999 | func (p PostgresParser) parseAlterTableStmt(stmt *pgquery.AlterTableStmt) (parser.Statement, error) { |
| 1000 | tableName, err := p.parseTableName(stmt.Relation) |
| 1001 | if err != nil { |
| 1002 | return nil, err |
| 1003 | } |
| 1004 | |
| 1005 | if len(stmt.Cmds) > 1 { |
| 1006 | return nil, fmt.Errorf("multiple actions are not supported in parseAlterTableStmt") |
| 1007 | } |
| 1008 | |
| 1009 | switch node := stmt.Cmds[0].Node.(*pgquery.Node_AlterTableCmd).AlterTableCmd.Def.Node.(type) { |
| 1010 | case *pgquery.Node_Constraint: |
| 1011 | return p.parseConstraint(node.Constraint, tableName) |
| 1012 | default: |
| 1013 | return nil, fmt.Errorf("unhandled node in parseAlterTableStmt: %#v", node) |
| 1014 | } |
| 1015 | } |
| 1016 | |
| 1017 | func (p PostgresParser) parseConstraint(constraint *pgquery.Constraint, tableName parser.TableName) (parser.Statement, error) { |
| 1018 | switch constraint.Contype { |
no test coverage detected