Skip to content

Commit

Permalink
Merge branch 'hotfix-0.1.14' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
hgouchet committed Mar 27, 2017
2 parents 174157c + 1277239 commit 4abf71d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion format.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ func (s CreateViewStatement) String() (q string) {
if s.SourceName() == "" {
return
}
q = "CREATE VIEW " + s.SourceName()
q = "CREATE "
if s.ReplaceMode() {
q += "OR REPLACE "
}
q += "VIEW " + s.SourceName()

// Concatenates field names.
cols := s.Columns()
Expand Down
3 changes: 3 additions & 0 deletions format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ func TestSelectStmt_String(t *testing.T) {
{
fq: `CREATE VIEW rv (Name, Cost) AS SELECT CampaignName, Cost FROM CAMPAIGN_PERFORMANCE_REPORT DURING TODAY`,
},
{
fq: `CREATE OR REPLACE VIEW rv AS SELECT CampaignId, Cost FROM CAMPAIGN_PERFORMANCE_REPORT DURING TODAY`,
},
{
fq: `SELECT CampaignName FROM CAMPAIGN_PERFORMANCE_REPORT`,
},
Expand Down

0 comments on commit 4abf71d

Please sign in to comment.