Changeset: 402e44e4f6e2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/402e44e4f6e2 Branch: Jul2021 Log Message:
merged diffs (75 lines): diff --git a/monetdb5/modules/mal/txtsim.c b/monetdb5/modules/mal/txtsim.c --- a/monetdb5/modules/mal/txtsim.c +++ b/monetdb5/modules/mal/txtsim.c @@ -226,12 +226,15 @@ SCode(unsigned char c) return (Code[toupper(c) - 'A']); } -static void +static str soundex_code(char *Name, char *Key) { char LastLetter; int Index; + if ((*Name & 0x80) != 0) + throw(MAL,"soundex", SQLSTATE(42000) "Soundex function not available for non ASCII strings"); + /* set default key */ strcpy(Key, SoundexKey); @@ -242,7 +245,7 @@ soundex_code(char *Name, char *Key) LastLetter = *Name; if (!*Name) - return; + return MAL_SUCCEED; Name++; /* scan rest of string */ @@ -262,6 +265,7 @@ soundex_code(char *Name, char *Key) } } } + return MAL_SUCCEED; } static str @@ -274,9 +278,7 @@ soundex_impl(str *res, str *Name) throw(MAL,"soundex", SQLSTATE(HY013) MAL_MALLOC_FAIL); /* calculate Key for Name */ - soundex_code(*Name, *res); - - return MAL_SUCCEED; + return soundex_code(*Name, *res); } static str diff --git a/sql/test/SQLancer/Tests/sqlancer16.test b/sql/test/SQLancer/Tests/sqlancer16.test --- a/sql/test/SQLancer/Tests/sqlancer16.test +++ b/sql/test/SQLancer/Tests/sqlancer16.test @@ -151,3 +151,23 @@ 1970-01-01 01:00:00 statement ok ROLLBACK +statement ok +START TRANSACTION + +statement ok +CREATE TABLE "t0" ("c1" VARCHAR(44)) + +statement ok +COPY 5 RECORDS INTO "sys"."t0" FROM stdin USING DELIMITERS E'\t',E'\n','"' +<COPY_INTO_DATA> +"9史" +"-1680198574" +"|Yv\ne軒sX" +"㧪 dg" +"c}u" + +statement error 42000!Soundex function not available for non ASCII strings +select length(soundex(t0.c1)) from t0 + +statement ok +ROLLBACK _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list