| 748 | } |
| 749 | |
| 750 | func TestCreateTableStatement_AllFeatures(t *testing.T) { |
| 751 | stmt := &CreateTableStatement{ |
| 752 | Name: "t", |
| 753 | Temporary: true, |
| 754 | IfNotExists: true, |
| 755 | Columns: []ColumnDef{{Name: "id", Type: "INT"}}, |
| 756 | Inherits: []string{"parent"}, |
| 757 | PartitionBy: &PartitionBy{Type: "RANGE", Columns: []string{"created_at"}}, |
| 758 | Options: []TableOption{{Name: "engine", Value: "InnoDB"}}, |
| 759 | } |
| 760 | sql := stmt.SQL() |
| 761 | for _, want := range []string{"CREATE TEMPORARY TABLE IF NOT EXISTS", "INHERITS (parent)", "PARTITION BY RANGE", "engine=InnoDB"} { |
| 762 | if !strings.Contains(sql, want) { |
| 763 | t.Errorf("missing %q in: %s", want, sql) |
| 764 | } |
| 765 | } |
| 766 | } |
| 767 | |
| 768 | func TestLateralTableRef(t *testing.T) { |
| 769 | stmt := &SelectStatement{ |