chconn

package module
v1.3.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 21 Imported by: 1

README

Go Reference codecov Go Report Card Actions Status FOSSA Status

chconn - ClickHouse low level Driver

chconn is a pure Go driver for ClickHouse that use Native protocol chconn aims to be low-level, fast, and performant.

For comparison with other libraries, please see https://github.com/jwilm0028/go-driver-benchmark/ and https://github.com/go-faster/ch-bench#benchmarks

If you have any suggestion or comment, please feel free to open an issue

Example Usage

package main

import (
	"context"
	"fmt"
	"os"
	"time"

	"github.com/vahid-sohrabloo/chconn/chpool"
	"github.com/vahid-sohrabloo/chconn/column"
)

func main() {
	conn, err := chpool.Connect(context.Background(), os.Getenv("DATABASE"))
	if err != nil {
		panic(err)
	}

	defer conn.Close()

	_, err = conn.Exec(context.Background(), `DROP TABLE IF EXISTS example_table`)
	if err != nil {
		panic(err)
	}

	_, err = conn.Exec(context.Background(), `CREATE TABLE  example_table (
		uint64 UInt64,
		uint64_nullable Nullable(UInt64)
	) Engine=Memory`)
	if err != nil {
		panic(err)
	}

	col1 := column.NewUint64(false)
	col2 := column.NewUint64(true)
	rows := 10000000 // One hundred million rows- insert in 10 times
	numInsert := 10
	startInsert := time.Now()
	for i := 0; i < numInsert; i++ {
		col1.Reset()
		col2.Reset()
		for y := 0; y < rows; y++ {
			col1.Append(uint64(i))
			if i%2 == 0 {
				col2.AppendIsNil(false)
				col2.Append(uint64(i))
			} else {
				col2.AppendIsNil(true)
				col2.AppendEmpty()
			}
		}

		ctxInsert, cancelInsert := context.WithTimeout(context.Background(), time.Second*30)
		// insert data
		err = conn.Insert(ctxInsert, "INSERT INTO example_table (uint64,uint64_nullable) VALUES", col1, col2)
		if err != nil {
			cancelInsert()
			panic(err)
		}
		cancelInsert()
	}
	fmt.Println("inserted 100M rows in ", time.Since(startInsert))

	// select data
	col1Read := column.NewUint64(false)
	col2Read := column.NewUint64(true)

	ctxSelect, cancelSelect := context.WithTimeout(context.Background(), time.Second*30)
	defer cancelSelect()

	startSelect := time.Now()
	// insert data
	selectStmt, err := conn.Select(ctxSelect, "SELECT uint64,uint64_nullable FROM  example_table")
	if err != nil {
		panic(err)
	}

	// make sure close the statement after you are done with it to back it to the pool
	defer selectStmt.Close()

	// next block of data
	// for more information about block, see: https://clickhouse.com/docs/en/development/architecture/#block
	var col1Data []uint64
	var col2DataNil []uint8
	var col2Data []uint64
	for selectStmt.Next() {
		err = selectStmt.ReadColumns(col1Read, col2Read)
		if err != nil {
			panic(err)
		}
		col1Data = col1Data[:0]
		col1Read.ReadAll(&col1Data)

		col2DataNil = col2DataNil[:0]
		col2Read.ReadAllNil(&col2DataNil)

		col2Data = col2Data[:0]
		col2Read.ReadAll(&col2Data)
	}

	// check errors
	if selectStmt.Err() != nil {
		panic(selectStmt.Err())
	}
	fmt.Println("selected 100M rows in ", time.Since(startSelect))

}
inserted 100M rows in  1.206666188s
selected 100M rows in  880.505004ms

For more information please read wiki

Features

  • Connection pool with after-connect hook for arbitrary connection setup similar to pgx (thanks @jackc)
  • Support All ClickHouse data types
  • Read and write data in column-oriented (like ClickHouse)
  • Do not use interface{} , reflect
  • Batch select and insert
  • Full TLS connection control
  • Read raw binary data
  • Supports profile and progress
  • database url connection very like pgx (thanks @jackc)
  • Code generator for Insert
  • Support LZ4 compression protocol

Supported types

  • UInt8, UInt16, UInt32, UInt64, UInt128, UInt256
  • Int8, Int16, Int32, Int64, Int128, Int256
  • Date, Date32, DateTime, DateTime64
  • Decimal32, Decimal64, Decimal128, Decimal256
  • IPv4, IPv6
  • String, FixedString(N)
  • UUID
  • Array(T)
  • Enums
  • LowCardinality(T)
  • Map(K, V)
  • Tuple(T1, T2, ..., Tn)
  • Nullable(T)

TODO

  • Support ExternalTable
  • Support Clickhouse Log
  • Add code generator for select

License

FOSSA Status

Documentation

Overview

Package chconn is a low-level Clickhouse database driver.

chconn is a pure Go driver for [ClickHouse] that use Native protocol chconn aims to be low-level, fast, and performant.

If you have any suggestion or comment, please feel free to open an issue on this tutorial's GitHub page!

Example
package main

import (
	"context"
	"fmt"
	"os"
	"time"

	"github.com/vahid-sohrabloo/chconn/chpool"
	"github.com/vahid-sohrabloo/chconn/column"
)

func main() {
	conn, err := chpool.Connect(context.Background(), os.Getenv("DATABASE_URL"))
	if err != nil {
		panic(err)
	}

	defer conn.Close()

	_, err = conn.Exec(context.Background(), `DROP TABLE IF EXISTS example_table`)
	if err != nil {
		panic(err)
	}

	_, err = conn.Exec(context.Background(), `CREATE TABLE  example_table (
		uint64 UInt64,
		uint64_nullable Nullable(UInt64)
	) Engine=Memory`)
	if err != nil {
		panic(err)
	}

	col1 := column.NewUint64(false)
	col2 := column.NewUint64(true)
	rows := 10000000 // One hundred million rows- insert in 10 times
	numInsert := 10
	startInsert := time.Now()
	for i := 0; i < numInsert; i++ {
		col1.Reset()
		col2.Reset()
		for y := 0; y < rows; y++ {
			col1.Append(uint64(i))
			if i%2 == 0 {
				col2.AppendIsNil(false)
				col2.Append(uint64(i))
			} else {
				col2.AppendIsNil(true)
				col2.AppendEmpty()
			}
		}

		ctxInsert, cancelInsert := context.WithTimeout(context.Background(), time.Second*30)
		// insert data
		err = conn.Insert(ctxInsert, "INSERT INTO example_table (uint64,uint64_nullable) VALUES", col1, col2)
		if err != nil {
			cancelInsert()
			panic(err)
		}
		cancelInsert()
	}
	fmt.Println("inserted 100M rows in ", time.Since(startInsert))

	// select data
	col1Read := column.NewUint64(false)
	col2Read := column.NewUint64(true)

	ctxSelect, cancelSelect := context.WithTimeout(context.Background(), time.Second*30)
	defer cancelSelect()

	startSelect := time.Now()
	// insert data
	selectStmt, err := conn.Select(ctxSelect, "SELECT uint64,uint64_nullable FROM  example_table")
	if err != nil {
		panic(err)
	}

	// make sure close the statement after you are done with it to back it to the pool
	defer selectStmt.Close()

	// next block of data
	// for more information about block, see: https://clickhouse.com/docs/en/development/architecture/#block
	var col1Data []uint64
	var col2DataNil []uint8
	var col2Data []uint64
	for selectStmt.Next() {
		err = selectStmt.ReadColumns(col1Read, col2Read)
		if err != nil {
			panic(err)
		}
		col1Data = col1Data[:0]
		col1Read.ReadAll(&col1Data)

		col2DataNil = col2DataNil[:0]
		col2Read.ReadAllNil(&col2DataNil)

		col2Data = col2Data[:0]
		col2Read.ReadAll(&col2Data)
	}

	// check errors
	if selectStmt.Err() != nil {
		panic(selectStmt.Err())
	}
	fmt.Println("selected 100M rows in ", time.Since(startSelect))
}
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var ErrAddCA = errors.New("unable to add CA to cert pool")

ErrAddCA when can't add ca

View Source
var ErrIPNotFound = errors.New("ip addr wasn't found")

ErrIPNotFound when can't found ip in connecting

View Source
var ErrInsertMinColumn = errors.New("you should pass at least one column")

ErrInsertMinColumn when no column provided for insert

View Source
var ErrInvalidBackSlash = errors.New("invalid backslash")

ErrInvalidBackSlash invalid backslash in dsn

View Source
var ErrInvalidDSN = errors.New("invalid dsn")

ErrInvalidDSN for invalid dsn

View Source
var ErrInvalidquoted = errors.New("unterminated quoted string in connection info string")

ErrInvalidquoted invalid quoted in dsn

View Source
var ErrMissCertRequirement = errors.New(`both "sslcert" and "sslkey" are required`)

ErrMissCertRequirement when sslcert or sslkey not provided

View Source
var ErrNegativeTimeout = errors.New("negative timeout")

ErrNegativeTimeout when negative timeout provided

View Source
var ErrPortInvalid = errors.New("outside range")

ErrPortInvalid when privide out of range port

View Source
var ErrSSLModeInvalid = errors.New("sslmode is invalid")

ErrSSLModeInvalid when privide invalid ssl mode

Functions

func NetworkAddress

func NetworkAddress(host string, port uint16) (network, address string)

NetworkAddress converts a ClickHouse host and port into network and address suitable for use with net.Dial.

Types

type AfterConnectFunc

type AfterConnectFunc func(ctx context.Context, conn Conn) error

AfterConnectFunc is called after ValidateConnect. It can be used to set up the connection (e.g. Set session variables or prepare statements). If this returns an error the connection attempt fails.

type ChError

type ChError struct {
	Code       ChErrorType
	Name       string
	Message    string
	StackTrace string
	// contains filtered or unexported fields
}

ChError represents an error reported by the Clickhouse server

func (*ChError) Error

func (e *ChError) Error() string

Error return string error

func (*ChError) Unwrap

func (e *ChError) Unwrap() error

Unwrap returns the underlying error

type ChErrorType added in v1.3.9

