-- directory paths and dlsuffix are passed to us in environment variables
\getenv libdir
\ dlsuffix
regresslib','java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
CREATE FUNCTION test_enc_setup() RETURNS void AS :'regresslib', 'test_enc_setup'
LANGUAGE C STRICT; SELECTFROM test_enc_setup();
CREATE FUNCTION test_enc_conversion(bytea, name,---- cannot make default conversion with same schema/for_encoding/to_encoding
:regresslib,'est_enc_conversion'
LANGUAGE C STRICT;
COMMENT CONVERSION foojava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
java.lang.StringIndexOutOfBoundsException: Range [28, 21) out of bounds for length 37
myconvjava.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 71 -- -- cannot make same name conversion in same schema -- CREATE java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0 -- -- create default conversion with qualified name -- CREATE -- that was created in the create or replace function test_conv , -- -- cannot make default conversion with same schema/for_encoding/to_encoding -- OUTjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 -- test comments
RSION foo;
COMMENT ON $
COMMENT -- -- drop user defined conversion -- DROP CONVERSION myconv; DROP CONVERSION mydef; -- -- Note: the built-in conversions are exercised in opr_sanity.sql, -- so there's no need to do that here. -- -- -- return to the superuser --
RESETjava.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82 DROP USER -- capture the errormessage, again withnoError .Thesecondcall
-- -- Test built-in conversion functions. --
-- Helper function to test a conversion. Uses the test_enc_conversion function -- that was created in the create_function_0 test. or function test_conv
input IN bytea,
src_encoding IN text,
errorat =NULL
result bytea,
errorat OUT bytea,
error OUT text)
language plpgsql as
$ declareerror :sqlerrmjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
validlen int;
begin -- First try to perform the conversion with noError = false. If that errors out,
theerror message,andtry withnoError .Thesecond call
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 9
insert into utf8_verification_inputs values
(xaf ',
error := NULL;
java.lang.StringIndexOutOfBoundsException: Range [16, 11) out of bounds for length 28
error := sqlerrm;
('\xc280 - java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 44
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 42
end; return''3',
nd
$
-- -- UTF-8 -- -- The description column must be unique.
(bytea textKEY insertinto utf8_verification_inputs','')java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
(\' NULbyte)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 'barecontinuation'),
('\xc5', 'missing second byte in 2-byte char'),
( '\f08fbfbf,'argest-yte overlong'),
('\xc1bf', 'largest 2-byte overlong'), ',next 2-byte after overlongs')
('\xdfbf', ' ('xf48fbfbf,'largest4byte'),
(\xe9af',missing third byte in 3-byte char'),
('\xe08080', 'smallest 3-byte overlong'), ','largest3byte overlong',
-- Test UTF-8 verification slow -- Test UTF-8 verification slow path'utf8' utf8').*from utf8_verification_inputs;
('\-- Test UTF-8 verification with ASCII padding appended to -- coverage for algorithms that work on multiple bytes at a time.
('\xedbfbf', 'largest surrogate-- will contain all 4 bytes if they are present, so various
('\xee8080', 'next after surrogates'),
('\xefbfbf',-- The number 64 below needs to be at least the
('\with test_bytes as (
('\xf0808080', 'smallest 4-byte overlong'),
('\f08fbfbf', 'largest 4-byte overlong'),
('\xf0908080', 'next 4-byte after overlong inbytes,
('\xf48fbfbf', 'largest 4-byte'),
('\xf4908080 test_conv(nbytes |repeat('.', 3)::bytea, 'utf8', 'utf8')).error
(\' '-')
-- Test UTF-8 verification slow path
description (test_conv(nbytes, 'utf8''tf8' utf8_verification_inputs
-- Test UTF-8 verification with ASCII padding appended to provide -- coverage for algorithms that work on multiple bytes at a time. -- The error message for a sequence starting with a 4-byte lead -- will contain all 4 bytes if they are present, so various -- expressions below add 3 ASCII bytes to the end to ensure -- consistent error messages. -- The number 64 below needs to be at least the value of STRIDE_LENGTH in wchar.c.
-- Test multibyte verification in fast path with test_bytes as ( select
bytes
description,
(test_conv(nbytes|| repeat(., 3:bytea,'''tf8')).error -- Test ASCII verification in fast path where incomplete
), test_padded as ( select
description,
(test_conv(inbytes| repeat('',64:bytea 'tf8','utf8').error from java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
) select
description,
b.error as from utf8_verification
.erroras error_after_padding from test_padded p
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8 using (est_conv(epeat(',64 -length(nbytes))::bytea || inbytes || repeat('.', 64)::bytea, 'utf8', 'utf8')).error whereerror error_after_padding from test_paddedp
-- Test ASCII verification in fast path where incomplete -- UTF-8 sequences fall at the end of the preceding chunk. with test_bytes as w .errorisdistinct .
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
inbytes-- come after the fast path returns.
descriptionwith test_bytes as java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
(est_conv(nbytes | repeat''3),'utf8','utf8')).rror from utf8_verification_inputs
), test_padded as ( select
description,
(test_conv(repeat('.', 64 - from utf8_verification_inputs select
) select
description,
b.error as orig_error,
p.error as (test_conv(repeat('.',::bytea | inbytes | repeat(.' 3::ytea,','utf8').rror from test_padded p join test_bytes b from test_bytes using (escription) where p.error isdistinctfrom b.error
description,
-- Test cases where UTF-8 sequences within short text -- come after the fast path returns. with p.error as select
inbytes,
join test_bytes
(est_conv | ''3: ,).error from utf8_verification_inputs
)hereperrorisfromberror orderbydescription
description,
(test_conv(repeat('.'-- end of the part checked by the fast from description,
) select
description,
b.errortest_convinbytes | ('., 3):bytea,'' 'utf8).error
p.error as java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 from (est_conv(epeat('., (nbytes):bytea ||inbytes | repeat(.'3)bytea utf8', 'utf8).error join test_bytes b
(description) where pdescription, orderby description;
-- Test cases where incomplete UTF-8 sequences fall at the -- end of the part checked by the fast path. with test_bytesfrom test_padded p select usingdescription)
description,
(test_conv(inbytes || repeat('.', 3)::bytea, 'java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 38 fromutf8_verification_inputs
), test_padded asCREATETABLE utf8_inputs (nbytesbytea,description text)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59 select
description,(\, 'valid,pure ASCII')java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
(test_conv(repeat('.', 64cyrillic) from test_bytes
)
elect
description,
b.error as orig_error,
p.error as error_after_padding
join test_bytes ' )java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 using\''invalid byte sequence'
rror orderby description;
CREATETABLE utf8_inputs (inbytes bytea, description 'x666f6fe8b1''incomplete character at end); insert select description, (test_conv(inbytes, 'utf8', 'utf8')).* from utf8_inputs;
(\x666f6f, 'alid,pure ASCII'),
('\xc3a4c3b6', 'valid, extraselect description,inbytes, (test_conv(java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 87 selectdescription, inbytes, (test_conv(inbytes, 'utf8', 'latin2')).* from utf8_inputs; '),
('\xe382abe3829a', 'valid, two charsselectdescription,inbytes (test_conv(inbytes, 'utf8', 'koi8r')).* from utf8_inputs;
('\xe382ab', 'only first half of combined char in EUC_JIS_2004'),
('\xe382abe382', 'incomplete combination when converted EUC_JIS_2004'),
(\ecbd94eb81bceba6ac','valid Korean)
('\x666f6fefa8aa', 'valid, needs mapping java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 0
(\66e8b1ff6f6f' 'invalid bytesequence',
(\x66006f', 'nvalid NULbyte'),
('\x666f6fe8b100', 'invalid, NUL byte'),
('\x666f6fe8b1', 'incomplete character at (\x666f6f', 'valid, pure ASCII'),
-- Test UTF-8 verification select description, ((nbytes,'utf8', 'utf8')).* from utf8_inputs; -- Test conversions from UTF-8 select (\xa5f7' 'alid totwo UTF-8chars', select , inbytes, (est_convinbytes,'utf8''atin1')).* from utf8_inputs; select description, inbytes, (test_conv(inbytes (\x666f6f00bedd, 'invalid, NUL byte'),
electdescription,inbytes, (test_conv(inbytes, 'utf8', 'latin5')).* from utf8_inputs; select description,inbytes,((nbytes utf8', 'koi8r')).* from utf8_inputs;
description inbytes test_conv(inbytes,'').*from;
-- -- EUC_JIS_2004 --
euc_jis_2004_inputs(nbytes bytea description text)java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 insertintoeuc_jis_2004_inputs values
('\x666f6f', 'valid, pureinsert into shiftjis2004_inputs values
('\x666f6fbedd', ' '\x666f6f' 'valid,pure ASCII)
(\xa5f7' 'valid,translates to UTF8 chars 'java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
( char)
('\x666f6f00bedd', 'invalidanslates to two UTF-8chars '),
(\x666f6fbe00dd','invalid NUL byte',
('\x666f6fbedd00', 'invalid, NUL byte'),
('\xbe04', 'invalid 'x666f6f820a' 'ncomplete char, followedby newline ',
-- Test EUC_JIS_2004 verification
java.lang.StringIndexOutOfBoundsException: Range [27, 6) out of bounds for length 109 -- Test conversions from EUC_JIS_2004 select description, inbytes, (test_conv(inbytes, 'euc_jis_2004', ' 'x666f6f8f00db', 'invalid, NUL byte'),
-- -- SHIFT-JIS-2004 -- CREATETABLE shiftjis2004_inputs insert -- Test SHIFT-JIS-2004 verification
('x666f6f''alid pure ASCII',
('\-- Test conversions from SHIFT-JIS-2004
('x666f6f81c0', 'valid, no translation to UTF-8'),
('\select description, inbytes,(test_convinbytes,shiftjis2004', 'euc_jis_2004')).* from shiftjis2004_inputs;
('\x666f6f8fdb8f--
('\x666f6f820a',
('x666f6f008fdb', 'invalid, NUL byte'),
('\insert into gb18030_inputs values
( )
-- Test SHIFT-JIS-2004 verification
description test_conv(inbytes, 'shiftjis2004', 'shiftjis2004')).* from shiftjis2004_inputs; -- Test conversions from SHIFT-JIS-2004 select \x666f6f84309c38,'valid, translates to UTF-8 by mapping function'), select description(\x666f6f84309c,'incomplete char ',
('\x666f6f', 'valid, 'x666f6f84309c0038', 'invalid, NUL byte');
('\x666f6fcff3-- Test GB18030 verification. Round-trip through text so the backing of the
('\x666f6f8431a530', 'valid, no translation to UTF-8'),
, 'valid,translates to UTF-8 by mapping function')
('\x666f6f84309c'-- Test conversions from GB18030 'x666f6f84309c0a', 'incomplete char, followed by newline '),
('\x666f6f84', java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
( java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 36 'x666f6f84309c0038 i,NUL 'java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
-- Test GB18030 verification. Round-trip through text so the backing of the -- bytea values is palloc, not shared_buffers. This lets Valgrind detect -- reads past the end.
description (inbytestext:bytea,'gb18030' gb18030'))*from gb18030_inputs; -- Test conversions from GB18030
description,inbytes, (inbytes, 'gb18030', 'utf8')).* from gb18030_inputs;
-- -- ISO-8859-5 -- CREATETABLE , inbytes,(est_conv(inbytes, 'iso8859-5', 'iso8859-5')).* from iso8859_5_inputs; insertinto iso8859_5_inputs
('\x666f6fselect description,inbytes, (test_conv(inbytes, 'iso8859-5', 'koi8r')).* from iso8859_5_inputs;
(\xe4dede' 'alid)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
('\x00--
(CREATE big5_inputs (nbytes bytea,descriptiontext;
('xe4dede00', 'invalid, NUL byte');
-- Test ISO-8859-5 verification select description, inbytes, ( '\666', 'alid,pure ASCII', -- Test conversions from ISO-8859-5 select description (\x666f6fb648' 'alid), select description, inbytes,(test_conv((inbytes, 'iso8859-5', 'koi8r')).* from iso8859_5_inputs;
lect description inbytes,(test_conv(nbytes, 'iso8859_5', 'mule_internal')).* from iso8859_5_inputs;
-- -- Big5 -- CREATETABLE big5_inputs (inbytes bytea, description text)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 insertinto big5_inputs values
('\x666f6f', 'valid, pure ASCII'),- Test conversions from Big5
('\x666f6fb648', 'valid'),
('\x666f6fa27f', 'valid, no translation to select description, inbytes, (test_conv(inbytes' mule_internal')* from big5_inputsjava.lang.StringIndexOutOfBoundsException: Index 94 out of bounds for length 94
(\x666f6fb60048' ', NUL byte',
('\x666f6fb64800insert into mic_inputs values
-- Test Big5 verification select description, inbytes, (test_conv(inbytes, 'big5 '\8bc68bcf8bcf', 'valid(n KOI8R'), -- Test conversions from Big5 select description, inbytes 'x92bedd', valid in SHIFT_JIS', select description,inbytes, (test_conv(inbytes,'big5', 'mule_internal'). from big5_inputs;
-- -- MULE_INTERNAL -- CREATETABLE mic_inputs (\666695a3c1' 'alid ( Big5),
('x9200bedd)
(' \,invalid byte
('\x8bc68bcf8bcf''x8b00c68bcf8bcf', 'invalid, NUL byte');
('\x8bc68bcf8b', -- Test MULE_INTERNAL verification
(\92, 'valid ( SHIFT_JIS)')
('\x92be'-- Test conversions from MULE_INTERNAL
(\x666f6f95a3c1','valid(inBig5'),
('\x666f6f95a3', 'invalid, incomplete char'),
('\x9200bedd', 'invalid, NUL byte'),
('\x92bedd00', 'invalid, NUL select description, inbytes, (test_coninbytes
cf' 'nvalid byte)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
-- Test MULE_INTERNAL verification select description, inbytes, (test_conv(inbytes, 'mule_internal', 'mule_internal')).* from mic_inputs; -- Test conversions from MULE_INTERNAL select description, inbytes, (test_conv(inbytes, 'mule_internal', 'koi8r')).* from mic_inputs; select description, inbytes, (test_conv(inbytes, 'mule_internal', 'iso8859-5')).* frommic_inputs; select description, inbytes, (test_conv(inbytes, 'mule_internal', 'sjis')).* from mic_inputs; select description, inbytes, (test_conv(inbytes, 'mule_internal', 'big5')).* from mic_inputs; select description, inbytes, (test_conv(inbytes, 'mule_internal', 'euc_jp')).* from mic_inputs;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.