diff --git a/src/test/locale/Makefile b/src/test/locale/Makefile index c59aba7ab6..649ad0fef1 100644 --- a/src/test/locale/Makefile +++ b/src/test/locale/Makefile @@ -14,7 +14,7 @@ CFLAGS+= $(KRBFLAGS) endif PROGS = test-pgsql-locale test-ctype -DIRS = koi8-r +DIRS = koi8-r ISO8859-7 koi8-to-win1251 all: $(PROGS) diff --git a/src/test/locale/README b/src/test/locale/README index 9cdf64ac23..b32bb03fd7 100644 --- a/src/test/locale/README +++ b/src/test/locale/README @@ -24,4 +24,4 @@ think) method is just copy koi8-r directory and edit/replace files. Oleg. ---- - Oleg Broytmann http://members.tripod.com/~phd2/ phd2@earthling.net + Oleg Broytmann http://members.xoom.com/phd2/ phd2@earthling.net diff --git a/src/test/locale/gr_GR.ISO8859-7/Makefile b/src/test/locale/gr_GR.ISO8859-7/Makefile new file mode 100644 index 0000000000..281014521e --- /dev/null +++ b/src/test/locale/gr_GR.ISO8859-7/Makefile @@ -0,0 +1,12 @@ +# +# Makefile for example programs +# + +all: + -@echo "make: Nothing to be done for \`all'." + +test: + @./runall + +clean: + rm -f *.out diff --git a/src/test/locale/gr_GR.ISO8859-7/README b/src/test/locale/gr_GR.ISO8859-7/README new file mode 100644 index 0000000000..62023d0c8e --- /dev/null +++ b/src/test/locale/gr_GR.ISO8859-7/README @@ -0,0 +1,2 @@ +gr_GR.ISO8859-7 (Greek) locale test. +Created by Angelos Karageorgiou <angelos@awesome.incredible.com> diff --git a/src/test/locale/gr_GR.ISO8859-7/expected/gr-ctype.out b/src/test/locale/gr_GR.ISO8859-7/expected/gr-ctype.out new file mode 100644 index 0000000000..833d70681f --- /dev/null +++ b/src/test/locale/gr_GR.ISO8859-7/expected/gr-ctype.out @@ -0,0 +1,257 @@ +char# char alnum alpha cntrl digit lower graph print punct space upper xdigit lo up +chr#0 + +chr#1 + +chr#2 + +chr#3 + +chr#4 + +chr#5 + +chr#6 + +chr#7 + +chr#8 + +chr#9 + + +chr#10 + + +chr#11 + + +chr#12 + + +chr#13 + + +chr#14 + +chr#15 + +chr#16 + +chr#17 + +chr#18 + +chr#19 + +chr#20 + +chr#21 + +chr#22 + +chr#23 + +chr#24 + +chr#25 + +chr#26 + +chr#27 + +chr#28 + +chr#29 + +chr#30 + +chr#31 + +chr#32 + + +chr#33 ! + + + ! ! +chr#34 " + + + " " +chr#35 # + + + # # +chr#36 $ + + + $ $ +chr#37 % + + + % % +chr#38 & + + + & & +chr#39 ' + + + ' ' +chr#40 ( + + + ( ( +chr#41 ) + + + ) ) +chr#42 * + + + * * +chr#43 + + + + + + +chr#44 , + + + , , +chr#45 - + + + - - +chr#46 . + + + . . +chr#47 / + + + / / +chr#48 0 + + + + + 0 0 +chr#49 1 + + + + + 1 1 +chr#50 2 + + + + + 2 2 +chr#51 3 + + + + + 3 3 +chr#52 4 + + + + + 4 4 +chr#53 5 + + + + + 5 5 +chr#54 6 + + + + + 6 6 +chr#55 7 + + + + + 7 7 +chr#56 8 + + + + + 8 8 +chr#57 9 + + + + + 9 9 +chr#58 : + + + : : +chr#59 ; + + + ; ; +chr#60 < + + + < < +chr#61 = + + + = = +chr#62 > + + + > > +chr#63 ? + + + ? ? +chr#64 @ + + + @ @ +chr#65 A + + + + + + a A +chr#66 B + + + + + + b B +chr#67 C + + + + + + c C +chr#68 D + + + + + + d D +chr#69 E + + + + + + e E +chr#70 F + + + + + + f F +chr#71 G + + + + + g G +chr#72 H + + + + + h H +chr#73 I + + + + + i I +chr#74 J + + + + + j J +chr#75 K + + + + + k K +chr#76 L + + + + + l L +chr#77 M + + + + + m M +chr#78 N + + + + + n N +chr#79 O + + + + + o O +chr#80 P + + + + + p P +chr#81 Q + + + + + q Q +chr#82 R + + + + + r R +chr#83 S + + + + + s S +chr#84 T + + + + + t T +chr#85 U + + + + + u U +chr#86 V + + + + + v V +chr#87 W + + + + + w W +chr#88 X + + + + + x X +chr#89 Y + + + + + y Y +chr#90 Z + + + + + z Z +chr#91 [ + + + [ [ +chr#92 \ + + + \ \ +chr#93 ] + + + ] ] +chr#94 ^ + + + ^ ^ +chr#95 _ + + + _ _ +chr#96 ` + + + ` ` +chr#97 a + + + + + + a A +chr#98 b + + + + + + b B +chr#99 c + + + + + + c C +chr#100 d + + + + + + d D +chr#101 e + + + + + + e E +chr#102 f + + + + + + f F +chr#103 g + + + + + g G +chr#104 h + + + + + h H +chr#105 i + + + + + i I +chr#106 j + + + + + j J +chr#107 k + + + + + k K +chr#108 l + + + + + l L +chr#109 m + + + + + m M +chr#110 n + + + + + n N +chr#111 o + + + + + o O +chr#112 p + + + + + p P +chr#113 q + + + + + q Q +chr#114 r + + + + + r R +chr#115 s + + + + + s S +chr#116 t + + + + + t T +chr#117 u + + + + + u U +chr#118 v + + + + + v V +chr#119 w + + + + + w W +chr#120 x + + + + + x X +chr#121 y + + + + + y Y +chr#122 z + + + + + z Z +chr#123 { + + + { { +chr#124 | + + + | | +chr#125 } + + + } } +chr#126 ~ + + + ~ ~ +chr#127 + + + + + +chr#128 � + + + + + � � +chr#129 � + + + + + � � +chr#130 � + + + + + � � +chr#131 � + + + + + � � +chr#132 � + + + + + � � +chr#133 � + + + + + � � +chr#134 � + + + + + � � +chr#135 � + + + + + � � +chr#136 � + + + + + � � +chr#137 � + + + + + � � +chr#138 � + + + + + � � +chr#139 � + + + + + � � +chr#140 � + + + + + � � +chr#141 � + + + + + � � +chr#142 � + + + + + � � +chr#143 � + + + + + � � +chr#144 � + + + + + � � +chr#145 � + + + + + � � +chr#146 � + + + + + � � +chr#147 � + + + + + � � +chr#148 � + + + + + � � +chr#149 � + + + + + � � +chr#150 � + + + + + � � +chr#151 � + + + + + � � +chr#152 � + + + + + � � +chr#153 � + + + + + � � +chr#154 � + + + + + � � +chr#155 � + + + + + � � +chr#156 � + + + + + � � +chr#157 � + + + + + � � +chr#158 � + + + + + � � +chr#159 � + + + + + � � +chr#160 � + + + + � � +chr#161 � + + + + � � +chr#162 � + + + + + � � +chr#163 � + + + + � � +chr#164 � + + + + � � +chr#165 � + + + + � � +chr#166 � + + + + � � +chr#167 � + + + + � � +chr#168 � + + + + � � +chr#169 � + + + + � � +chr#170 � + + + + � � +chr#171 � + + + + � � +chr#172 � + + + + � � +chr#173 � + + + + � � +chr#174 � + + + + � � +chr#175 � + + + + � � +chr#176 � + + + + � � +chr#177 � + + + + � � +chr#178 � + + + + � � +chr#179 � + + + + � � +chr#180 � + + + + � � +chr#181 � + + + + � � +chr#182 � + + + + � � +chr#183 � + + + + � � +chr#184 � + + + + + � � +chr#185 � + + + + + � � +chr#186 � + + + + + � � +chr#187 � + + + + � � +chr#188 � + + + + + � � +chr#189 � + + + + � � +chr#190 � + + + + + � � +chr#191 � + + + + + � � +chr#192 � + + + + + � � +chr#193 � + + + + + � � +chr#194 � + + + + + � � +chr#195 � + + + + + � � +chr#196 � + + + + + � � +chr#197 � + + + + + � � +chr#198 � + + + + + � � +chr#199 � + + + + + � � +chr#200 � + + + + + � � +chr#201 � + + + + + � � +chr#202 � + + + + + � � +chr#203 � + + + + + � � +chr#204 � + + + + + � � +chr#205 � + + + + + � � +chr#206 � + + + + + � � +chr#207 � + + + + + � � +chr#208 � + + + + + � � +chr#209 � + + + + + � � +chr#210 � + + + + + � � +chr#211 � + + + + + � � +chr#212 � + + + + + � � +chr#213 � + + + + + � � +chr#214 � + + + + + � � +chr#215 � + + + + + � � +chr#216 � + + + + + � � +chr#217 � + + + + + � � +chr#218 � + + + + + � � +chr#219 � + + + + + � � +chr#220 � + + + + + � � +chr#221 � + + + + + � � +chr#222 � + + + + + � � +chr#223 � + + + + + � � +chr#224 � + + + + + � � +chr#225 � + + + + + � � +chr#226 � + + + + + � � +chr#227 � + + + + + � � +chr#228 � + + + + + � � +chr#229 � + + + + + � � +chr#230 � + + + + + � � +chr#231 � + + + + + � � +chr#232 � + + + + + � � +chr#233 � + + + + + � � +chr#234 � + + + + + � � +chr#235 � + + + + + � � +chr#236 � + + + + + � � +chr#237 � + + + + + � � +chr#238 � + + + + + � � +chr#239 � + + + + + � � +chr#240 � + + + + + � � +chr#241 � + + + + + � � +chr#242 � + + + + + � � +chr#243 � + + + + + � � +chr#244 � + + + + + � � +chr#245 � + + + + + � � +chr#246 � + + + + + � � +chr#247 � + + + + + � � +chr#248 � + + + + + � � +chr#249 � + + + + + � � +chr#250 � + + + + + � � +chr#251 � + + + + + � � +chr#252 � + + + + + � � +chr#253 � + + + + + � � +chr#254 � + + + + + � � +chr#255 + diff --git a/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-char.sql.out b/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-char.sql.out new file mode 100644 index 0000000000..302a2ecc75 --- /dev/null +++ b/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-char.sql.out @@ -0,0 +1,55 @@ +abbrev|name_en |name_gr +------+--------------------+------------------------------------------------------------ +AK |Alaska |������ +AL |Alabama |�������� +AZ |Arizona |������� +AR |Arkansas |�������� +ID |Idaho |������� +IA |Iowa |����� +VT |Vermont |������� +VA |Virginia |��������� +NC |North Carolina |������ �������� +ND |North Dakota |������ ������� +UT |Utah |������ +WY |Wyoming |����������� +WV |West Virginia |������ ��������� +WI |Wisconsin |����������� +WA |Washington |������������ +DC |Washington DC |����������� ��� �� +IL |Illinois |�������� +IN |Indiana |������� +KA |Kansas |������ +CA |California |���������� +KY |Kentucky |������� +CO |Colorado |��������� +CT |Connecticut |����������� +LA |Louisiana |��������� +ME |Maine |���� +MI |Michigan |��������� +MD |Maryland |��������� +MA |Massachusetts |������������ +MN |Minnesota |��������� +MS |Mississippi |��������� +MO |Missouri |�������� +MT |Montana |������� +NJ |New Jersey |��� ������ +NY |New York |��� ����� +NM |New Mexico |��� ������ +NH |New Hampshire |��� �������� +NV |Nevada |������ +NE |Nebraska |��������� +DE |Delaware |���������� +SC |South Carolina |����� �������� +SD |South Dakota |����� ������� +OK |Oklahoma |�������� +OR |Oregon |������� +OH |Ohio |����� +PA |Pennsylvania |������������ +RI |Rhode Island |������ ������ +TX |Texas |����� +TN |Tennessee |������� +GA |Georgia |�������� +FL |Florida |�������� +(50 rows) + +EOF diff --git a/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-select.sql.out b/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-select.sql.out new file mode 100644 index 0000000000..d77585fdd7 --- /dev/null +++ b/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-select.sql.out @@ -0,0 +1,11 @@ +abbrev|name_en |name_gr +------+--------------------+------------------ +UT |Utah |������ +WY |Wyoming |����������� +WV |West Virginia |������ ��������� +WI |Wisconsin |����������� +WA |Washington |������������ +DC |Washington DC |����������� ��� �� +(6 rows) + +EOF diff --git a/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-sort.out b/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-sort.out new file mode 100644 index 0000000000..ef9b699ba5 --- /dev/null +++ b/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-sort.out @@ -0,0 +1,7 @@ +Bording +Sorting +hoarding +������� +������ +��������� +���� diff --git a/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-text.sql.out b/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-text.sql.out new file mode 100644 index 0000000000..ce18789da0 --- /dev/null +++ b/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-text.sql.out @@ -0,0 +1,55 @@ +abbrev|name_en |name_gr +------+--------------------+------------------ +AK |Alaska |������ +AL |Alabama |�������� +AZ |Arizona |������� +AR |Arkansas |�������� +ID |Idaho |������� +IA |Iowa |����� +VT |Vermont |������� +VA |Virginia |��������� +NC |North Carolina |������ �������� +ND |North Dakota |������ ������� +UT |Utah |������ +WY |Wyoming |����������� +WV |West Virginia |������ ��������� +WI |Wisconsin |����������� +WA |Washington |������������ +DC |Washington DC |����������� ��� �� +IL |Illinois |�������� +IN |Indiana |������� +KA |Kansas |������ +CA |California |���������� +KY |Kentucky |������� +CO |Colorado |��������� +CT |Connecticut |����������� +LA |Louisiana |��������� +ME |Maine |���� +MI |Michigan |��������� +MD |Maryland |��������� +MA |Massachusetts |������������ +MN |Minnesota |��������� +MS |Mississippi |��������� +MO |Missouri |�������� +MT |Montana |������� +NJ |New Jersey |��� ������ +NY |New York |��� ����� +NM |New Mexico |��� ������ +NH |New Hampshire |��� �������� +NV |Nevada |������ +NE |Nebraska |��������� +DE |Delaware |���������� +SC |South Carolina |����� �������� +SD |South Dakota |����� ������� +OK |Oklahoma |�������� +OR |Oregon |������� +OH |Ohio |����� +PA |Pennsylvania |������������ +RI |Rhode Island |������ ������ +TX |Texas |����� +TN |Tennessee |������� +GA |Georgia |�������� +FL |Florida |�������� +(50 rows) + +EOF diff --git a/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-varchar.sql.out b/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-varchar.sql.out new file mode 100644 index 0000000000..ce18789da0 --- /dev/null +++ b/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-varchar.sql.out @@ -0,0 +1,55 @@ +abbrev|name_en |name_gr +------+--------------------+------------------ +AK |Alaska |������ +AL |Alabama |�������� +AZ |Arizona |������� +AR |Arkansas |�������� +ID |Idaho |������� +IA |Iowa |����� +VT |Vermont |������� +VA |Virginia |��������� +NC |North Carolina |������ �������� +ND |North Dakota |������ ������� +UT |Utah |������ +WY |Wyoming |����������� +WV |West Virginia |������ ��������� +WI |Wisconsin |����������� +WA |Washington |������������ +DC |Washington DC |����������� ��� �� +IL |Illinois |�������� +IN |Indiana |������� +KA |Kansas |������ +CA |California |���������� +KY |Kentucky |������� +CO |Colorado |��������� +CT |Connecticut |����������� +LA |Louisiana |��������� +ME |Maine |���� +MI |Michigan |��������� +MD |Maryland |��������� +MA |Massachusetts |������������ +MN |Minnesota |��������� +MS |Mississippi |��������� +MO |Missouri |�������� +MT |Montana |������� +NJ |New Jersey |��� ������ +NY |New York |��� ����� +NM |New Mexico |��� ������ +NH |New Hampshire |��� �������� +NV |Nevada |������ +NE |Nebraska |��������� +DE |Delaware |���������� +SC |South Carolina |����� �������� +SD |South Dakota |����� ������� +OK |Oklahoma |�������� +OR |Oregon |������� +OH |Ohio |����� +PA |Pennsylvania |������������ +RI |Rhode Island |������ ������ +TX |Texas |����� +TN |Tennessee |������� +GA |Georgia |�������� +FL |Florida |�������� +(50 rows) + +EOF diff --git a/src/test/locale/gr_GR.ISO8859-7/runall b/src/test/locale/gr_GR.ISO8859-7/runall new file mode 100755 index 0000000000..94bbd0c8c8 --- /dev/null +++ b/src/test/locale/gr_GR.ISO8859-7/runall @@ -0,0 +1,52 @@ +#! /bin/sh + +PATH=..:$PATH + +echo "Testing PostgreSQL compilation..." +if ! test-pgsql-locale; then + exit 1 +fi + +LC_CTYPE=gr_GR.ISO8859-7 +LC_COLLATE=$LC_CTYPE +export LC_CTYPE LC_COLLATE + +echo "Testing LC_CTYPE..." +if ! test-ctype > gr-ctype.out; then + exit 1 +fi +diff expected/gr-ctype.out gr-ctype.out + +echo "Testing LC_COLLATE..." +perl ../sort-test.pl test-gr-sort.in > test-gr-sort.out +diff expected/test-gr-sort.out test-gr-sort.out + +### If you have Python - uncomment the following two lines +#python ../sort-test.py test-gr-sort.in > test-gr-sort.out +#diff expected/test-gr-sort.out test-gr-sort.out + + +abort() { + [ "$1" ] && echo "$*" + exit 1 +} + +for f in char varchar text; do + if echo $f | grep -q char; then + ftype="$f(60)" + else + ftype="$f" + fi + echo "Testing PgSQL: sort on $ftype type..." + + destroydb testlocale >/dev/null 2>&1 + createdb testlocale || abort "createdb failed" + psql -d testlocale -c "CREATE TABLE usastates (abbrev char(2), name_en char(20), name_gr $ftype);" >/dev/null 2>&1 || abort "createtable failed" + psql testlocale < test-gr.sql.in > test-gr-$f.sql.out 2>/dev/null || abort "test query failed" + diff expected/test-gr-$f.sql.out test-gr-$f.sql.out +done +echo "Testing PgSQL: select on regexp..." +psql testlocale < test-gr-select.sql.in > test-gr-select.sql.out 2>/dev/null || abort "select query failed" +diff expected/test-gr-select.sql.out test-gr-select.sql.out +destroydb testlocale || abort "destroydb failed" +echo "Finished." diff --git a/src/test/locale/gr_GR.ISO8859-7/test-gr-select.sql.in b/src/test/locale/gr_GR.ISO8859-7/test-gr-select.sql.in new file mode 100644 index 0000000000..e22349c34c --- /dev/null +++ b/src/test/locale/gr_GR.ISO8859-7/test-gr-select.sql.in @@ -0,0 +1 @@ +SELECT * FROM usastates WHERE name_gr ~* '^�.*' ORDER BY name_gr; diff --git a/src/test/locale/gr_GR.ISO8859-7/test-gr-sort.in b/src/test/locale/gr_GR.ISO8859-7/test-gr-sort.in new file mode 100644 index 0000000000..248f0fa54e --- /dev/null +++ b/src/test/locale/gr_GR.ISO8859-7/test-gr-sort.in @@ -0,0 +1,7 @@ +Sorting +������ +��������� +���� +������� +Bording +hoarding diff --git a/src/test/locale/gr_GR.ISO8859-7/test-gr.sql.in b/src/test/locale/gr_GR.ISO8859-7/test-gr.sql.in new file mode 100644 index 0000000000..8cb638882e --- /dev/null +++ b/src/test/locale/gr_GR.ISO8859-7/test-gr.sql.in @@ -0,0 +1,53 @@ +COPY usastates FROM stdin USING DELIMITERS '|'; +AK|Alaska |������ +WA|Washington |������������ +OR|Oregon |������� +CA|California |���������� +NV|Nevada |������ +ID|Idaho |������� +UT|Utah |������ +AZ|Arizona |������� +MT|Montana |������� +WY|Wyoming |����������� +CO|Colorado |��������� +NM|New Mexico |��� ������ +ND|North Dakota |������ ������� +SD|South Dakota |����� ������� +NE|Nebraska |��������� +KA|Kansas |������ +OK|Oklahoma |�������� +TX|Texas |����� +MN|Minnesota |��������� +IA|Iowa |����� +MO|Missouri |�������� +AR|Arkansas |�������� +LA|Louisiana |��������� +WI|Wisconsin |����������� +IL|Illinois |�������� +IN|Indiana |������� +MS|Mississippi |��������� +AL|Alabama |�������� +MI|Michigan |��������� +OH|Ohio |����� +KY|Kentucky |������� +TN|Tennessee |������� +GA|Georgia |�������� +FL|Florida |�������� +PA|Pennsylvania |������������ +WV|West Virginia |������ ��������� +VA|Virginia |��������� +NC|North Carolina|������ �������� +SC|South Carolina|����� �������� +NY|New York |��� ����� +NJ|New Jersey |��� ������ +DE|Delaware |���������� +MD|Maryland |��������� +DC|Washington DC |����������� ��� �� +VT|Vermont |������� +MA|Massachusetts |������������ +CT|Connecticut |����������� +ME|Maine |���� +NH|New Hampshire |��� �������� +RI|Rhode Island |������ ������ +\. +SELECT * FROM usastates ORDER BY name_gr; diff --git a/src/test/locale/koi8-to-win1251/Makefile b/src/test/locale/koi8-to-win1251/Makefile new file mode 100644 index 0000000000..281014521e --- /dev/null +++ b/src/test/locale/koi8-to-win1251/Makefile @@ -0,0 +1,12 @@ +# +# Makefile for example programs +# + +all: + -@echo "make: Nothing to be done for \`all'." + +test: + @./runall + +clean: + rm -f *.out diff --git a/src/test/locale/koi8-to-win1251/README b/src/test/locale/koi8-to-win1251/README new file mode 100644 index 0000000000..1ad3bde81d --- /dev/null +++ b/src/test/locale/koi8-to-win1251/README @@ -0,0 +1,4 @@ +koi8-to-win1251 test. The database should be created in koi8 (createdb -E koi8), +test uses koi8-to-win1251 converting feature. +Created by Oleg Broytmann <phd2@earthling.net>. Code for encodings +converting created by Tatsuo Ishii <t-ishii@sra.co.jp>. diff --git a/src/test/locale/koi8-to-win1251/expected/test-koi8-char.sql.out b/src/test/locale/koi8-to-win1251/expected/test-koi8-char.sql.out new file mode 100644 index 0000000000..391af87c1d --- /dev/null +++ b/src/test/locale/koi8-to-win1251/expected/test-koi8-char.sql.out @@ -0,0 +1,55 @@ +abbrev|name_en |name_ru +------+--------------------+------------------------------------------------------------ +ID |Idaho |������ +IA |Iowa |����� +AL |Alabama |������� +AK |Alaska |������ +AZ |Arizona |������� +AR |Arkansas |�������� +WY |Wyoming |�������� +WA |Washington |��������� +VT |Vermont |������� +VA |Virginia |��������� +WI |Wisconsin |��������� +DE |Delaware |������� +GA |Georgia |�������� +WV |West Virginia |�������� ��������� +IL |Illinois |�������� +IN |Indiana |������� +CA |California |���������� +KA |Kansas |������ +KY |Kentucky |�������� +CO |Colorado |�������� +CT |Connecticut |����������� +LA |Louisiana |�������� +MA |Massachusetts |����������� +MN |Minnesota |��������� +MS |Mississippi |��������� +MO |Missouri |������� +MI |Michigan |������� +MT |Montana |������� +ME |Maine |��� +MD |Maryland |�������� +NE |Nebraska |�������� +NV |Nevada |������ +NH |New Hampshire |���-������� +NJ |New Jersey |���-������ +NY |New York |���-���� +NM |New Mexico |���-������� +OH |Ohio |����� +OK |Oklahoma |�������� +DC |Washington DC |����� �������� (������ ���������� ��� �������) +OR |Oregon |������ +PA |Pennsylvania |������������ +RI |Rhode Island |���-������ +ND |North Dakota |�������� ������ +NC |North Carolina |�������� �������� +TN |Tennessee |�������� +TX |Texas |����� +FL |Florida |������� +SD |South Dakota |����� ������ +SC |South Carolina |����� �������� +UT |Utah |��� +(50 rows) + +EOF diff --git a/src/test/locale/koi8-to-win1251/expected/test-koi8-select.sql.out b/src/test/locale/koi8-to-win1251/expected/test-koi8-select.sql.out new file mode 100644 index 0000000000..7d73f0e47f --- /dev/null +++ b/src/test/locale/koi8-to-win1251/expected/test-koi8-select.sql.out @@ -0,0 +1,9 @@ +abbrev|name_en |name_ru +------+--------------------+---------------------------------------------- +OH |Ohio |����� +OK |Oklahoma |�������� +DC |Washington DC |����� �������� (������ ���������� ��� �������) +OR |Oregon |������ +(4 rows) + +EOF diff --git a/src/test/locale/koi8-to-win1251/expected/test-koi8-sort.out b/src/test/locale/koi8-to-win1251/expected/test-koi8-sort.out new file mode 100644 index 0000000000..9b35ecdeaa --- /dev/null +++ b/src/test/locale/koi8-to-win1251/expected/test-koi8-sort.out @@ -0,0 +1,9 @@ +Bording +hoarding +Vesta +vesta +������ +������ +����� +����� +�� diff --git a/src/test/locale/koi8-to-win1251/expected/test-koi8-text.sql.out b/src/test/locale/koi8-to-win1251/expected/test-koi8-text.sql.out new file mode 100644 index 0000000000..7a1dad22ff --- /dev/null +++ b/src/test/locale/koi8-to-win1251/expected/test-koi8-text.sql.out @@ -0,0 +1,55 @@ +abbrev|name_en |name_ru +------+--------------------+---------------------------------------------- +ID |Idaho |������ +IA |Iowa |����� +AL |Alabama |������� +AK |Alaska |������ +AZ |Arizona |������� +AR |Arkansas |�������� +WY |Wyoming |�������� +WA |Washington |��������� +VT |Vermont |������� +VA |Virginia |��������� +WI |Wisconsin |��������� +DE |Delaware |������� +GA |Georgia |�������� +WV |West Virginia |�������� ��������� +IL |Illinois |�������� +IN |Indiana |������� +CA |California |���������� +KA |Kansas |������ +KY |Kentucky |�������� +CO |Colorado |�������� +CT |Connecticut |����������� +LA |Louisiana |�������� +MA |Massachusetts |����������� +MN |Minnesota |��������� +MS |Mississippi |��������� +MO |Missouri |������� +MI |Michigan |������� +MT |Montana |������� +ME |Maine |��� +MD |Maryland |�������� +NE |Nebraska |�������� +NV |Nevada |������ +NH |New Hampshire |���-������� +NJ |New Jersey |���-������ +NY |New York |���-���� +NM |New Mexico |���-������� +OH |Ohio |����� +OK |Oklahoma |�������� +DC |Washington DC |����� �������� (������ ���������� ��� �������) +OR |Oregon |������ +PA |Pennsylvania |������������ +RI |Rhode Island |���-������ +ND |North Dakota |�������� ������ +NC |North Carolina |�������� �������� +TN |Tennessee |�������� +TX |Texas |����� +FL |Florida |������� +SD |South Dakota |����� ������ +SC |South Carolina |����� �������� +UT |Utah |��� +(50 rows) + +EOF diff --git a/src/test/locale/koi8-to-win1251/expected/test-koi8-varchar.sql.out b/src/test/locale/koi8-to-win1251/expected/test-koi8-varchar.sql.out new file mode 100644 index 0000000000..7a1dad22ff --- /dev/null +++ b/src/test/locale/koi8-to-win1251/expected/test-koi8-varchar.sql.out @@ -0,0 +1,55 @@ +abbrev|name_en |name_ru +------+--------------------+---------------------------------------------- +ID |Idaho |������ +IA |Iowa |����� +AL |Alabama |������� +AK |Alaska |������ +AZ |Arizona |������� +AR |Arkansas |�������� +WY |Wyoming |�������� +WA |Washington |��������� +VT |Vermont |������� +VA |Virginia |��������� +WI |Wisconsin |��������� +DE |Delaware |������� +GA |Georgia |�������� +WV |West Virginia |�������� ��������� +IL |Illinois |�������� +IN |Indiana |������� +CA |California |���������� +KA |Kansas |������ +KY |Kentucky |�������� +CO |Colorado |�������� +CT |Connecticut |����������� +LA |Louisiana |�������� +MA |Massachusetts |����������� +MN |Minnesota |��������� +MS |Mississippi |��������� +MO |Missouri |������� +MI |Michigan |������� +MT |Montana |������� +ME |Maine |��� +MD |Maryland |�������� +NE |Nebraska |�������� +NV |Nevada |������ +NH |New Hampshire |���-������� +NJ |New Jersey |���-������ +NY |New York |���-���� +NM |New Mexico |���-������� +OH |Ohio |����� +OK |Oklahoma |�������� +DC |Washington DC |����� �������� (������ ���������� ��� �������) +OR |Oregon |������ +PA |Pennsylvania |������������ +RI |Rhode Island |���-������ +ND |North Dakota |�������� ������ +NC |North Carolina |�������� �������� +TN |Tennessee |�������� +TX |Texas |����� +FL |Florida |������� +SD |South Dakota |����� ������ +SC |South Carolina |����� �������� +UT |Utah |��� +(50 rows) + +EOF diff --git a/src/test/locale/koi8-to-win1251/runall b/src/test/locale/koi8-to-win1251/runall new file mode 100755 index 0000000000..e0fef2f0b9 --- /dev/null +++ b/src/test/locale/koi8-to-win1251/runall @@ -0,0 +1,49 @@ +#! /bin/sh + +PATH=..:$PATH + +echo "Testing PostgreSQL compilation..." +if ! test-pgsql-locale; then + exit 1 +fi + +LC_CTYPE=ru_RU.KOI8-R +LC_COLLATE=$LC_CTYPE +export LC_CTYPE LC_COLLATE + +PGCLIENTENCODING=win +export PGCLIENTENCODING + +echo "Testing LC_COLLATE..." +perl ../sort-test.pl test-koi8-sort.in > test-koi8-sort.out +diff expected/test-koi8-sort.out test-koi8-sort.out + +### If you have Python - uncomment the following two lines +#python ../sort-test.py test-koi8-sort.in > test-koi8-sort.out +#diff expected/test-koi8-sort.out test-koi8-sort.out + + +abort() { + [ "$1" ] && echo "$*" + exit 1 +} + +for f in char varchar text; do + if echo $f | grep -q char; then + ftype="$f(60)" + else + ftype="$f" + fi + echo "Testing PgSQL: sort on $ftype type..." + + destroydb testlocale >/dev/null 2>&1 + createdb testlocale || abort "createdb failed" + psql -d testlocale -c "CREATE TABLE usastates (abbrev char(2), name_en char(20), name_ru $ftype);" >/dev/null 2>&1 || abort "createtable failed" + psql testlocale < test-koi8.sql.in > test-koi8-$f.sql.out 2>/dev/null || abort "test query failed" + diff expected/test-koi8-$f.sql.out test-koi8-$f.sql.out +done +echo "Testing PgSQL: select on regexp..." +psql testlocale < test-koi8-select.sql.in > test-koi8-select.sql.out 2>/dev/null || abort "select query failed" +diff expected/test-koi8-select.sql.out test-koi8-select.sql.out +destroydb testlocale || abort "destroydb failed" +echo "Finished." diff --git a/src/test/locale/koi8-to-win1251/test-koi8-select.sql.in b/src/test/locale/koi8-to-win1251/test-koi8-select.sql.in new file mode 100644 index 0000000000..22658c8da9 --- /dev/null +++ b/src/test/locale/koi8-to-win1251/test-koi8-select.sql.in @@ -0,0 +1 @@ +SELECT * FROM usastates WHERE name_ru ~* '^�.*' ORDER BY name_ru; diff --git a/src/test/locale/koi8-to-win1251/test-koi8-sort.in b/src/test/locale/koi8-to-win1251/test-koi8-sort.in new file mode 100644 index 0000000000..3ce0d465c8 --- /dev/null +++ b/src/test/locale/koi8-to-win1251/test-koi8-sort.in @@ -0,0 +1,9 @@ +Vesta +vesta +�� +������ +������ +����� +����� +Bording +hoarding diff --git a/src/test/locale/koi8-to-win1251/test-koi8.sql.in b/src/test/locale/koi8-to-win1251/test-koi8.sql.in new file mode 100644 index 0000000000..2a5e8175f5 --- /dev/null +++ b/src/test/locale/koi8-to-win1251/test-koi8.sql.in @@ -0,0 +1,53 @@ +COPY usastates FROM stdin USING DELIMITERS '|'; +AK|Alaska |������ +WA|Washington |��������� +OR|Oregon |������ +CA|California |���������� +NV|Nevada |������ +ID|Idaho |������ +UT|Utah |��� +AZ|Arizona |������� +MT|Montana |������� +WY|Wyoming |�������� +CO|Colorado |�������� +NM|New Mexico |���-������� +ND|North Dakota |�������� ������ +SD|South Dakota |����� ������ +NE|Nebraska |�������� +KA|Kansas |������ +OK|Oklahoma |�������� +TX|Texas |����� +MN|Minnesota |��������� +IA|Iowa |����� +MO|Missouri |������� +AR|Arkansas |�������� +LA|Louisiana |�������� +WI|Wisconsin |��������� +IL|Illinois |�������� +IN|Indiana |������� +MS|Mississippi |��������� +AL|Alabama |������� +MI|Michigan |������� +OH|Ohio |����� +KY|Kentucky |�������� +TN|Tennessee |�������� +GA|Georgia |�������� +FL|Florida |������� +PA|Pennsylvania |������������ +WV|West Virginia |�������� ��������� +VA|Virginia |��������� +NC|North Carolina|�������� �������� +SC|South Carolina|����� �������� +NY|New York |���-���� +NJ|New Jersey |���-������ +DE|Delaware |������� +MD|Maryland |�������� +DC|Washington DC |����� �������� (������ ���������� ��� �������) +VT|Vermont |������� +MA|Massachusetts |����������� +CT|Connecticut |����������� +ME|Maine |��� +NH|New Hampshire |���-������� +RI|Rhode Island |���-������ +\. +SELECT * FROM usastates ORDER BY name_ru;