blob: 5a96ed7a500a0647bfe7389f2502c5f618b1e24a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#include "PostgreSQLProtocol.h"
namespace DB::PostgreSQLProtocol::Messaging
{
ColumnTypeSpec convertTypeIndexToPostgresColumnTypeSpec(TypeIndex type_index)
{
switch (type_index)
{
case TypeIndex::Int8:
return {ColumnType::CHAR, 1};
case TypeIndex::UInt8:
case TypeIndex::Int16:
return {ColumnType::INT2, 2};
case TypeIndex::UInt16:
case TypeIndex::Int32:
return {ColumnType::INT4, 4};
case TypeIndex::UInt32:
case TypeIndex::Int64:
return {ColumnType::INT8, 8};
case TypeIndex::Float32:
return {ColumnType::FLOAT4, 4};
case TypeIndex::Float64:
return {ColumnType::FLOAT8, 8};
case TypeIndex::FixedString:
case TypeIndex::String:
return {ColumnType::VARCHAR, -1};
case TypeIndex::Date:
return {ColumnType::DATE, 4};
case TypeIndex::Decimal32:
case TypeIndex::Decimal64:
case TypeIndex::Decimal128:
case TypeIndex::Decimal256:
return {ColumnType::NUMERIC, -1};
case TypeIndex::UUID:
return {ColumnType::UUID, 16};
default:
return {ColumnType::VARCHAR, -1};
}
}
}
|