good morning!!!!

Skip to content
Snippets Groups Projects
Commit 4784bf34 authored by José Nieto's avatar José Nieto Committed by GitHub
Browse files

Merge pull request #365 from upper/hotfix/select-star-from

Do not put quotes around select star
parents 2cf574f2 3801d6d0
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,9 @@ func (c *Column) Compile(layout *Template) (compiled string, err error) {
for i := range nameChunks {
nameChunks[i] = trimString(nameChunks[i])
if nameChunks[i] == "*" {
continue
}
nameChunks[i] = mustParse(layout.IdentifierQuote, Raw{Value: nameChunks[i]})
}
......
......@@ -212,6 +212,28 @@ func TestSelectStarFromMany(t *testing.T) {
}
}
func TestSelectTableStarFromMany(t *testing.T) {
var s, e string
var stmt Statement
stmt = Statement{
Type: Select,
Columns: JoinColumns(
&Column{Name: "foo.name"},
&Column{Name: "BAR.*"},
&Column{Name: "baz.last_name"},
),
Table: TableWithName("first.table AS foo, second.table as BAR, third.table aS baz"),
}
s = mustTrim(stmt.Compile(defaultTemplate))
e = `SELECT "foo"."name", "BAR".*, "baz"."last_name" FROM "first"."table" AS "foo", "second"."table" AS "BAR", "third"."table" AS "baz"`
if s != e {
t.Fatalf("Got: %s, Expecting: %s", s, e)
}
}
func TestSelectArtistNameFrom(t *testing.T) {
var s, e string
var stmt Statement
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment