File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1246,6 +1246,30 @@ func TestCollation(t *testing.T) {
12461246 }
12471247}
12481248
1249+ func TestColumnsWithAlias (t * testing.T ) {
1250+ runTests (t , dsn + "&columnsWithAlias=true" , func (dbt * DBTest ) {
1251+ rows := dbt .mustQuery ("SELECT 1 AS A" )
1252+ defer rows .Close ()
1253+ cols , _ := rows .Columns ()
1254+ if len (cols ) != 1 {
1255+ t .Fatalf ("expected 1 column, got %d" , len (cols ))
1256+ }
1257+ if cols [0 ] != "A" {
1258+ t .Fatalf ("expected column name \" A\" , got \" %s\" " , cols [0 ])
1259+ }
1260+ rows .Close ()
1261+
1262+ rows = dbt .mustQuery ("SELECT * FROM (SELECT 1 AS one) AS A" )
1263+ cols , _ = rows .Columns ()
1264+ if len (cols ) != 1 {
1265+ t .Fatalf ("expected 1 column, got %d" , len (cols ))
1266+ }
1267+ if cols [0 ] != "A.one" {
1268+ t .Fatalf ("expected column name \" A.one\" , got \" %s\" " , cols [0 ])
1269+ }
1270+ })
1271+ }
1272+
12491273func TestRawBytesResultExceedsBuffer (t * testing.T ) {
12501274 runTests (t , dsn , func (dbt * DBTest ) {
12511275 // defaultBufSize from buffer.go
You can’t perform that action at this time.
0 commit comments