type ChErrorType int32
const (
	ChErrorOk                                           ChErrorType = 0    // OK
	ChErrorUnsupportedMethod                            ChErrorType = 1    // UNSUPPORTED_METHOD
	ChErrorUnsupportedParameter                         ChErrorType = 2    // UNSUPPORTED_PARAMETER
	ChErrorUnexpectedEndOfFile                          ChErrorType = 3    // UNEXPECTED_END_OF_FILE
	ChErrorExpectedEndOfFile                            ChErrorType = 4    // EXPECTED_END_OF_FILE
	ChErrorCannotParseText                              ChErrorType = 6    // CANNOT_PARSE_TEXT
	ChErrorIncorrectNumberOfColumns                     ChErrorType = 7    // INCORRECT_NUMBER_OF_COLUMNS
	ChErrorThereIsNoColumn                              ChErrorType = 8    // THERE_IS_NO_COLUMN
	ChErrorSizesOfColumnsDoesntMatch                    ChErrorType = 9    // SIZES_OF_COLUMNS_DOESNT_MATCH
	ChErrorNotFoundColumnInBlock                        ChErrorType = 10   // NOT_FOUND_COLUMN_IN_BLOCK
	ChErrorPositionOutOfBound                           ChErrorType = 11   // POSITION_OUT_OF_BOUND
	ChErrorParameterOutOfBound                          ChErrorType = 12   // PARAMETER_OUT_OF_BOUND
	ChErrorSizesOfColumnsInTupleDoesntMatch             ChErrorType = 13   // SIZES_OF_COLUMNS_IN_TUPLE_DOESNT_MATCH
	ChErrorDuplicateColumn                              ChErrorType = 15   // DUPLICATE_COLUMN
	ChErrorNoSuchColumnInTable                          ChErrorType = 16   // NO_SUCH_COLUMN_IN_TABLE
	ChErrorDelimiterInStringLiteralDoesntMatch          ChErrorType = 17   // DELIMITER_IN_STRING_LITERAL_DOESNT_MATCH
	ChErrorCannotInsertElementIntoConstantColumn        ChErrorType = 18   // CANNOT_INSERT_ELEMENT_INTO_CONSTANT_COLUMN
	ChErrorSizeOfFixedStringDoesntMatch                 ChErrorType = 19   // SIZE_OF_FIXED_STRING_DOESNT_MATCH
	ChErrorNumberOfColumnsDoesntMatch                   ChErrorType = 20   // NUMBER_OF_COLUMNS_DOESNT_MATCH
	ChErrorCannotReadAllDataFromTabSeparatedInput       ChErrorType = 21   // CANNOT_READ_ALL_DATA_FROM_TAB_SEPARATED_INPUT
	ChErrorCannotParseAllValueFromTabSeparatedInput     ChErrorType = 22   // CANNOT_PARSE_ALL_VALUE_FROM_TAB_SEPARATED_INPUT
	ChErrorCannotReadFromIstream                        ChErrorType = 23   // CANNOT_READ_FROM_ISTREAM
	ChErrorCannotWriteToOstream                         ChErrorType = 24   // CANNOT_WRITE_TO_OSTREAM
	ChErrorCannotParseEscapeSequence                    ChErrorType = 25   // CANNOT_PARSE_ESCAPE_SEQUENCE
	ChErrorCannotParseQuotedString                      ChErrorType = 26   // CANNOT_PARSE_QUOTED_STRING
	ChErrorCannotParseInputAssertionFailed              ChErrorType = 27   // CANNOT_PARSE_INPUT_ASSERTION_FAILED
	ChErrorCannotPrintFloatOrDoubleNumber               ChErrorType = 28   // CANNOT_PRINT_FLOAT_OR_DOUBLE_NUMBER
	ChErrorCannotPrintInteger                           ChErrorType = 29   // CANNOT_PRINT_INTEGER
	ChErrorCannotReadSizeOfCompressedChunk              ChErrorType = 30   // CANNOT_READ_SIZE_OF_COMPRESSED_CHUNK
	ChErrorCannotReadCompressedChunk                    ChErrorType = 31   // CANNOT_READ_COMPRESSED_CHUNK
	ChErrorAttemptToReadAfterEOF                        ChErrorType = 32   // ATTEMPT_TO_READ_AFTER_EOF
	ChErrorCannotReadAllData                            ChErrorType = 33   // CANNOT_READ_ALL_DATA
	ChErrorTooManyArgumentsForFunction                  ChErrorType = 34   // TOO_MANY_ARGUMENTS_FOR_FUNCTION
	ChErrorTooFewArgumentsForFunction                   ChErrorType = 35   // TOO_FEW_ARGUMENTS_FOR_FUNCTION
	ChErrorBadArguments                                 ChErrorType = 36   // BAD_ARGUMENTS
	ChErrorUnknownElementInAst                          ChErrorType = 37   // UNKNOWN_ELEMENT_IN_AST
	ChErrorCannotParseDate                              ChErrorType = 38   // CANNOT_PARSE_DATE
	ChErrorTooLargeSizeCompressed                       ChErrorType = 39   // TOO_LARGE_SIZE_COMPRESSED
	ChErrorChecksumDoesntMatch                          ChErrorType = 40   // CHECKSUM_DOESNT_MATCH
	ChErrorCannotParseDatetime                          ChErrorType = 41   // CANNOT_PARSE_DATETIME
	ChErrorNumberOfArgumentsDoesntMatch                 ChErrorType = 42   // NUMBER_OF_ARGUMENTS_DOESNT_MATCH
	ChErrorIllegalTypeOfArgument                        ChErrorType = 43   // ILLEGAL_TYPE_OF_ARGUMENT
	ChErrorIllegalColumn                                ChErrorType = 44   // ILLEGAL_COLUMN
	ChErrorIllegalNumberOfResultColumns                 ChErrorType = 45   // ILLEGAL_NUMBER_OF_RESULT_COLUMNS
	ChErrorUnknownFunction                              ChErrorType = 46   // UNKNOWN_FUNCTION
	ChErrorUnknownIdentifier                            ChErrorType = 47   // UNKNOWN_IDENTIFIER
	ChErrorNotImplemented                               ChErrorType = 48   // NOT_IMPLEMENTED
	ChErrorLogicalError                                 ChErrorType = 49   // LOGICAL_ERROR
	ChErrorUnknownType                                  ChErrorType = 50   // UNKNOWN_TYPE
	ChErrorEmptyListOfColumnsQueried                    ChErrorType = 51   // EMPTY_LIST_OF_COLUMNS_QUERIED
	ChErrorColumnQueriedMoreThanOnce                    ChErrorType = 52   // COLUMN_QUERIED_MORE_THAN_ONCE
	ChErrorTypeMismatch                                 ChErrorType = 53   // TYPE_MISMATCH
	ChErrorStorageDoesntAllowParameters                 ChErrorType = 54   // STORAGE_DOESNT_ALLOW_PARAMETERS
	ChErrorStorageRequiresParameter                     ChErrorType = 55   // STORAGE_REQUIRES_PARAMETER
	ChErrorUnknownStorage                               ChErrorType = 56   // UNKNOWN_STORAGE
	ChErrorTableAlreadyExists                           ChErrorType = 57   // TABLE_ALREADY_EXISTS
	ChErrorTableMetadataAlreadyExists                   ChErrorType = 58   // TABLE_METADATA_ALREADY_EXISTS
	ChErrorIllegalTypeOfColumnForFilter                 ChErrorType = 59   // ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER
	ChErrorUnknownTable                                 ChErrorType = 60   // UNKNOWN_TABLE
	ChErrorOnlyFilterColumnInBlock                      ChErrorType = 61   // ONLY_FILTER_COLUMN_IN_BLOCK
	ChErrorSyntaxError                                  ChErrorType = 62   // SYNTAX_ERROR
	ChErrorUnknownAggregateFunction                     ChErrorType = 63   // UNKNOWN_AGGREGATE_FUNCTION
	ChErrorCannotReadAggregateFunctionFromText          ChErrorType = 64   // CANNOT_READ_AGGREGATE_FUNCTION_FROM_TEXT
	ChErrorCannotWriteAggregateFunctionAsText           ChErrorType = 65   // CANNOT_WRITE_AGGREGATE_FUNCTION_AS_TEXT
	ChErrorNotAColumn                                   ChErrorType = 66   // NOT_A_COLUMN
	ChErrorIllegalKeyOfAggregation                      ChErrorType = 67   // ILLEGAL_KEY_OF_AGGREGATION
	ChErrorCannotGetSizeOfField                         ChErrorType = 68   // CANNOT_GET_SIZE_OF_FIELD
	ChErrorArgumentOutOfBound                           ChErrorType = 69   // ARGUMENT_OUT_OF_BOUND
	ChErrorCannotConvertType                            ChErrorType = 70   // CANNOT_CONVERT_TYPE
	ChErrorCannotWriteAfterEndOfBuffer                  ChErrorType = 71   // CANNOT_WRITE_AFTER_END_OF_BUFFER
	ChErrorCannotParseNumber                            ChErrorType = 72   // CANNOT_PARSE_NUMBER
	ChErrorUnknownFormat                                ChErrorType = 73   // UNKNOWN_FORMAT
	ChErrorCannotReadFromFileDescriptor                 ChErrorType = 74   // CANNOT_READ_FROM_FILE_DESCRIPTOR
	ChErrorCannotWriteToFileDescriptor                  ChErrorType = 75   // CANNOT_WRITE_TO_FILE_DESCRIPTOR
	ChErrorCannotOpenFile                               ChErrorType = 76   // CANNOT_OPEN_FILE
	ChErrorCannotCloseFile                              ChErrorType = 77   // CANNOT_CLOSE_FILE
	ChErrorUnknownTypeOfQuery                           ChErrorType = 78   // UNKNOWN_TYPE_OF_QUERY
	ChErrorIncorrectFileName                            ChErrorType = 79   // INCORRECT_FILE_NAME
	ChErrorIncorrectQuery                               ChErrorType = 80   // INCORRECT_QUERY
	ChErrorUnknownDatabase                              ChErrorType = 81   // UNKNOWN_DATABASE
	ChErrorDatabaseAlreadyExists                        ChErrorType = 82   // DATABASE_ALREADY_EXISTS
	ChErrorDirectoryDoesntExist                         ChErrorType = 83   // DIRECTORY_DOESNT_EXIST
	ChErrorDirectoryAlreadyExists                       ChErrorType = 84   // DIRECTORY_ALREADY_EXISTS
	ChErrorFormatIsNotSuitableForInput                  ChErrorType = 85   // FORMAT_IS_NOT_SUITABLE_FOR_INPUT
	ChErrorReceivedErrorFromRemoteIoServer              ChErrorType = 86   // RECEIVED_ERROR_FROM_REMOTE_IO_SERVER
	ChErrorCannotSeekThroughFile                        ChErrorType = 87   // CANNOT_SEEK_THROUGH_FILE
	ChErrorCannotTruncateFile                           ChErrorType = 88   // CANNOT_TRUNCATE_FILE
	ChErrorUnknownCompressionMethod                     ChErrorType = 89   // UNKNOWN_COMPRESSION_METHOD
	ChErrorEmptyListOfColumnsPassed                     ChErrorType = 90   // EMPTY_LIST_OF_COLUMNS_PASSED
	ChErrorSizesOfMarksFilesAreInconsistent             ChErrorType = 91   // SIZES_OF_MARKS_FILES_ARE_INCONSISTENT
	ChErrorEmptyDataPassed                              ChErrorType = 92   // EMPTY_DATA_PASSED
	ChErrorUnknownAggregatedDataVariant                 ChErrorType = 93   // UNKNOWN_AGGREGATED_DATA_VARIANT
	ChErrorCannotMergeDifferentAggregatedDataVariants   ChErrorType = 94   // CANNOT_MERGE_DIFFERENT_AGGREGATED_DATA_VARIANTS
	ChErrorCannotReadFromSocket                         ChErrorType = 95   // CANNOT_READ_FROM_SOCKET
	ChErrorCannotWriteToSocket                          ChErrorType = 96   // CANNOT_WRITE_TO_SOCKET
	ChErrorCannotReadAllDataFromChunkedInput            ChErrorType = 97   // CANNOT_READ_ALL_DATA_FROM_CHUNKED_INPUT
	ChErrorCannotWriteToEmptyBlockOutputStream          ChErrorType = 98   // CANNOT_WRITE_TO_EMPTY_BLOCK_OUTPUT_STREAM
	ChErrorUnknownPacketFromClient                      ChErrorType = 99   // UNKNOWN_PACKET_FROM_CLIENT
	ChErrorUnknownPacketFromServer                      ChErrorType = 100  // UNKNOWN_PACKET_FROM_SERVER
	ChErrorUnexpectedPacketFromClient                   ChErrorType = 101  // UNEXPECTED_PACKET_FROM_CLIENT
	ChErrorUnexpectedPacketFromServer                   ChErrorType = 102  // UNEXPECTED_PACKET_FROM_SERVER
	ChErrorReceivedDataForWrongQueryID                  ChErrorType = 103  // RECEIVED_DATA_FOR_WRONG_QUERY_ID
	ChErrorTooSmallBufferSize                           ChErrorType = 104  // TOO_SMALL_BUFFER_SIZE
	ChErrorCannotReadHistory                            ChErrorType = 105  // CANNOT_READ_HISTORY
	ChErrorCannotAppendHistory                          ChErrorType = 106  // CANNOT_APPEND_HISTORY
	ChErrorFileDoesntExist                              ChErrorType = 107  // FILE_DOESNT_EXIST
	ChErrorNoDataToInsert                               ChErrorType = 108  // NO_DATA_TO_INSERT
	ChErrorCannotBlockSignal                            ChErrorType = 109  // CANNOT_BLOCK_SIGNAL
	ChErrorCannotUnblockSignal                          ChErrorType = 110  // CANNOT_UNBLOCK_SIGNAL
	ChErrorCannotManipulateSigset                       ChErrorType = 111  // CANNOT_MANIPULATE_SIGSET
	ChErrorCannotWaitForSignal                          ChErrorType = 112  // CANNOT_WAIT_FOR_SIGNAL
	ChErrorThereIsNoSession                             ChErrorType = 113  // THERE_IS_NO_SESSION
	ChErrorCannotClockGettime                           ChErrorType = 114  // CANNOT_CLOCK_GETTIME
	ChErrorUnknownSetting                               ChErrorType = 115  // UNKNOWN_SETTING
	ChErrorThereIsNoDefaultValue                        ChErrorType = 116  // THERE_IS_NO_DEFAULT_VALUE
	ChErrorIncorrectData                                ChErrorType = 117  // INCORRECT_DATA
	ChErrorEngineRequired                               ChErrorType = 119  // ENGINE_REQUIRED
	ChErrorCannotInsertValueOfDifferentSizeIntoTuple    ChErrorType = 120  // CANNOT_INSERT_VALUE_OF_DIFFERENT_SIZE_INTO_TUPLE
	ChErrorUnsupportedJoinKeys                          ChErrorType = 121  // UNSUPPORTED_JOIN_KEYS
	ChErrorIncompatibleColumns                          ChErrorType = 122  // INCOMPATIBLE_COLUMNS
	ChErrorUnknownTypeOfAstNode                         ChErrorType = 123  // UNKNOWN_TYPE_OF_AST_NODE
	ChErrorIncorrectElementOfSet                        ChErrorType = 124  // INCORRECT_ELEMENT_OF_SET
	ChErrorIncorrectResultOfScalarSubquery              ChErrorType = 125  // INCORRECT_RESULT_OF_SCALAR_SUBQUERY
	ChErrorCannotGetReturnType                          ChErrorType = 126  // CANNOT_GET_RETURN_TYPE
	ChErrorIllegalIndex                                 ChErrorType = 127  // ILLEGAL_INDEX
	ChErrorTooLargeArraySize                            ChErrorType = 128  // TOO_LARGE_ARRAY_SIZE
	ChErrorFunctionIsSpecial                            ChErrorType = 129  // FUNCTION_IS_SPECIAL
	ChErrorCannotReadArrayFromText                      ChErrorType = 130  // CANNOT_READ_ARRAY_FROM_TEXT
	ChErrorTooLargeStringSize                           ChErrorType = 131  // TOO_LARGE_STRING_SIZE
	ChErrorAggregateFunctionDoesntAllowParameters       ChErrorType = 133  // AGGREGATE_FUNCTION_DOESNT_ALLOW_PARAMETERS
	ChErrorParametersToAggregateFunctionsMustBeLiterals ChErrorType = 134  // PARAMETERS_TO_AGGREGATE_FUNCTIONS_MUST_BE_LITERALS
	ChErrorZeroArrayOrTupleIndex                        ChErrorType = 135  // ZERO_ARRAY_OR_TUPLE_INDEX
	ChErrorUnknownElementInConfig                       ChErrorType = 137  // UNKNOWN_ELEMENT_IN_CONFIG
	ChErrorExcessiveElementInConfig                     ChErrorType = 138  // EXCESSIVE_ELEMENT_IN_CONFIG
	ChErrorNoElementsInConfig                           ChErrorType = 139  // NO_ELEMENTS_IN_CONFIG
	ChErrorAllRequestedColumnsAreMissing                ChErrorType = 140  // ALL_REQUESTED_COLUMNS_ARE_MISSING
	ChErrorSamplingNotSupported                         ChErrorType = 141  // SAMPLING_NOT_SUPPORTED
	ChErrorNotFoundNode                                 ChErrorType = 142  // NOT_FOUND_NODE
	ChErrorFoundMoreThanOneNode                         ChErrorType = 143  // FOUND_MORE_THAN_ONE_NODE
	ChErrorFirstDateIsBiggerThanLastDate                ChErrorType = 144  // FIRST_DATE_IS_BIGGER_THAN_LAST_DATE
	ChErrorUnknownOverflowMode                          ChErrorType = 145  // UNKNOWN_OVERFLOW_MODE
	ChErrorQuerySectionDoesntMakeSense                  ChErrorType = 146  // QUERY_SECTION_DOESNT_MAKE_SENSE
	ChErrorNotFoundFunctionElementForAggregate          ChErrorType = 147  // NOT_FOUND_FUNCTION_ELEMENT_FOR_AGGREGATE
	ChErrorNotFoundRelationElementForCondition          ChErrorType = 148  // NOT_FOUND_RELATION_ELEMENT_FOR_CONDITION
	ChErrorNotFoundRhsElementForCondition               ChErrorType = 149  // NOT_FOUND_RHS_ELEMENT_FOR_CONDITION
	ChErrorEmptyListOfAttributesPassed                  ChErrorType = 150  // EMPTY_LIST_OF_ATTRIBUTES_PASSED
	ChErrorIndexOfColumnInSortClauseIsOutOfRange        ChErrorType = 151  // INDEX_OF_COLUMN_IN_SORT_CLAUSE_IS_OUT_OF_RANGE
	ChErrorUnknownDirectionOfSorting                    ChErrorType = 152  // UNKNOWN_DIRECTION_OF_SORTING
	ChErrorIllegalDivision                              ChErrorType = 153  // ILLEGAL_DIVISION
	ChErrorAggregateFunctionNotApplicable               ChErrorType = 154  // AGGREGATE_FUNCTION_NOT_APPLICABLE
	ChErrorUnknownRelation                              ChErrorType = 155  // UNKNOWN_RELATION
	ChErrorDictionariesWasNotLoaded                     ChErrorType = 156  // DICTIONARIES_WAS_NOT_LOADED
	ChErrorIllegalOverflowMode                          ChErrorType = 157  // ILLEGAL_OVERFLOW_MODE
	ChErrorTooManyRows                                  ChErrorType = 158  // TOO_MANY_ROWS
	ChErrorTimeoutExceeded                              ChErrorType = 159  // TIMEOUT_EXCEEDED
	ChErrorTooSlow                                      ChErrorType = 160  // TOO_SLOW
	ChErrorTooManyColumns                               ChErrorType = 161  // TOO_MANY_COLUMNS
	ChErrorTooDeepSubqueries                            ChErrorType = 162  // TOO_DEEP_SUBQUERIES
	ChErrorTooDeepPipeline                              ChErrorType = 163  // TOO_DEEP_PIPELINE
	ChErrorReadonly                                     ChErrorType = 164  // READONLY
	ChErrorTooManyTemporaryColumns                      ChErrorType = 165  // TOO_MANY_TEMPORARY_COLUMNS
	ChErrorTooManyTemporaryNonConstColumns              ChErrorType = 166  // TOO_MANY_TEMPORARY_NON_CONST_COLUMNS
	ChErrorTooDeepAst                                   ChErrorType = 167  // TOO_DEEP_AST
	ChErrorTooBigAst                                    ChErrorType = 168  // TOO_BIG_AST
	ChErrorBadTypeOfField                               ChErrorType = 169  // BAD_TYPE_OF_FIELD
	ChErrorBadGet                                       ChErrorType = 170  // BAD_GET
	ChErrorCannotCreateDirectory                        ChErrorType = 172  // CANNOT_CREATE_DIRECTORY
	ChErrorCannotAllocateMemory                         ChErrorType = 173  // CANNOT_ALLOCATE_MEMORY
	ChErrorCyclicAliases                                ChErrorType = 174  // CYCLIC_ALIASES
	ChErrorChunkNotFound                                ChErrorType = 176  // CHUNK_NOT_FOUND
	ChErrorDuplicateChunkName                           ChErrorType = 177  // DUPLICATE_CHUNK_NAME
	ChErrorMultipleAliasesForExpression                 ChErrorType = 178  // MULTIPLE_ALIASES_FOR_EXPRESSION
	ChErrorMultipleExpressionsForAlias                  ChErrorType = 179  // MULTIPLE_EXPRESSIONS_FOR_ALIAS
	ChErrorThereIsNoProfile                             ChErrorType = 180  // THERE_IS_NO_PROFILE
	ChErrorIllegalFinal                                 ChErrorType = 181  // ILLEGAL_FINAL
	ChErrorIllegalPrewhere                              ChErrorType = 182  // ILLEGAL_PREWHERE
	ChErrorUnexpectedExpression                         ChErrorType = 183  // UNEXPECTED_EXPRESSION
	ChErrorIllegalAggregation                           ChErrorType = 184  // ILLEGAL_AGGREGATION
	ChErrorUnsupportedMyisamBlockType                   ChErrorType = 185  // UNSUPPORTED_MYISAM_BLOCK_TYPE
	ChErrorUnsupportedCollationLocale                   ChErrorType = 186  // UNSUPPORTED_COLLATION_LOCALE
	ChErrorCollationComparisonFailed                    ChErrorType = 187  // COLLATION_COMPARISON_FAILED
	ChErrorUnknownAction                                ChErrorType = 188  // UNKNOWN_ACTION
	ChErrorTableMustNotBeCreatedManually                ChErrorType = 189  // TABLE_MUST_NOT_BE_CREATED_MANUALLY
	ChErrorSizesOfArraysDoesntMatch                     ChErrorType = 190  // SIZES_OF_ARRAYS_DOESNT_MATCH
	ChErrorSetSizeLimitExceeded                         ChErrorType = 191  // SET_SIZE_LIMIT_EXCEEDED
	ChErrorUnknownUser                                  ChErrorType = 192  // UNKNOWN_USER
	ChErrorWrongPassword                                ChErrorType = 193  // WRONG_PASSWORD
	ChErrorRequiredPassword                             ChErrorType = 194  // REQUIRED_PASSWORD
	ChErrorIPAddressNotAllowed                          ChErrorType = 195  // IP_ADDRESS_NOT_ALLOWED
	ChErrorUnknownAddressPatternType                    ChErrorType = 196  // UNKNOWN_ADDRESS_PATTERN_TYPE
	ChErrorServerRevisionIsTooOld                       ChErrorType = 197  // SERVER_REVISION_IS_TOO_OLD
	ChErrorDNSError                                     ChErrorType = 198  // DNS_ERROR
	ChErrorUnknownQuota                                 ChErrorType = 199  // UNKNOWN_QUOTA
	ChErrorQuotaDoesntAllowKeys                         ChErrorType = 200  // QUOTA_DOESNT_ALLOW_KEYS
	ChErrorQuotaExpired                                 ChErrorType = 201  // QUOTA_EXPIRED
	ChErrorTooManySimultaneousQueries                   ChErrorType = 202  // TOO_MANY_SIMULTANEOUS_QUERIES
	ChErrorNoFreeConnection                             ChErrorType = 203  // NO_FREE_CONNECTION
	ChErrorCannotFsync                                  ChErrorType = 204  // CANNOT_FSYNC
	ChErrorNestedTypeTooDeep                            ChErrorType = 205  // NESTED_TYPE_TOO_DEEP
	ChErrorAliasRequired                                ChErrorType = 206  // ALIAS_REQUIRED
	ChErrorAmbiguousIdentifier                          ChErrorType = 207  // AMBIGUOUS_IDENTIFIER
	ChErrorEmptyNestedTable                             ChErrorType = 208  // EMPTY_NESTED_TABLE
	ChErrorSocketTimeout                                ChErrorType = 209  // SOCKET_TIMEOUT
	ChErrorNetworkError                                 ChErrorType = 210  // NETWORK_ERROR
	ChErrorEmptyQuery                                   ChErrorType = 211  // EMPTY_QUERY
	ChErrorUnknownLoadBalancing                         ChErrorType = 212  // UNKNOWN_LOAD_BALANCING
	ChErrorUnknownTotalsMode                            ChErrorType = 213  // UNKNOWN_TOTALS_MODE
	ChErrorCannotStatvfs                                ChErrorType = 214  // CANNOT_STATVFS
	ChErrorNotAnAggregate                               ChErrorType = 215  // NOT_AN_AGGREGATE
	ChErrorQueryWithSameIDIsAlreadyRunning              ChErrorType = 216  // QUERY_WITH_SAME_ID_IS_ALREADY_RUNNING
	ChErrorClientHasConnectedToWrongPort                ChErrorType = 217  // CLIENT_HAS_CONNECTED_TO_WRONG_PORT
	ChErrorTableIsDropped                               ChErrorType = 218  // TABLE_IS_DROPPED
	ChErrorDatabaseNotEmpty                             ChErrorType = 219  // DATABASE_NOT_EMPTY
	ChErrorDuplicateInterserverIoEndpoint               ChErrorType = 220  // DUPLICATE_INTERSERVER_IO_ENDPOINT
	ChErrorNoSuchInterserverIoEndpoint                  ChErrorType = 221  // NO_SUCH_INTERSERVER_IO_ENDPOINT
	ChErrorAddingReplicaToNonEmptyTable                 ChErrorType = 222  // ADDING_REPLICA_TO_NON_EMPTY_TABLE
	ChErrorUnexpectedAstStructure                       ChErrorType = 223  // UNEXPECTED_AST_STRUCTURE
	ChErrorReplicaIsAlreadyActive                       ChErrorType = 224  // REPLICA_IS_ALREADY_ACTIVE
	ChErrorNoZookeeper                                  ChErrorType = 225  // NO_ZOOKEEPER
	ChErrorNoFileInDataPart                             ChErrorType = 226  // NO_FILE_IN_DATA_PART
	ChErrorUnexpectedFileInDataPart                     ChErrorType = 227  // UNEXPECTED_FILE_IN_DATA_PART
	ChErrorBadSizeOfFileInDataPart                      ChErrorType = 228  // BAD_SIZE_OF_FILE_IN_DATA_PART
	ChErrorQueryIsTooLarge                              ChErrorType = 229  // QUERY_IS_TOO_LARGE
	ChErrorNotFoundExpectedDataPart                     ChErrorType = 230  // NOT_FOUND_EXPECTED_DATA_PART
	ChErrorTooManyUnexpectedDataParts                   ChErrorType = 231  // TOO_MANY_UNEXPECTED_DATA_PARTS
	ChErrorNoSuchDataPart                               ChErrorType = 232  // NO_SUCH_DATA_PART
	ChErrorBadDataPartName                              ChErrorType = 233  // BAD_DATA_PART_NAME
	ChErrorNoReplicaHasPart                             ChErrorType = 234  // NO_REPLICA_HAS_PART
	ChErrorDuplicateDataPart                            ChErrorType = 235  // DUPLICATE_DATA_PART
	ChErrorAborted                                      ChErrorType = 236  // ABORTED
	ChErrorNoReplicaNameGiven                           ChErrorType = 237  // NO_REPLICA_NAME_GIVEN
	ChErrorFormatVersionTooOld                          ChErrorType = 238  // FORMAT_VERSION_TOO_OLD
	ChErrorCannotMunmap                                 ChErrorType = 239  // CANNOT_MUNMAP
	ChErrorCannotMremap                                 ChErrorType = 240  // CANNOT_MREMAP
	ChErrorMemoryLimitExceeded                          ChErrorType = 241  // MEMORY_LIMIT_EXCEEDED
	ChErrorTableIsReadOnly                              ChErrorType = 242  // TABLE_IS_READ_ONLY
	ChErrorNotEnoughSpace                               ChErrorType = 243  // NOT_ENOUGH_SPACE
	ChErrorUnexpectedZookeeperError                     ChErrorType = 244  // UNEXPECTED_ZOOKEEPER_ERROR
	ChErrorCorruptedData                                ChErrorType = 246  // CORRUPTED_DATA
	ChErrorIncorrectMark                                ChErrorType = 247  // INCORRECT_MARK
	ChErrorInvalidPartitionValue                        ChErrorType = 248  // INVALID_PARTITION_VALUE
	ChErrorNotEnoughBlockNumbers                        ChErrorType = 250  // NOT_ENOUGH_BLOCK_NUMBERS
	ChErrorNoSuchReplica                                ChErrorType = 251  // NO_SUCH_REPLICA
	ChErrorTooManyParts                                 ChErrorType = 252  // TOO_MANY_PARTS
	ChErrorReplicaIsAlreadyExist                        ChErrorType = 253  // REPLICA_IS_ALREADY_EXIST
	ChErrorNoActiveReplicas                             ChErrorType = 254  // NO_ACTIVE_REPLICAS
	ChErrorTooManyRetriesToFetchParts                   ChErrorType = 255  // TOO_MANY_RETRIES_TO_FETCH_PARTS
	ChErrorPartitionAlreadyExists                       ChErrorType = 256  // PARTITION_ALREADY_EXISTS
	ChErrorPartitionDoesntExist                         ChErrorType = 257  // PARTITION_DOESNT_EXIST
	ChErrorUnionAllResultStructuresMismatch             ChErrorType = 258  // UNION_ALL_RESULT_STRUCTURES_MISMATCH
	ChErrorClientOutputFormatSpecified                  ChErrorType = 260  // CLIENT_OUTPUT_FORMAT_SPECIFIED
	ChErrorUnknownBlockInfoField                        ChErrorType = 261  // UNKNOWN_BLOCK_INFO_FIELD
	ChErrorBadCollation                                 ChErrorType = 262  // BAD_COLLATION
	ChErrorCannotCompileCode                            ChErrorType = 263  // CANNOT_COMPILE_CODE
	ChErrorIncompatibleTypeOfJoin                       ChErrorType = 264  // INCOMPATIBLE_TYPE_OF_JOIN
	ChErrorNoAvailableReplica                           ChErrorType = 265  // NO_AVAILABLE_REPLICA
	ChErrorMismatchReplicasDataSources                  ChErrorType = 266  // MISMATCH_REPLICAS_DATA_SOURCES
	ChErrorStorageDoesntSupportParallelReplicas         ChErrorType = 267  // STORAGE_DOESNT_SUPPORT_PARALLEL_REPLICAS
	ChErrorCpuidError                                   ChErrorType = 268  // CPUID_ERROR
	ChErrorInfiniteLoop                                 ChErrorType = 269  // INFINITE_LOOP
	ChErrorCannotCompress                               ChErrorType = 270  // CANNOT_COMPRESS
	ChErrorCannotDecompress                             ChErrorType = 271  // CANNOT_DECOMPRESS
	ChErrorCannotIoSubmit                               ChErrorType = 272  // CANNOT_IO_SUBMIT
	ChErrorCannotIoGetevents                            ChErrorType = 273  // CANNOT_IO_GETEVENTS
	ChErrorAioReadError                                 ChErrorType = 274  // AIO_READ_ERROR
	ChErrorAioWriteError                                ChErrorType = 275  // AIO_WRITE_ERROR
	ChErrorIndexNotUsed                                 ChErrorType = 277  // INDEX_NOT_USED
	ChErrorAllConnectionTriesFailed                     ChErrorType = 279  // ALL_CONNECTION_TRIES_FAILED
	ChErrorNoAvailableData                              ChErrorType = 280  // NO_AVAILABLE_DATA
	ChErrorDictionaryIsEmpty                            ChErrorType = 281  // DICTIONARY_IS_EMPTY
	ChErrorIncorrectIndex                               ChErrorType = 282  // INCORRECT_INDEX
	ChErrorUnknownDistributedProductMode                ChErrorType = 283  // UNKNOWN_DISTRIBUTED_PRODUCT_MODE
	ChErrorWrongGlobalSubquery                          ChErrorType = 284  // WRONG_GLOBAL_SUBQUERY
	ChErrorTooFewLiveReplicas                           ChErrorType = 285  // TOO_FEW_LIVE_REPLICAS
	ChErrorUnsatisfiedQuorumForPreviousWrite            ChErrorType = 286  // UNSATISFIED_QUORUM_FOR_PREVIOUS_WRITE
	ChErrorUnknownFormatVersion                         ChErrorType = 287  // UNKNOWN_FORMAT_VERSION
	ChErrorDistributedInJoinSubqueryDenied              ChErrorType = 288  // DISTRIBUTED_IN_JOIN_SUBQUERY_DENIED
	ChErrorReplicaIsNotInQuorum                         ChErrorType = 289  // REPLICA_IS_NOT_IN_QUORUM
	ChErrorLimitExceeded                                ChErrorType = 290  // LIMIT_EXCEEDED
	ChErrorDatabaseAccessDenied                         ChErrorType = 291  // DATABASE_ACCESS_DENIED
	ChErrorMongodbCannotAuthenticate                    ChErrorType = 293  // MONGODB_CANNOT_AUTHENTICATE
	ChErrorInvalidBlockExtraInfo                        ChErrorType = 294  // INVALID_BLOCK_EXTRA_INFO
	ChErrorReceivedEmptyData                            ChErrorType = 295  // RECEIVED_EMPTY_DATA
	ChErrorNoRemoteShardFound                           ChErrorType = 296  // NO_REMOTE_SHARD_FOUND
	ChErrorShardHasNoConnections                        ChErrorType = 297  // SHARD_HAS_NO_CONNECTIONS
	ChErrorCannotPipe                                   ChErrorType = 298  // CANNOT_PIPE
	ChErrorCannotFork                                   ChErrorType = 299  // CANNOT_FORK
	ChErrorCannotDlsym                                  ChErrorType = 300  // CANNOT_DLSYM
	ChErrorCannotCreateChildProcess                     ChErrorType = 301  // CANNOT_CREATE_CHILD_PROCESS
	ChErrorChildWasNotExitedNormally                    ChErrorType = 302  // CHILD_WAS_NOT_EXITED_NORMALLY
	ChErrorCannotSelect                                 ChErrorType = 303  // CANNOT_SELECT
	ChErrorCannotWaitpid                                ChErrorType = 304  // CANNOT_WAITPID
	ChErrorTableWasNotDropped                           ChErrorType = 305  // TABLE_WAS_NOT_DROPPED
	ChErrorTooDeepRecursion                             ChErrorType = 306  // TOO_DEEP_RECURSION
	ChErrorTooManyBytes                                 ChErrorType = 307  // TOO_MANY_BYTES
	ChErrorUnexpectedNodeInZookeeper                    ChErrorType = 308  // UNEXPECTED_NODE_IN_ZOOKEEPER
	ChErrorFunctionCannotHaveParameters                 ChErrorType = 309  // FUNCTION_CANNOT_HAVE_PARAMETERS
	ChErrorInvalidShardWeight                           ChErrorType = 317  // INVALID_SHARD_WEIGHT
	ChErrorInvalidConfigParameter                       ChErrorType = 318  // INVALID_CONFIG_PARAMETER
	ChErrorUnknownStatusOfInsert                        ChErrorType = 319  // UNKNOWN_STATUS_OF_INSERT
	ChErrorValueIsOutOfRangeOfDataType                  ChErrorType = 321  // VALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE
	ChErrorBarrierTimeout                               ChErrorType = 335  // BARRIER_TIMEOUT
	ChErrorUnknownDatabaseEngine                        ChErrorType = 336  // UNKNOWN_DATABASE_ENGINE
	ChErrorDdlGuardIsActive                             ChErrorType = 337  // DDL_GUARD_IS_ACTIVE
	ChErrorUnfinished                                   ChErrorType = 341  // UNFINISHED
	ChErrorMetadataMismatch                             ChErrorType = 342  // METADATA_MISMATCH
	ChErrorSupportIsDisabled                            ChErrorType = 344  // SUPPORT_IS_DISABLED
	ChErrorTableDiffersTooMuch                          ChErrorType = 345  // TABLE_DIFFERS_TOO_MUCH
	ChErrorCannotConvertCharset                         ChErrorType = 346  // CANNOT_CONVERT_CHARSET
	ChErrorCannotLoadConfig                             ChErrorType = 347  // CANNOT_LOAD_CONFIG
	ChErrorCannotInsertNullInOrdinaryColumn             ChErrorType = 349  // CANNOT_INSERT_NULL_IN_ORDINARY_COLUMN
	ChErrorIncompatibleSourceTables                     ChErrorType = 350  // INCOMPATIBLE_SOURCE_TABLES
	ChErrorAmbiguousTableName                           ChErrorType = 351  // AMBIGUOUS_TABLE_NAME
	ChErrorAmbiguousColumnName                          ChErrorType = 352  // AMBIGUOUS_COLUMN_NAME
	ChErrorIndexOfPositionalArgumentIsOutOfRange        ChErrorType = 353  // INDEX_OF_POSITIONAL_ARGUMENT_IS_OUT_OF_RANGE
	ChErrorZlibInflateFailed                            ChErrorType = 354  // ZLIB_INFLATE_FAILED
	ChErrorZlibDeflateFailed                            ChErrorType = 355  // ZLIB_DEFLATE_FAILED
	ChErrorBadLambda                                    ChErrorType = 356  // BAD_LAMBDA
	ChErrorReservedIdentifierName                       ChErrorType = 357  // RESERVED_IDENTIFIER_NAME
	ChErrorIntoOutfileNotAllowed                        ChErrorType = 358  // INTO_OUTFILE_NOT_ALLOWED
	ChErrorTableSizeExceedsMaxDropSizeLimit             ChErrorType = 359  // TABLE_SIZE_EXCEEDS_MAX_DROP_SIZE_LIMIT
	ChErrorCannotCreateCharsetConverter                 ChErrorType = 360  // CANNOT_CREATE_CHARSET_CONVERTER
	ChErrorSeekPositionOutOfBound                       ChErrorType = 361  // SEEK_POSITION_OUT_OF_BOUND
	ChErrorCurrentWriteBufferIsExhausted                ChErrorType = 362  // CURRENT_WRITE_BUFFER_IS_EXHAUSTED
	ChErrorCannotCreateIoBuffer                         ChErrorType = 363  // CANNOT_CREATE_IO_BUFFER
	ChErrorReceivedErrorTooManyRequests                 ChErrorType = 364  // RECEIVED_ERROR_TOO_MANY_REQUESTS
	ChErrorSizesOfNestedColumnsAreInconsistent          ChErrorType = 366  // SIZES_OF_NESTED_COLUMNS_ARE_INCONSISTENT
	ChErrorTooManyFetches                               ChErrorType = 367  // TOO_MANY_FETCHES
	ChErrorAllReplicasAreStale                          ChErrorType = 369  // ALL_REPLICAS_ARE_STALE
	ChErrorDataTypeCannotBeUsedInTables                 ChErrorType = 370  // DATA_TYPE_CANNOT_BE_USED_IN_TABLES
	ChErrorInconsistentClusterDefinition                ChErrorType = 371  // INCONSISTENT_CLUSTER_DEFINITION
	ChErrorSessionNotFound                              ChErrorType = 372  // SESSION_NOT_FOUND
	ChErrorSessionIsLocked                              ChErrorType = 373  // SESSION_IS_LOCKED
	ChErrorInvalidSessionTimeout                        ChErrorType = 374  // INVALID_SESSION_TIMEOUT
	ChErrorCannotDlopen                                 ChErrorType = 375  // CANNOT_DLOPEN
	ChErrorCannotParseUUID                              ChErrorType = 376  // CANNOT_PARSE_UUID
	ChErrorIllegalSyntaxForDataType                     ChErrorType = 377  // ILLEGAL_SYNTAX_FOR_DATA_TYPE
	ChErrorDataTypeCannotHaveArguments                  ChErrorType = 378  // DATA_TYPE_CANNOT_HAVE_ARGUMENTS
	ChErrorUnknownStatusOfDistributedDdlTask            ChErrorType = 379  // UNKNOWN_STATUS_OF_DISTRIBUTED_DDL_TASK
	ChErrorCannotKill                                   ChErrorType = 380  // CANNOT_KILL
	ChErrorHTTPLengthRequired                           ChErrorType = 381  // HTTP_LENGTH_REQUIRED
	ChErrorCannotLoadCatboostModel                      ChErrorType = 382  // CANNOT_LOAD_CATBOOST_MODEL
	ChErrorCannotApplyCatboostModel                     ChErrorType = 383  // CANNOT_APPLY_CATBOOST_MODEL
	ChErrorPartIsTemporarilyLocked                      ChErrorType = 384  // PART_IS_TEMPORARILY_LOCKED
	ChErrorMultipleStreamsRequired                      ChErrorType = 385  // MULTIPLE_STREAMS_REQUIRED
	ChErrorNoCommonType                                 ChErrorType = 386  // NO_COMMON_TYPE
	ChErrorDictionaryAlreadyExists                      ChErrorType = 387  // DICTIONARY_ALREADY_EXISTS
	ChErrorCannotAssignOptimize                         ChErrorType = 388  // CANNOT_ASSIGN_OPTIMIZE
	ChErrorInsertWasDeduplicated                        ChErrorType = 389  // INSERT_WAS_DEDUPLICATED
	ChErrorCannotGetCreateTableQuery                    ChErrorType = 390  // CANNOT_GET_CREATE_TABLE_QUERY
	ChErrorExternalLibraryError                         ChErrorType = 391  // EXTERNAL_LIBRARY_ERROR
	ChErrorQueryIsProhibited                            ChErrorType = 392  // QUERY_IS_PROHIBITED
	ChErrorThereIsNoQuery                               ChErrorType = 393  // THERE_IS_NO_QUERY
	ChErrorQueryWasCancelled                            ChErrorType = 394  // QUERY_WAS_CANCELED
	ChErrorFunctionThrowIfValueIsNonZero                ChErrorType = 395  // FUNCTION_THROW_IF_VALUE_IS_NON_ZERO
	ChErrorTooManyRowsOrBytes                           ChErrorType = 396  // TOO_MANY_ROWS_OR_BYTES
	ChErrorQueryIsNotSupportedInMaterializedView        ChErrorType = 397  // QUERY_IS_NOT_SUPPORTED_IN_MATERIALIZED_VIEW
	ChErrorUnknownMutationCommand                       ChErrorType = 398  // UNKNOWN_MUTATION_COMMAND
	ChErrorFormatIsNotSuitableForOutput                 ChErrorType = 399  // FORMAT_IS_NOT_SUITABLE_FOR_OUTPUT
	ChErrorCannotStat                                   ChErrorType = 400  // CANNOT_STAT
	ChErrorFeatureIsNotEnabledAtBuildTime               ChErrorType = 401  // FEATURE_IS_NOT_ENABLED_AT_BUILD_TIME
	ChErrorCannotIosetup                                ChErrorType = 402  // CANNOT_IOSETUP
	ChErrorInvalidJoinOnExpression                      ChErrorType = 403  // INVALID_JOIN_ON_EXPRESSION
	ChErrorBadOdbcConnectionString                      ChErrorType = 404  // BAD_ODBC_CONNECTION_STRING
	ChErrorPartitionSizeExceedsMaxDropSizeLimit         ChErrorType = 405  // PARTITION_SIZE_EXCEEDS_MAX_DROP_SIZE_LIMIT
	ChErrorTopAndLimitTogether                          ChErrorType = 406  // TOP_AND_LIMIT_TOGETHER
	ChErrorDecimalOverflow                              ChErrorType = 407  // DECIMAL_OVERFLOW
	ChErrorBadRequestParameter                          ChErrorType = 408  // BAD_REQUEST_PARAMETER
	ChErrorExternalExecutableNotFound                   ChErrorType = 409  // EXTERNAL_EXECUTABLE_NOT_FOUND
	ChErrorExternalServerIsNotResponding                ChErrorType = 410  // EXTERNAL_SERVER_IS_NOT_RESPONDING
	ChErrorPthreadError                                 ChErrorType = 411  // PTHREAD_ERROR
	ChErrorNetlinkError                                 ChErrorType = 412  // NETLINK_ERROR
	ChErrorCannotSetSignalHandler                       ChErrorType = 413  // CANNOT_SET_SIGNAL_HANDLER
	ChErrorAllReplicasLost                              ChErrorType = 415  // ALL_REPLICAS_LOST
	ChErrorReplicaStatusChanged                         ChErrorType = 416  // REPLICA_STATUS_CHANGED
	ChErrorExpectedAllOrAny                             ChErrorType = 417  // EXPECTED_ALL_OR_ANY
	ChErrorUnknownJoin                                  ChErrorType = 418  // UNKNOWN_JOIN
	ChErrorMultipleAssignmentsToColumn                  ChErrorType = 419  // MULTIPLE_ASSIGNMENTS_TO_COLUMN
	ChErrorCannotUpdateColumn                           ChErrorType = 420  // CANNOT_UPDATE_COLUMN
	ChErrorCannotAddDifferentAggregateStates            ChErrorType = 421  // CANNOT_ADD_DIFFERENT_AGGREGATE_STATES
	ChErrorUnsupportedURIScheme                         ChErrorType = 422  // UNSUPPORTED_URI_SCHEME
	ChErrorCannotGettimeofday                           ChErrorType = 423  // CANNOT_GETTIMEOFDAY
	ChErrorCannotLink                                   ChErrorType = 424  // CANNOT_LINK
	ChErrorSystemError                                  ChErrorType = 425  // SYSTEM_ERROR
	ChErrorCannotCompileRegexp                          ChErrorType = 427  // CANNOT_COMPILE_REGEXP
	ChErrorUnknownLogLevel                              ChErrorType = 428  // UNKNOWN_LOG_LEVEL
	ChErrorFailedToGetpwuid                             ChErrorType = 429  // FAILED_TO_GETPWUID
	ChErrorMismatchingUsersForProcessAndData            ChErrorType = 430  // MISMATCHING_USERS_FOR_PROCESS_AND_DATA
	ChErrorIllegalSyntaxForCodecType                    ChErrorType = 431  // ILLEGAL_SYNTAX_FOR_CODEC_TYPE
	ChErrorUnknownCodec                                 ChErrorType = 432  // UNKNOWN_CODEC
	ChErrorIllegalCodecParameter                        ChErrorType = 433  // ILLEGAL_CODEC_PARAMETER
	ChErrorCannotParseProtobufSchema                    ChErrorType = 434  // CANNOT_PARSE_PROTOBUF_SCHEMA
	ChErrorNoColumnSerializedToRequiredProtobufField    ChErrorType = 435  // NO_COLUMN_SERIALIZED_TO_REQUIRED_PROTOBUF_FIELD
	ChErrorProtobufBadCast                              ChErrorType = 436  // PROTOBUF_BAD_CAST
	ChErrorProtobufFieldNotRepeated                     ChErrorType = 437  // PROTOBUF_FIELD_NOT_REPEATED
	ChErrorDataTypeCannotBePromoted                     ChErrorType = 438  // DATA_TYPE_CANNOT_BE_PROMOTED
	ChErrorCannotScheduleTask                           ChErrorType = 439  // CANNOT_SCHEDULE_TASK
	ChErrorInvalidLimitExpression                       ChErrorType = 440  // INVALID_LIMIT_EXPRESSION
	ChErrorCannotParseDomainValueFromString             ChErrorType = 441  // CANNOT_PARSE_DOMAIN_VALUE_FROM_STRING
	ChErrorBadDatabaseForTemporaryTable                 ChErrorType = 442  // BAD_DATABASE_FOR_TEMPORARY_TABLE
	ChErrorNoColumnsSerializedToProtobufFields          ChErrorType = 443  // NO_COLUMNS_SERIALIZED_TO_PROTOBUF_FIELDS
	ChErrorUnknownProtobufFormat                        ChErrorType = 444  // UNKNOWN_PROTOBUF_FORMAT
	ChErrorCannotMprotect                               ChErrorType = 445  // CANNOT_MPROTECT
	ChErrorFunctionNotAllowed                           ChErrorType = 446  // FUNCTION_NOT_ALLOWED
	ChErrorHyperscanCannotScanText                      ChErrorType = 447  // HYPERSCAN_CANNOT_SCAN_TEXT
	ChErrorBrotliReadFailed                             ChErrorType = 448  // BROTLI_READ_FAILED
	ChErrorBrotliWriteFailed                            ChErrorType = 449  // BROTLI_WRITE_FAILED
	ChErrorBadTTLExpression                             ChErrorType = 450  // BAD_TTL_EXPRESSION
	ChErrorBadTTLFile                                   ChErrorType = 451  // BAD_TTL_FILE
	ChErrorSettingConstraintViolation                   ChErrorType = 452  // SETTING_CONSTRAINT_VIOLATION
	ChErrorMysqlClientInsufficientCapabilities          ChErrorType = 453  // MYSQL_CLIENT_INSUFFICIENT_CAPABILITIES
	ChErrorOpensslError                                 ChErrorType = 454  // OPENSSL_ERROR
	ChErrorSuspiciousTypeForLowCardinality              ChErrorType = 455  // SUSPICIOUS_TYPE_FOR_LOW_CARDINALITY
	ChErrorUnknownQueryParameter                        ChErrorType = 456  // UNKNOWN_QUERY_PARAMETER
	ChErrorBadQueryParameter                            ChErrorType = 457  // BAD_QUERY_PARAMETER
	ChErrorCannotUnlink                                 ChErrorType = 458  // CANNOT_UNLINK
	ChErrorCannotSetThreadPriority                      ChErrorType = 459  // CANNOT_SET_THREAD_PRIORITY
	ChErrorCannotCreateTimer                            ChErrorType = 460  // CANNOT_CREATE_TIMER
	ChErrorCannotSetTimerPeriod                         ChErrorType = 461  // CANNOT_SET_TIMER_PERIOD
	ChErrorCannotDeleteTimer                            ChErrorType = 462  // CANNOT_DELETE_TIMER
	ChErrorCannotFcntl                                  ChErrorType = 463  // CANNOT_FCNTL
	ChErrorCannotParseElf                               ChErrorType = 464  // CANNOT_PARSE_ELF
	ChErrorCannotParseDwarf                             ChErrorType = 465  // CANNOT_PARSE_DWARF
	ChErrorInsecurePath                                 ChErrorType = 466  // INSECURE_PATH
	ChErrorCannotParseBool                              ChErrorType = 467  // CANNOT_PARSE_BOOL
	ChErrorCannotPthreadAttr                            ChErrorType = 468  // CANNOT_PTHREAD_ATTR
	ChErrorViolatedConstraint                           ChErrorType = 469  // VIOLATED_CONSTRAINT
	ChErrorQueryIsNotSupportedInLiveView                ChErrorType = 470  // QUERY_IS_NOT_SUPPORTED_IN_LIVE_VIEW
	ChErrorInvalidSettingValue                          ChErrorType = 471  // INVALID_SETTING_VALUE
	ChErrorReadonlySetting                              ChErrorType = 472  // READONLY_SETTING
	ChErrorDeadlockAvoided                              ChErrorType = 473  // DEADLOCK_AVOIDED
	ChErrorInvalidTemplateFormat                        ChErrorType = 474  // INVALID_TEMPLATE_FORMAT
	ChErrorInvalidWithFillExpression                    ChErrorType = 475  // INVALID_WITH_FILL_EXPRESSION
	ChErrorWithTiesWithoutOrderBy                       ChErrorType = 476  // WITH_TIES_WITHOUT_ORDER_BY
	ChErrorInvalidUsageOfInput                          ChErrorType = 477  // INVALID_USAGE_OF_INPUT
	ChErrorUnknownPolicy                                ChErrorType = 478  // UNKNOWN_POLICY
	ChErrorUnknownDisk                                  ChErrorType = 479  // UNKNOWN_DISK
	ChErrorUnknownProtocol                              ChErrorType = 480  // UNKNOWN_PROTOCOL
	ChErrorPathAccessDenied                             ChErrorType = 481  // PATH_ACCESS_DENIED
	ChErrorDictionaryAccessDenied                       ChErrorType = 482  // DICTIONARY_ACCESS_DENIED
	ChErrorTooManyRedirects                             ChErrorType = 483  // TOO_MANY_REDIRECTS
	ChErrorInternalRedisError                           ChErrorType = 484  // INTERNAL_REDIS_ERROR
	ChErrorScalarAlreadyExists                          ChErrorType = 485  // SCALAR_ALREADY_EXISTS
	ChErrorCannotGetCreateDictionaryQuery               ChErrorType = 487  // CANNOT_GET_CREATE_DICTIONARY_QUERY
	ChErrorUnknownDictionary                            ChErrorType = 488  // UNKNOWN_DICTIONARY
	ChErrorIncorrectDictionaryDefinition                ChErrorType = 489  // INCORRECT_DICTIONARY_DEFINITION
	ChErrorCannotFormatDatetime                         ChErrorType = 490  // CANNOT_FORMAT_DATETIME
	ChErrorUnacceptableURL                              ChErrorType = 491  // UNACCEPTABLE_URL
	ChErrorAccessEntityNotFound                         ChErrorType = 492  // ACCESS_ENTITY_NOT_FOUND
	ChErrorAccessEntityAlreadyExists                    ChErrorType = 493  // ACCESS_ENTITY_ALREADY_EXISTS
	ChErrorAccessEntityFoundDuplicates                  ChErrorType = 494  // ACCESS_ENTITY_FOUND_DUPLICATES
	ChErrorAccessStorageReadonly                        ChErrorType = 495  // ACCESS_STORAGE_READONLY
	ChErrorQuotaRequiresClientKey                       ChErrorType = 496  // QUOTA_REQUIRES_CLIENT_KEY
	ChErrorAccessDenied                                 ChErrorType = 497  // ACCESS_DENIED
	ChErrorLimitByWithTiesIsNotSupported                ChErrorType = 498  // LIMIT_BY_WITH_TIES_IS_NOT_SUPPORTED
	ChErrorS3Error                                      ChErrorType = 499  // S3_ERROR
	ChErrorAzureBlobStorageError                        ChErrorType = 500  // AZURE_BLOB_STORAGE_ERROR
	ChErrorCannotCreateDatabase                         ChErrorType = 501  // CANNOT_CREATE_DATABASE
	ChErrorCannotSigqueue                               ChErrorType = 502  // CANNOT_SIGQUEUE
	ChErrorAggregateFunctionThrow                       ChErrorType = 503  // AGGREGATE_FUNCTION_THROW
	ChErrorFileAlreadyExists                            ChErrorType = 504  // FILE_ALREADY_EXISTS
	ChErrorCannotDeleteDirectory                        ChErrorType = 505  // CANNOT_DELETE_DIRECTORY
	ChErrorUnexpectedErrorCode                          ChErrorType = 506  // UNEXPECTED_ERROR_CODE
	ChErrorUnableToSkipUnusedShards                     ChErrorType = 507  // UNABLE_TO_SKIP_UNUSED_SHARDS
	ChErrorUnknownAccessType                            ChErrorType = 508  // UNKNOWN_ACCESS_TYPE
	ChErrorInvalidGrant                                 ChErrorType = 509  // INVALID_GRANT
	ChErrorCacheDictionaryUpdateFail                    ChErrorType = 510  // CACHE_DICTIONARY_UPDATE_FAIL
	ChErrorUnknownRole                                  ChErrorType = 511  // UNKNOWN_ROLE
	ChErrorSetNonGrantedRole                            ChErrorType = 512  // SET_NON_GRANTED_ROLE
	ChErrorUnknownPartType                              ChErrorType = 513  // UNKNOWN_PART_TYPE
	ChErrorAccessStorageForInsertionNotFound            ChErrorType = 514  // ACCESS_STORAGE_FOR_INSERTION_NOT_FOUND
	ChErrorIncorrectAccessEntityDefinition              ChErrorType = 515  // INCORRECT_ACCESS_ENTITY_DEFINITION
	ChErrorAuthenticationFailed                         ChErrorType = 516  // AUTHENTICATION_FAILED
	ChErrorCannotAssignAlter                            ChErrorType = 517  // CANNOT_ASSIGN_ALTER
	ChErrorCannotCommitOffset                           ChErrorType = 518  // CANNOT_COMMIT_OFFSET
	ChErrorNoRemoteShardAvailable                       ChErrorType = 519  // NO_REMOTE_SHARD_AVAILABLE
	ChErrorCannotDetachDictionaryAsTable                ChErrorType = 520  // CANNOT_DETACH_DICTIONARY_AS_TABLE
	ChErrorAtomicRenameFail                             ChErrorType = 521  // ATOMIC_RENAME_FAIL
	ChErrorUnknownRowPolicy                             ChErrorType = 523  // UNKNOWN_ROW_POLICY
	ChErrorAlterOfColumnIsForbidden                     ChErrorType = 524  // ALTER_OF_COLUMN_IS_FORBIDDEN
	ChErrorIncorrectDiskIndex                           ChErrorType = 525  // INCORRECT_DISK_INDEX
	ChErrorNoSuitableFunctionImplementation             ChErrorType = 527  // NO_SUITABLE_FUNCTION_IMPLEMENTATION
	ChErrorCassandraInternalError                       ChErrorType = 528  // CASSANDRA_INTERNAL_ERROR
	ChErrorNotALeader                                   ChErrorType = 529  // NOT_A_LEADER
	ChErrorCannotConnectRabbitmq                        ChErrorType = 530  // CANNOT_CONNECT_RABBITMQ
	ChErrorCannotFstat                                  ChErrorType = 531  // CANNOT_FSTAT
	ChErrorLdapError                                    ChErrorType = 532  // LDAP_ERROR
	ChErrorInconsistentReservations                     ChErrorType = 533  // INCONSISTENT_RESERVATIONS
	ChErrorNoReservationsProvided                       ChErrorType = 534  // NO_RESERVATIONS_PROVIDED
	ChErrorUnknownRaidType                              ChErrorType = 535  // UNKNOWN_RAID_TYPE
	ChErrorCannotRestoreFromFieldDump                   ChErrorType = 536  // CANNOT_RESTORE_FROM_FIELD_DUMP
	ChErrorIllegalMysqlVariable                         ChErrorType = 537  // ILLEGAL_MYSQL_VARIABLE
	ChErrorMysqlSyntaxError                             ChErrorType = 538  // MYSQL_SYNTAX_ERROR
	ChErrorCannotBindRabbitmqExchange                   ChErrorType = 539  // CANNOT_BIND_RABBITMQ_EXCHANGE
	ChErrorCannotDeclareRabbitmqExchange                ChErrorType = 540  // CANNOT_DECLARE_RABBITMQ_EXCHANGE
	ChErrorCannotCreateRabbitmqQueueBinding             ChErrorType = 541  // CANNOT_CREATE_RABBITMQ_QUEUE_BINDING
	ChErrorCannotRemoveRabbitmqExchange                 ChErrorType = 542  // CANNOT_REMOVE_RABBITMQ_EXCHANGE
	ChErrorUnknownMysqlDatatypesSupportLevel            ChErrorType = 543  // UNKNOWN_MYSQL_DATATYPES_SUPPORT_LEVEL
	ChErrorRowAndRowsTogether                           ChErrorType = 544  // ROW_AND_ROWS_TOGETHER
	ChErrorFirstAndNextTogether                         ChErrorType = 545  // FIRST_AND_NEXT_TOGETHER
	ChErrorNoRowDelimiter                               ChErrorType = 546  // NO_ROW_DELIMITER
	ChErrorInvalidRaidType                              ChErrorType = 547  // INVALID_RAID_TYPE
	ChErrorUnknownVolume                                ChErrorType = 548  // UNKNOWN_VOLUME
	ChErrorDataTypeCannotBeUsedInKey                    ChErrorType = 549  // DATA_TYPE_CANNOT_BE_USED_IN_KEY
	ChErrorConditionalTreeParentNotFound                ChErrorType = 550  // CONDITIONAL_TREE_PARENT_NOT_FOUND
	ChErrorIllegalProjectionManipulator                 ChErrorType = 551  // ILLEGAL_PROJECTION_MANIPULATOR
	ChErrorUnrecognizedArguments                        ChErrorType = 552  // UNRECOGNIZED_ARGUMENTS
	ChErrorLzmaStreamEncoderFailed                      ChErrorType = 553  // LZMA_STREAM_ENCODER_FAILED
	ChErrorLzmaStreamDecoderFailed                      ChErrorType = 554  // LZMA_STREAM_DECODER_FAILED
	ChErrorRocksdbError                                 ChErrorType = 555  // ROCKSDB_ERROR
	ChErrorSyncMysqlUserAccessErro                      ChErrorType = 556  // SYNC_MYSQL_USER_ACCESS_ERRO
	ChErrorUnknownUnion                                 ChErrorType = 557  // UNKNOWN_UNION
	ChErrorExpectedAllOrDistinct                        ChErrorType = 558  // EXPECTED_ALL_OR_DISTINCT
	ChErrorInvalidGrpcQueryInfo                         ChErrorType = 559  // INVALID_GRPC_QUERY_INFO
	ChErrorZstdEncoderFailed                            ChErrorType = 560  // ZSTD_ENCODER_FAILED
	ChErrorZstdDecoderFailed                            ChErrorType = 561  // ZSTD_DECODER_FAILED
	ChErrorTldListNotFound                              ChErrorType = 562  // TLD_LIST_NOT_FOUND
	ChErrorCannotReadMapFromText                        ChErrorType = 563  // CANNOT_READ_MAP_FROM_TEXT
	ChErrorInterserverSchemeDoesntMatch                 ChErrorType = 564  // INTERSERVER_SCHEME_DOESNT_MATCH
	ChErrorTooManyPartitions                            ChErrorType = 565  // TOO_MANY_PARTITIONS
	ChErrorCannotRmdir                                  ChErrorType = 566  // CANNOT_RMDIR
	ChErrorDuplicatedPartUuids                          ChErrorType = 567  // DUPLICATED_PART_UUIDS
	ChErrorRaftError                                    ChErrorType = 568  // RAFT_ERROR
	ChErrorMultipleColumnsSerializedToSameProtobufField ChErrorType = 569  // MULTIPLE_COLUMNS_SERIALIZED_TO_SAME_PROTOBUF_FIELD
	ChErrorDataTypeIncompatibleWithProtobufField        ChErrorType = 570  // DATA_TYPE_INCOMPATIBLE_WITH_PROTOBUF_FIELD
	ChErrorDatabaseReplicationFailed                    ChErrorType = 571  // DATABASE_REPLICATION_FAILED
	ChErrorTooManyQueryPlanOptimizations                ChErrorType = 572  // TOO_MANY_QUERY_PLAN_OPTIMIZATIONS
	ChErrorEpollError                                   ChErrorType = 573  // EPOLL_ERROR
	ChErrorDistributedTooManyPendingBytes               ChErrorType = 574  // DISTRIBUTED_TOO_MANY_PENDING_BYTES
	ChErrorUnknownSnapshot                              ChErrorType = 575  // UNKNOWN_SNAPSHOT
	ChErrorKerberosError                                ChErrorType = 576  // KERBEROS_ERROR
	ChErrorInvalidShardID                               ChErrorType = 577  // INVALID_SHARD_ID
	ChErrorInvalidFormatInsertQueryWithData             ChErrorType = 578  // INVALID_FORMAT_INSERT_QUERY_WITH_DATA
	ChErrorIncorrectPartType                            ChErrorType = 579  // INCORRECT_PART_TYPE
	ChErrorCannotSetRoundingMode                        ChErrorType = 580  // CANNOT_SET_ROUNDING_MODE
	ChErrorTooLargeDistributedDepth                     ChErrorType = 581  // TOO_LARGE_DISTRIBUTED_DEPTH
	ChErrorNoSuchProjectionInTable                      ChErrorType = 582  // NO_SUCH_PROJECTION_IN_TABLE
	ChErrorIllegalProjection                            ChErrorType = 583  // ILLEGAL_PROJECTION
	ChErrorProjectionNotUsed                            ChErrorType = 584  // PROJECTION_NOT_USED
	ChErrorCannotParseYaml                              ChErrorType = 585  // CANNOT_PARSE_YAML
	ChErrorCannotCreateFile                             ChErrorType = 586  // CANNOT_CREATE_FILE
	ChErrorConcurrentAccessNotSupported                 ChErrorType = 587  // CONCURRENT_ACCESS_NOT_SUPPORTED
	ChErrorDistributedBrokenBatchInfo                   ChErrorType = 588  // DISTRIBUTED_BROKEN_BATCH_INFO
	ChErrorDistributedBrokenBatchFiles                  ChErrorType = 589  // DISTRIBUTED_BROKEN_BATCH_FILES
	ChErrorCannotSysconf                                ChErrorType = 590  // CANNOT_SYSCONF
	ChErrorSqliteEngineError                            ChErrorType = 591  // SQLITE_ENGINE_ERROR
	ChErrorDataEncryptionError                          ChErrorType = 592  // DATA_ENCRYPTION_ERROR
	ChErrorZeroCopyReplicationError                     ChErrorType = 593  // ZERO_COPY_REPLICATION_ERROR
	ChErrorBzip2StreamDecoderFailed                     ChErrorType = 594  // BZIP2_STREAM_DECODER_FAILED
	ChErrorBzip2StreamEncoderFailed                     ChErrorType = 595  // BZIP2_STREAM_ENCODER_FAILED
	ChErrorIntersectOrExceptResultStructuresMismatch    ChErrorType = 596  // INTERSECT_OR_EXCEPT_RESULT_STRUCTURES_MISMATCH
	ChErrorNoSuchErrorCode                              ChErrorType = 597  // NO_SUCH_ERROR_CODE
	ChErrorBackupAlreadyExists                          ChErrorType = 598  // BACKUP_ALREADY_EXISTS
	ChErrorBackupNotFound                               ChErrorType = 599  // BACKUP_NOT_FOUND
	ChErrorBackupVersionNotSupported                    ChErrorType = 600  // BACKUP_VERSION_NOT_SUPPORTED
	ChErrorBackupDamaged                                ChErrorType = 601  // BACKUP_DAMAGED
	ChErrorNoBaseBackup                                 ChErrorType = 602  // NO_BASE_BACKUP
	ChErrorWrongBaseBackup                              ChErrorType = 603  // WRONG_BASE_BACKUP
	ChErrorBackupEntryAlreadyExists                     ChErrorType = 604  // BACKUP_ENTRY_ALREADY_EXISTS
	ChErrorBackupEntryNotFound                          ChErrorType = 605  // BACKUP_ENTRY_NOT_FOUND
	ChErrorBackupIsEmpty                                ChErrorType = 606  // BACKUP_IS_EMPTY
	ChErrorBackupElementDuplicate                       ChErrorType = 607  // BACKUP_ELEMENT_DUPLICATE
	ChErrorCannotRestoreTable                           ChErrorType = 608  // CANNOT_RESTORE_TABLE
	ChErrorFunctionAlreadyExists                        ChErrorType = 609  // FUNCTION_ALREADY_EXISTS
	ChErrorCannotDropFunction                           ChErrorType = 610  // CANNOT_DROP_FUNCTION
	ChErrorCannotCreateRecursiveFunction                ChErrorType = 611  // CANNOT_CREATE_RECURSIVE_FUNCTION
	ChErrorObjectAlreadyStoredOnDisk                    ChErrorType = 612  // OBJECT_ALREADY_STORED_ON_DISK
	ChErrorObjectWasNotStoredOnDisk                     ChErrorType = 613  // OBJECT_WAS_NOT_STORED_ON_DISK
	ChErrorPostgresqlConnectionFailure                  ChErrorType = 614  // POSTGRESQL_CONNECTION_FAILURE
	ChErrorCannotAdvise                                 ChErrorType = 615  // CANNOT_ADVISE
	ChErrorUnknownReadMethod                            ChErrorType = 616  // UNKNOWN_READ_METHOD
	ChErrorLz4EncoderFailed                             ChErrorType = 617  // LZ4_ENCODER_FAILED
	ChErrorLz4DecoderFailed                             ChErrorType = 618  // LZ4_DECODER_FAILED
	ChErrorPostgresqlReplicationInternalError           ChErrorType = 619  // POSTGRESQL_REPLICATION_INTERNAL_ERROR
	ChErrorQueryNotAllowed                              ChErrorType = 620  // QUERY_NOT_ALLOWED
	ChErrorCannotNormalizeString                        ChErrorType = 621  // CANNOT_NORMALIZE_STRING
	ChErrorCannotParseCapnProtoSchema                   ChErrorType = 622  // CANNOT_PARSE_CAPN_PROTO_SCHEMA
	ChErrorCapnProtoBadCast                             ChErrorType = 623  // CAPN_PROTO_BAD_CAST
	ChErrorBadFileType                                  ChErrorType = 624  // BAD_FILE_TYPE
	ChErrorIoSetupError                                 ChErrorType = 625  // IO_SETUP_ERROR
	ChErrorCannotSkipUnknownField                       ChErrorType = 626  // CANNOT_SKIP_UNKNOWN_FIELD
	ChErrorBackupEngineNotFound                         ChErrorType = 627  // BACKUP_ENGINE_NOT_FOUND
	ChErrorOffsetFetchWithoutOrderBy                    ChErrorType = 628  // OFFSET_FETCH_WITHOUT_ORDER_BY
	ChErrorHTTPRangeNotSatisfiable                      ChErrorType = 629  // HTTP_RANGE_NOT_SATISFIABLE
	ChErrorHaveDependentObjects                         ChErrorType = 630  // HAVE_DEPENDENT_OBJECTS
	ChErrorUnknownFileSize                              ChErrorType = 631  // UNKNOWN_FILE_SIZE
	ChErrorUnexpectedDataAfterParsedValue               ChErrorType = 632  // UNEXPECTED_DATA_AFTER_PARSED_VALUE
	ChErrorQueryIsNotSupportedInWindowView              ChErrorType = 633  // QUERY_IS_NOT_SUPPORTED_IN_WINDOW_VIEW
	ChErrorMongodbError                                 ChErrorType = 634  // MONGODB_ERROR
	ChErrorCannotPoll                                   ChErrorType = 635  // CANNOT_POLL
	ChErrorCannotExtractTableStructure                  ChErrorType = 636  // CANNOT_EXTRACT_TABLE_STRUCTURE
	ChErrorInvalidTableOverride                         ChErrorType = 637  // INVALID_TABLE_OVERRIDE
	ChErrorSnappyUncompressFailed                       ChErrorType = 638  // SNAPPY_UNCOMPRESS_FAILED
	ChErrorSnappyCompressFailed                         ChErrorType = 639  // SNAPPY_COMPRESS_FAILED
	ChErrorNoHivemetastore                              ChErrorType = 640  // NO_HIVEMETASTORE
	ChErrorCannotAppendToFile                           ChErrorType = 641  // CANNOT_APPEND_TO_FILE
	ChErrorCannotPackArchive                            ChErrorType = 642  // CANNOT_PACK_ARCHIVE
	ChErrorCannotUnpackArchive                          ChErrorType = 643  // CANNOT_UNPACK_ARCHIVE
	ChErrorKeeperException                              ChErrorType = 999  // KEEPER_EXCEPTION
	ChErrorPocoException                                ChErrorType = 1000 // POCO_EXCEPTION
	ChErrorStdException                                 ChErrorType = 1001 // STD_EXCEPTION
	ChErrorUnknownException                             ChErrorType = 1002 // UNKNOWN_EXCEPTION
)

