proto: ColTime32 has the type name "Time32", which the server does not know, so a Time column cannot be written or read

Open Beginner friendly
#1,250 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@shafiktanbir is already working on this.

Since Nov 26, 2026.

  • #1254 by @shafiktanbir — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
database

Research direction

Start with the exported constant ColumnTypeTime32 in proto/column.go (around line 236), which holds the wrong name "Time32". Then check its use in proto/col_time.go (the Type() method, around line 36) and in the ColAuto inference in proto/col_auto_gen.go (around line 19). Run the reproduction program against a ClickHouse 25.6+ server to confirm the INSERT and SELECT failures. Done means ColTime32 reports the server's Time name, the INSERT and SELECT succeed, and ColAuto infers the column. Check whether changing an exported constant needs a maintainer decision.

Written by the indexing model from the issue text.

Description

bug data-types native-format
Describe the bug

proto.ColTime32 (and its alias proto.ColTime) reports the type Time32. No ClickHouse server has a Time32 type: the type is Time. So ColTime32 cannot exchange data with a server:

  • an INSERT with a ColTime32 input fails with UNKNOWN_TYPE, and the client is then closed;
  • a SELECT of a Time column into a ColTime32 result fails with a type mismatch;
  • a SELECT of a Time column into proto.ColAuto (also proto.Results.Auto) fails, because inference knows only Time32.

The wrappers report Nullable(Time32) and Array(Time32). ColTime64 (Time64(p)) works. clickhouse-go is not affected: it sends its own type name Time.

Steps to reproduce
  1. Start a ClickHouse server (Time needs 25.6 or later).
  2. Run the program below with CLICKHOUSE_ADDR=<host>:9000 go run ..
Expected behaviour

The three calls succeed, as the Time64(3) contrast case does. The server knows only Time and Time64, on 25.6.13.41 (the first release with Time), 25.8.33.6 and 26.10.4.207:

SELECT toTypeName(CAST(0 AS Time32))
Code: 50. DB::Exception: Unknown data type family: Time32. Maybe you meant: ['Time64','Time'] ... (UNKNOWN_TYPE)

Only the name is wrong: a wrapper of ColTime32 whose Type() returns Time inserts and reads 01:02:03 and -01:02:03 correctly.

Code example
Reproduction program (Go, 56 lines)
package main

import (
	"context"
	"fmt"
	"os"

	"github.com/ClickHouse/ch-go"
	"github.com/ClickHouse/ch-go/proto"
)

func main() {
	addr := os.Getenv("CLICKHOUSE_ADDR")
	if addr == "" {
		addr = "localhost:9000"
	}
	ctx := context.Background()
	dial := func() *ch.Client {
		c, err := ch.Dial(ctx, ch.Options{Address: addr,
			Settings: []ch.Setting{{Key: "enable_time_time64_type", Value: "1"}}})
		if err != nil {
			panic(err)
		}
		return c
	}
	c := dial()
	for _, q := range []string{
		"DROP TABLE IF EXISTS repro_time",
		"CREATE TABLE repro_time (t Time, t64 Time64(3)) ENGINE = MergeTree ORDER BY tuple()",
		"INSERT INTO repro_time VALUES ('01:02:03', '01:02:03.000')",
	} {
		if err := c.Do(ctx, ch.Query{Body: q}); err != nil {
			panic(err)
		}
	}

	in := new(proto.ColTime32)
	in.Append(proto.IntoTime32(3723e9))
	err := c.Do(ctx, ch.Query{Body: "INSERT INTO repro_time (t) VALUES", Input: proto.Input{{Name: "t", Data: in}}})
	fmt.Println("INSERT ColTime32:", err)

	c = dial() // the client is closed after the failed INSERT
	var t proto.ColTime32
	err = c.Do(ctx, ch.Query{Body: "SELECT t FROM repro_time", Result: proto.Results{{Name: "t", Data: &t}}})
	fmt.Println("SELECT into ColTime32:", err)

	c = dial()
	var auto proto.ColAuto
	err = c.Do(ctx, ch.Query{Body: "SELECT t FROM repro_time", Result: proto.Results{{Name: "t", Data: &auto}}})
	fmt.Println("SELECT into ColAuto:", err)

	c = dial()
	var t64 proto.ColTime64
	err = c.Do(ctx, ch.Query{Body: "SELECT t64 FROM repro_time", Result: proto.Results{{Name: "t64", Data: &t64}}})
	fmt.Println("SELECT Time64(3) into ColTime64:", err, t64.Rows())
}
Error log
INSERT ColTime32: handle packet: UNKNOWN_TYPE (50): DB::Exception: Unknown data type family: Time32. Maybe you meant: ['Time64','Time']
SELECT into ColTime32: decode block: decode block: raw block: target: [0]: t: unexpected type "Time" (got) instead of "Time32" (has)
SELECT into ColAuto: decode block: decode block: raw block: target: infer: automatic column inference not supported for "Time"
SELECT Time64(3) into ColTime64: <nil> 1
Root cause

The constant ColumnTypeTime32 has the value "Time32" (proto/column.go:236); ColTime32.Type() returns it (proto/col_time.go:36), and ColAuto infers ColTime32 only for it (proto/col_auto_gen.go:19).

The fix changes the value of this exported constant, or adds a ColumnTypeTime constant; clickhouse-go uses neither.

Polyglot AI can open a fix PR if a maintainer assigns this issue to @polyglotAI-bot.

Configuration
Environment
  • Client version: main (44a3358); v0.67.0 to v0.76.0 have the same code
  • Language version: Go 1.26.11
  • OS: Linux
ClickHouse server
  • ClickHouse Server version: 26.10.4.207
  • ClickHouse Server non-default settings, if any: none (the program sets enable_time_time64_type = 1, which 25.6 and 25.8 need)
  • CREATE TABLE statements for tables involved: in the program

Classification: impact: none · area: Data types & formats (Time) · native: format


Found by automated analysis (Polyglot AI) while working on ClickHouse/ch-go#1249. Verified against a live server.

Dominant language
Go
Stars
435
Forks
101
Avg merge
22h 1m
Merged PRs (30d)
15

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ClickHouse/ch-go

All issues in ClickHouse/ch-go

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.