|
|
@@ -1246,6 +1246,30 @@ func TestCollation(t *testing.T) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func TestColumnsWithAlias(t *testing.T) {
|
|
|
+ runTests(t, dsn+"&columnsWithAlias=true", func(dbt *DBTest) {
|
|
|
+ rows := dbt.mustQuery("SELECT 1 AS A")
|
|
|
+ defer rows.Close()
|
|
|
+ cols, _ := rows.Columns()
|
|
|
+ if len(cols) != 1 {
|
|
|
+ t.Fatalf("expected 1 column, got %d", len(cols))
|
|
|
+ }
|
|
|
+ if cols[0] != "A" {
|
|
|
+ t.Fatalf("expected column name \"A\", got \"%s\"", cols[0])
|
|
|
+ }
|
|
|
+ rows.Close()
|
|
|
+
|
|
|
+ rows = dbt.mustQuery("SELECT * FROM (SELECT 1 AS one) AS A")
|
|
|
+ cols, _ = rows.Columns()
|
|
|
+ if len(cols) != 1 {
|
|
|
+ t.Fatalf("expected 1 column, got %d", len(cols))
|
|
|
+ }
|
|
|
+ if cols[0] != "A.one" {
|
|
|
+ t.Fatalf("expected column name \"A.one\", got \"%s\"", cols[0])
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
func TestRawBytesResultExceedsBuffer(t *testing.T) {
|
|
|
runTests(t, dsn, func(dbt *DBTest) {
|
|
|
// defaultBufSize from buffer.go
|