type ClientInfo

type ClientInfo struct {
	InitialUser    string
	InitialQueryID string

	OSUser         string
	ClientHostname string
	ClientName     string

	ClientVersionMajor uint64
	ClientVersionMinor uint64
	ClientVersionPatch uint64
	ClientRevision     uint64

	QuotaKey string
}

ClientInfo Information about client for query. Some fields are passed explicitly from client and some are calculated automatically. Contains info about initial query source, for tracing distributed queries

(where one query initiates many other queries).

type ColumnNumberReadError added in v1.0.0

type ColumnNumberReadError struct {
	Read      int
	Available uint64
}

ColumnNumberReadError represents an error when read more or less column

func (*ColumnNumberReadError) Error added in v1.0.0

func (e *ColumnNumberReadError) Error() string

type ColumnNumberWriteError added in v1.0.0

type ColumnNumberWriteError struct {
	WriteColumn int
	NeedColumn  uint64
}

ColumnNumberWriteError represents an error when number of write column is not equal to number of query column

func (*ColumnNumberWriteError) Error added in v1.0.0

func (e *ColumnNumberWriteError) Error() string

type Config

type Config struct {
	Host           string // host (e.g. localhost)
	Port           uint16
	Database       string
	User           string
	Password       string
	ClientName     string
	TLSConfig      *tls.Config // nil disables TLS
	ConnectTimeout time.Duration
	DialFunc       DialFunc   // e.g. net.Dialer.DialContext
	LookupFunc     LookupFunc // e.g. net.Resolver.LookupHost
	ReaderFunc     ReaderFunc // e.g. bufio.Reader
	Compress       bool
	WriterFunc     WriterFunc
	// Run-time parameters to set on connection as session default values (e.g. search_path or application_name)
	RuntimeParams map[string]string

	Fallbacks []*FallbackConfig

	// ValidateConnect is called during a connection attempt after a successful authentication with the ClickHouse server.
	// It can be used to validate that the server is acceptable. If this returns an error the connection is closed and the next
	// fallback config is tried. This allows implementing high availability behavior.
	ValidateConnect ValidateConnectFunc

	// AfterConnect is called after ValidateConnect. It can be used to set up the connection (e.g. Set session variables
	// or prepare statements). If this returns an error the connection attempt fails.
	AfterConnect AfterConnectFunc
	// contains filtered or unexported fields
}

