change_function_from_defGetBoolean_to_parse_bool
This commit is contained in:
@ -1071,7 +1071,7 @@ Oid DefineIndex(Oid relationId, IndexStmt* stmt, Oid indexRelationId, bool is_al
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("Can not use compress option in ustore index.")));
|
||||
}
|
||||
if (pg_strcasecmp(defElem->defname, "segment") == 0 && defGetBoolean(defElem)) {
|
||||
if (pg_strcasecmp(defElem->defname, "segment") == 0 && ReadBoolFromDefElem(defElem)) {
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("Can not use compress option in segment storage.")));
|
||||
}
|
||||
|
||||
@ -1134,7 +1134,7 @@ static List* AddDefaultOptionsIfNeed(List* options, const char relkind, CreateSt
|
||||
(errcode(ERRCODE_INVALID_OPTION),
|
||||
errmsg("It is not allowed to assign version option for non-dfs table.")));
|
||||
} else if (pg_strcasecmp(def->defname, "segment") == 0){
|
||||
segment = defGetBoolean(def);
|
||||
segment = ReadBoolFromDefElem(def);
|
||||
} else {
|
||||
SetOneOfCompressOption(def, &tableCreateSupport);
|
||||
}
|
||||
|
||||
@ -2935,6 +2935,16 @@ bool is_cstore_option(char relkind, Datum reloptions)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ReadBoolFromDefElem(DefElem* defElem)
|
||||
{
|
||||
bool result = false;
|
||||
char *boolStr = defGetString(defElem);
|
||||
if (!parse_bool_with_len(boolStr, strlen(boolStr), &result)) {
|
||||
ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("%s requires a Boolean value", defElem->defname)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void SetOneOfCompressOption(DefElem* defElem, TableCreateSupport* tableCreateSupport)
|
||||
{
|
||||
auto defname = defElem->defname;
|
||||
@ -2948,9 +2958,9 @@ void SetOneOfCompressOption(DefElem* defElem, TableCreateSupport* tableCreateSup
|
||||
} else if (pg_strcasecmp(defname, "compress_level") == 0) {
|
||||
tableCreateSupport->compressLevel = true;
|
||||
} else if (pg_strcasecmp(defname, "compress_byte_convert") == 0) {
|
||||
tableCreateSupport->compressByteConvert = defGetBoolean(defElem);
|
||||
tableCreateSupport->compressByteConvert = ReadBoolFromDefElem(defElem);
|
||||
} else if (pg_strcasecmp(defname, "compress_diff_convert") == 0) {
|
||||
tableCreateSupport->compressDiffConvert = defGetBoolean(defElem);
|
||||
tableCreateSupport->compressDiffConvert = ReadBoolFromDefElem(defElem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -303,6 +303,7 @@ void RowTblCheckCompressionOption(List *options, int8 rowCompress = REL_CMPRS_PA
|
||||
void RowTblCheckHashBucketOption(List* options, StdRdOptions* std_opt);
|
||||
void ForbidUserToSetCompressedOptions(List *options);
|
||||
void SetOneOfCompressOption(DefElem* defElem, TableCreateSupport *tableCreateSupport);
|
||||
bool ReadBoolFromDefElem(DefElem* defElem);
|
||||
void CheckCompressOption(TableCreateSupport *tableCreateSupport);
|
||||
void ForbidUserToSetCompressedOptions(List *options);
|
||||
#endif /* RELOPTIONS_H */
|
||||
|
||||
@ -200,6 +200,49 @@ Has OIDs: no
|
||||
Options: orientation=row, compresstype=2
|
||||
|
||||
create table normal_test.segment_off(id int) with (compresstype=2,segment=off); --success
|
||||
--compress_diff_convert布尔值:
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert=t);
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert='t');
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert='f');
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert=yes);
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert='no');
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert='1');
|
||||
drop table if exists normal_test.tb1;
|
||||
--compress_byte_convert布尔值:
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=t,compress_diff_convert=true);
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert='t',compress_diff_convert=true);
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=f,compress_diff_convert=false);
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=yes,compress_diff_convert=TRUE);
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=NO,compress_diff_convert=OFF);
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert='1',compress_diff_convert=1);
|
||||
drop table if exists normal_test.tb1;
|
||||
--segment参数:
|
||||
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = on);
|
||||
drop table if exists normal_test.t_bool_value;
|
||||
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = off);
|
||||
drop table if exists normal_test.t_bool_value;
|
||||
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = 1);
|
||||
drop table if exists normal_test.t_bool_value;
|
||||
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = 0);
|
||||
drop table if exists normal_test.t_bool_value;
|
||||
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = t);
|
||||
drop table if exists normal_test.t_bool_value;
|
||||
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = 't');
|
||||
drop table if exists normal_test.t_bool_value;
|
||||
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = yes);
|
||||
drop table if exists normal_test.t_bool_value;
|
||||
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = no);
|
||||
drop table if exists normal_test.t_bool_value;
|
||||
drop schema normal_test cascade;
|
||||
NOTICE: drop cascades to 8 other objects
|
||||
DETAIL: drop cascades to table normal_test.tbl_pc
|
||||
|
||||
@ -76,4 +76,52 @@ create table normal_test.including_all_new2(like normal_test.including_all inclu
|
||||
\d+ normal_test.including_all_new
|
||||
\d+ normal_test.including_all_new2
|
||||
create table normal_test.segment_off(id int) with (compresstype=2,segment=off); --success
|
||||
|
||||
|
||||
--compress_diff_convert布尔值:
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert=t);
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert='t');
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert='f');
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert=yes);
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert='no');
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=1,compress_diff_convert='1');
|
||||
drop table if exists normal_test.tb1;
|
||||
|
||||
--compress_byte_convert布尔值:
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=t,compress_diff_convert=true);
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert='t',compress_diff_convert=true);
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=f,compress_diff_convert=false);
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=yes,compress_diff_convert=TRUE);
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert=NO,compress_diff_convert=OFF);
|
||||
drop table if exists normal_test.tb1;
|
||||
create table normal_test.tb1 (c_int int, c_bool boolean) with (Compresstype=2,Compress_chunk_size=512,compress_byte_convert='1',compress_diff_convert=1);
|
||||
drop table if exists normal_test.tb1;
|
||||
|
||||
--segment参数:
|
||||
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = on);
|
||||
drop table if exists normal_test.t_bool_value;
|
||||
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = off);
|
||||
drop table if exists normal_test.t_bool_value;
|
||||
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = 1);
|
||||
drop table if exists normal_test.t_bool_value;
|
||||
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = 0);
|
||||
drop table if exists normal_test.t_bool_value;
|
||||
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = t);
|
||||
drop table if exists normal_test.t_bool_value;
|
||||
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = 't');
|
||||
drop table if exists normal_test.t_bool_value;
|
||||
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = yes);
|
||||
drop table if exists normal_test.t_bool_value;
|
||||
create table normal_test.t_bool_value (c_int int, c_bool boolean) with (segment = no);
|
||||
drop table if exists normal_test.t_bool_value;
|
||||
|
||||
drop schema normal_test cascade;
|
||||
Reference in New Issue
Block a user