B:BD[
3.26898] → [
3.26898:27064]
B:BD[
3.27064] → [
2.1506:1586]
∅:D[
2.1586] → [
3.27176:27513]
B:BD[
3.27176] → [
3.27176:27513]
}
})
}
}
func TestExtractTableNameAsSelect(t *testing.T) {
tests := []struct {
name string
sql string
want string
}{
{
name: "simple AS SELECT",
sql: "CREATE TABLE my_table AS SELECT id FROM source",
want: "my_table",
},
{
name: "AS SELECT with newlines",
sql: "CREATE TABLE my_view AS\nSELECT id\nFROM source",
want: "my_view",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := extractTableNameAsSelect(tt.sql)
if got != tt.want {
t.Errorf("extractTableNameAsSelect() = %v, want %v", got, tt.want)