Config is the settings used to establish a connection to a ClickHouse server. It must be created by ParseConfig and then it can be modified. A manually initialized Config will cause ConnectConfig to panic.

func ParseConfig

func ParseConfig(connString string) (*Config, error)

ParseConfig builds a []*Config with default values and use CH* Env.

# Example DSN
user=vahid password=secret host=ch.example.com port=5432 dbname=mydb sslmode=verify-ca

# Example URL
clickhouse://vahid:secret@ch.example.com:9000/mydb?sslmode=verify-ca

ParseConfig supports specifying multiple hosts in similar manner to libpq. Host and port may include comma separated values that will be tried in order. This can be used as part of a high availability system.

# Example URL
clickhouse://vahid:secret@foo.example.com:9000,bar.example.com:9000/mydb

ParseConfig currently recognizes the following environment variable and their parameter key word equivalents passed via database URL or DSN:

CHHOST
CHPORT
CHDATABASE
CHUSER
CHPASSWORD
CHCLIENTNAME
CHCONNECT_TIMEOUT
CHSSLMODE
CHSSLKEY
CHSSLCERT
CHSSLROOTCERT

Important Security Notes:

ParseConfig tries to match libpq behavior with regard to CHSSLMODE. This includes defaulting to "prefer" behavior if not set.

