Allow null values in postgresql protocol

This commit is contained in:
kssenii 2021-06-01 13:45:32 +00:00
parent 5dda97bef1
commit ccf5455624
4 changed files with 17 additions and 1 deletions

View File

@ -378,6 +378,9 @@ function run_tests
01852_jit_if
01865_jit_comparison_constant_result
01871_merge_tree_compile_expressions
# needs psql
01889_postgresql_protocol_null_fields
)
time clickhouse-test --hung-check -j 8 --order=random --use-skip-list \

View File

@ -724,8 +724,9 @@ public:
Int32 size() const override
{
Int32 sz = 4 + 2; // size of message + number of fields
/// If values is NULL, field size is -1 and data not added.
for (const std::shared_ptr<ISerializable> & field : row)
sz += 4 + field->size();
sz += 4 + (field->size() > 0 ? field->size() : 0);
return sz;
}

View File

@ -0,0 +1,5 @@
NULL
------
(1 row)

View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
psql --host localhost --port ${CLICKHOUSE_PORT_POSTGRESQL} default -c "SELECT NULL;"