See http://www.postgresql.org/docs/12/static/libpq-ssl.html#LIBPQ-SSL-PROTECTION for details on what level of security each sslmode provides.

The sslmode "prefer" (the default), sslmode "allow", and multiple hosts are implemented via the Fallbacks field of the Config struct. If TLSConfig is manually changed it will not affect the fallbacks. For example, in the case of sslmode "prefer" this means it will first try the main Config settings which use TLS, then it will try the fallback which does not use TLS. This can lead to an unexpected unencrypted connection if the main TLS config is manually changed later but the unencrypted fallback is present. Ensure there are no stale fallbacks when manually setting TLCConfig.

If a host name resolves into multiple addresses chconn will only try the first.

func (*Config) ConnString added in v0.6.3

func (c *Config) ConnString() string

ConnString returns the original connection string used to connect to the ClickHouse server.

func (*Config) Copy added in v0.3.0

func (c *Config) Copy() *Config

Copy returns a deep copy of the config that is safe to use and modify. The only exception is the TLSConfig field: according to the tls.Config docs it must not be modified after creation.

type Conn

type Conn interface {
	// RawConn Get Raw Connection. Do not use unless you know what you want to do
	RawConn() net.Conn
	// Close the connection to database
	Close() error
	// IsClosed reports if the connection has been closed.
	IsClosed() bool
	// IsBusy reports if the connection is busy.
	IsBusy() bool
	// ServerInfo get Server info
	ServerInfo() *ServerInfo
	// Ping sends a ping to check that the connection to the server is alive.
	Ping(ctx context.Context) error
	// Exec executes a query without returning any rows.
	// NOTE: don't use it for insert and select query
	Exec(ctx context.Context, query string) (interface{}, error)
	// ExecWithSetting executes a query without returning any rows with the setting option.
	// NOTE: don't use it for insert and select query
	ExecWithSetting(ctx context.Context, query string, settings *setting.Settings) (interface{}, error)
	// ExecCallback executes a query without returning any rows with the setting option and on progress callback.
	// NOTE: don't use it for insert and select query
	ExecCallback(
		ctx context.Context,
		query string,
		settings *setting.Settings,
		queryID string,
		onProgress func(*Progress),
	) (interface{}, error)
	// Insert executes a query and commit all columns data.
	// NOTE: only use for insert query
	Insert(ctx context.Context, query string, columns ...column.Column) error
	// InsertWithSetting executes a query with the setting option and commit all columns data.
	// NOTE: only use for insert query
	InsertWithSetting(ctx context.Context, query string, settings *setting.Settings, queryID string, columns ...column.Column) error
	// Select executes a query and return select stmt.
	// NOTE: only use for select query
	Select(ctx context.Context, query string) (SelectStmt, error)
	// Select executes a query with the setting option and return select stmt.
	// NOTE: only use for select query
	SelectWithSetting(ctx context.Context, query string, settings *setting.Settings) (SelectStmt, error)
	// Select executes a query with the setting option, on progress callback, on profile callback and return select stmt.
	// NOTE: only use for select query
	SelectCallback(
		ctx context.Context,
		query string,
		settings *setting.Settings,
		queryID string,
		onProgress func(*Progress),
		onProfile func(*Profile)) (SelectStmt, error)
}

Conn is a low-level Clickhouse connection handle. It is not safe for concurrent usage.

func Connect

func Connect(ctx context.Context, connString string) (Conn, error)

Connect establishes a connection to a ClickHouse server using the environment and connString (in URL or DSN format) to provide configuration. See documention for ParseConfig for details. ctx can be used to cancel a connect attempt.

func ConnectConfig

func ConnectConfig(ctx context.Context, config *Config) (c Conn, err error)

ConnectConfig establishes a connection to a ClickHouse server using config. config must have been constructed with ParseConfig. ctx can be used to cancel a connect attempt.

If config.Fallbacks are present they will sequentially be tried in case of error establishing network connection. An authentication error will terminate the chain of attempts (like libpq: https://www.postgresql.org/docs/12/libpq-connect.html#LIBPQ-MULTIPLE-HOSTS) and be returned as the error. Otherwise, if all attempts fail the last error is returned.

type DialFunc

type DialFunc func(ctx context.Context, network, addr string) (net.Conn, error)

DialFunc is a function that can be used to connect to a ClickHouse server.

type FallbackConfig

type FallbackConfig struct {
	Host      string // host (e.g. localhost)
	Port      uint16
	TLSConfig *tls.Config // nil disables TLS
}

FallbackConfig is additional settings to attempt a connection with when the primary Config fails to establish a network connection. It is used for TLS fallback such as sslmode=prefer and high availability (HA) connections.

type InsertError added in v0.4.2

type InsertError struct {
	// contains filtered or unexported fields
}

InsertError represents an error when insert error

func (*InsertError) Error added in v0.4.2

func (e *InsertError) Error() string

Error return string error

func (*InsertError) Unwrap added in v0.4.2

func (e *InsertError) Unwrap() error

Unwrap returns the underlying error

type LookupFunc

type LookupFunc func(ctx context.Context, host string) (addrs []string, err error)

LookupFunc is a function that can be used to lookup IPs addrs from host.

type NumberWriteError added in v1.0.0

type NumberWriteError struct {
	FirstNumRow int
	NumRow      int
	Column      string
}

NumberWriteError represents an error when number rows of columns is not equal

func (*NumberWriteError) Error added in v1.0.0

func (e *NumberWriteError) Error() string

type Profile

type Profile struct {
	Rows                      uint64
	Blocks                    uint64
	Bytes                     uint64
	RowsBeforeLimit           uint64
	AppliedLimit              uint8
	CalculatedRowsBeforeLimit uint8
}

Profile detail of profile select query

type Progress

type Progress struct {
	ReadRows     uint64
	Readbytes    uint64
	TotalRows    uint64
	WriterRows   uint64
	WrittenBytes uint64
}

Progress details of progress select query

type ReaderFunc

type ReaderFunc func(io.Reader) io.Reader

ReaderFunc is a function that can be used get reader for read from server

type SelectStmt

type SelectStmt interface {
	// Next get the next block, if available return true else return false
	// if the server sends an error return false and we can get the last error with Err() function
	Next() bool
	// Err When calls Next() func, if server send an error, we can get error from this function
	Err() error
	// RowsInBlock return number of rows in this current block
	RowsInBlock() int
	// Close after reads all data should call this function to unlock connection
	// NOTE: You shoud read all data and then call this function
	Close()
	// ReadColumns read all columns of block
	ReadColumns(columns ...column.Column) error
	// GetColumns get and read all columns of block
	// If you know the columns  it's better to use ReadColumns func
	GetColumns() ([]column.Column, error)
}

SelectStmt is a interface for select statement

type ServerInfo

type ServerInfo struct {
	Name               string
	Revision           uint64
	MinorVersion       uint64
	MajorVersion       uint64
	ServerDisplayName  string
	ServerVersionPatch uint64
	Timezone           string
}

ServerInfo detail of server info

func (*ServerInfo) String

func (srv *ServerInfo) String() string

type ValidateConnectFunc

type ValidateConnectFunc func(ctx context.Context, conn Conn) error

ValidateConnectFunc is called during a connection attempt after a successful authentication with the ClickHouse server. It can be used to validate that the server is acceptable. If this returns an error the connection is closed and the next fallback config is tried. This allows implementing high availability behavior.

type WriterFunc

type WriterFunc func(io.Writer) io.Writer

WriterFunc is a function that can be used to get writer to writer from server Note: DO NOT use bufio.Writer, chconn doesn't support flush

Directories

Path Synopsis
cmd
internal
cityhash102
Package cityhash102 COPY from https://github.com/zentures/cityhash/ * NOTE: The code is modified to be compatible with CityHash128 used in ClickHouse COPY from https://github.com/ClickHouse/clickhouse-go/tree/master/lib/cityhash102 remove unused code
Package cityhash102 COPY from https://github.com/zentures/cityhash/ * NOTE: The code is modified to be compatible with CityHash128 used in ClickHouse COPY from https://github.com/ClickHouse/clickhouse-go/tree/master/lib/cityhash102 remove unused code

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL