summaryrefslogtreecommitdiffstats
path: root/src/test/locale
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:17:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:17:33 +0000
commit5e45211a64149b3c659b90ff2de6fa982a5a93ed (patch)
tree739caf8c461053357daa9f162bef34516c7bf452 /src/test/locale
parentInitial commit. (diff)
downloadpostgresql-15-5e45211a64149b3c659b90ff2de6fa982a5a93ed.tar.xz
postgresql-15-5e45211a64149b3c659b90ff2de6fa982a5a93ed.zip
Adding upstream version 15.5.upstream/15.5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/locale')
-rw-r--r--src/test/locale/.gitignore1
-rw-r--r--src/test/locale/Makefile22
-rw-r--r--src/test/locale/README28
-rw-r--r--src/test/locale/de_DE.ISO8859-1/Makefile7
-rw-r--r--src/test/locale/de_DE.ISO8859-1/README4
-rw-r--r--src/test/locale/de_DE.ISO8859-1/expected/de-ctype.out257
-rw-r--r--src/test/locale/de_DE.ISO8859-1/expected/test-de-char.sql.out23
-rw-r--r--src/test/locale/de_DE.ISO8859-1/expected/test-de-select.sql.out7
-rw-r--r--src/test/locale/de_DE.ISO8859-1/expected/test-de-sort.out20
-rw-r--r--src/test/locale/de_DE.ISO8859-1/expected/test-de-text.sql.out23
-rw-r--r--src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-char.sql.out23
-rw-r--r--src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-text.sql.out23
-rw-r--r--src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-varchar.sql.out23
-rw-r--r--src/test/locale/de_DE.ISO8859-1/expected/test-de-varchar.sql.out23
-rwxr-xr-xsrc/test/locale/de_DE.ISO8859-1/runall64
-rw-r--r--src/test/locale/de_DE.ISO8859-1/test-de-select.sql.in1
-rw-r--r--src/test/locale/de_DE.ISO8859-1/test-de-sort.in20
-rw-r--r--src/test/locale/de_DE.ISO8859-1/test-de-upper.sql.in22
-rw-r--r--src/test/locale/de_DE.ISO8859-1/test-de.sql.in22
-rw-r--r--src/test/locale/gr_GR.ISO8859-7/Makefile7
-rw-r--r--src/test/locale/gr_GR.ISO8859-7/README4
-rw-r--r--src/test/locale/gr_GR.ISO8859-7/expected/gr-ctype.out257
-rw-r--r--src/test/locale/gr_GR.ISO8859-7/expected/test-gr-char.sql.out54
-rw-r--r--src/test/locale/gr_GR.ISO8859-7/expected/test-gr-select.sql.out10
-rw-r--r--src/test/locale/gr_GR.ISO8859-7/expected/test-gr-sort.out7
-rw-r--r--src/test/locale/gr_GR.ISO8859-7/expected/test-gr-text.sql.out54
-rw-r--r--src/test/locale/gr_GR.ISO8859-7/expected/test-gr-varchar.sql.out54
-rwxr-xr-xsrc/test/locale/gr_GR.ISO8859-7/runall49
-rw-r--r--src/test/locale/gr_GR.ISO8859-7/test-gr-select.sql.in1
-rw-r--r--src/test/locale/gr_GR.ISO8859-7/test-gr-sort.in7
-rw-r--r--src/test/locale/gr_GR.ISO8859-7/test-gr.sql.in53
-rw-r--r--src/test/locale/koi8-r/Makefile7
-rw-r--r--src/test/locale/koi8-r/expected/koi8-ctype.out257
-rw-r--r--src/test/locale/koi8-r/expected/test-koi8-char.sql.out54
-rw-r--r--src/test/locale/koi8-r/expected/test-koi8-select.sql.out8
-rw-r--r--src/test/locale/koi8-r/expected/test-koi8-sort.out9
-rw-r--r--src/test/locale/koi8-r/expected/test-koi8-text.sql.out54
-rw-r--r--src/test/locale/koi8-r/expected/test-koi8-varchar.sql.out54
-rwxr-xr-xsrc/test/locale/koi8-r/runall49
-rw-r--r--src/test/locale/koi8-r/test-koi8-select.sql.in1
-rw-r--r--src/test/locale/koi8-r/test-koi8-sort.in9
-rw-r--r--src/test/locale/koi8-r/test-koi8.sql.in53
-rw-r--r--src/test/locale/koi8-to-win1251/Makefile7
-rw-r--r--src/test/locale/koi8-to-win1251/README6
-rw-r--r--src/test/locale/koi8-to-win1251/expected/test-koi8-char.sql.out54
-rw-r--r--src/test/locale/koi8-to-win1251/expected/test-koi8-select.sql.out8
-rw-r--r--src/test/locale/koi8-to-win1251/expected/test-koi8-sort.out9
-rw-r--r--src/test/locale/koi8-to-win1251/expected/test-koi8-text.sql.out54
-rw-r--r--src/test/locale/koi8-to-win1251/expected/test-koi8-varchar.sql.out54
-rwxr-xr-xsrc/test/locale/koi8-to-win1251/runall46
-rw-r--r--src/test/locale/koi8-to-win1251/test-koi8-select.sql.in1
-rw-r--r--src/test/locale/koi8-to-win1251/test-koi8-sort.in9
-rw-r--r--src/test/locale/koi8-to-win1251/test-koi8.sql.in53
-rwxr-xr-xsrc/test/locale/sort-test.pl16
-rwxr-xr-xsrc/test/locale/sort-test.py20
-rw-r--r--src/test/locale/test-ctype.c79
56 files changed, 2141 insertions, 0 deletions
diff --git a/src/test/locale/.gitignore b/src/test/locale/.gitignore
new file mode 100644
index 0000000..620d3df
--- /dev/null
+++ b/src/test/locale/.gitignore
@@ -0,0 +1 @@
+/test-ctype
diff --git a/src/test/locale/Makefile b/src/test/locale/Makefile
new file mode 100644
index 0000000..7ba096b
--- /dev/null
+++ b/src/test/locale/Makefile
@@ -0,0 +1,22 @@
+# src/test/locale/Makefile
+
+subdir = src/test/locale
+top_builddir = ../../..
+include $(top_builddir)/src/Makefile.global
+
+
+PROGS = test-ctype
+DIRS = de_DE.ISO8859-1 gr_GR.ISO8859-7 koi8-r koi8-to-win1251
+
+all: $(PROGS)
+
+clean distclean maintainer-clean:
+ rm -f $(PROGS) *.o
+ rm -rf tmp_check
+ for d in $(DIRS); do \
+ $(MAKE) -C $$d clean || exit; \
+ done
+
+# These behave like installcheck targets.
+check-%: all
+ @$(MAKE) -C `echo $@ | sed 's/^check-//'` test
diff --git a/src/test/locale/README b/src/test/locale/README
new file mode 100644
index 0000000..e290e31
--- /dev/null
+++ b/src/test/locale/README
@@ -0,0 +1,28 @@
+src/test/locale/README
+
+Locales
+=======
+
+This directory contains a set of tests for locales. I provided one C
+program test-ctype.c to test CTYPE support in libc and the installed
+locale data. Then there are test-sort.pl and test-sort.py that test
+collating.
+
+To run a test for some locale run
+ make check-$locale
+for example
+ make check-koi8-r
+
+Currently, there are only tests for a few locales available. The script
+'runall' calls test-ctype to test libc and locale data, test-sort.pl
+(uncomment test-sort.py, if you have a Python interpreter installed), and
+does tests on PostgreSQL with the provided SQL script files.
+
+To add locale tests one needs to create a directory $locale and create
+a Makefile (and other files) similar to koi8-r/*. Actually, the simplest
+(I think) method is just to copy the koi8-r directory and edit/replace
+the files.
+
+Oleg.
+----
+ Oleg Broytmann http://members.xoom.com/phd2/ phd2@earthling.net
diff --git a/src/test/locale/de_DE.ISO8859-1/Makefile b/src/test/locale/de_DE.ISO8859-1/Makefile
new file mode 100644
index 0000000..28a72b7
--- /dev/null
+++ b/src/test/locale/de_DE.ISO8859-1/Makefile
@@ -0,0 +1,7 @@
+all:
+
+test:
+ ./runall
+
+clean:
+ rm -f *.out
diff --git a/src/test/locale/de_DE.ISO8859-1/README b/src/test/locale/de_DE.ISO8859-1/README
new file mode 100644
index 0000000..c9e6ee8
--- /dev/null
+++ b/src/test/locale/de_DE.ISO8859-1/README
@@ -0,0 +1,4 @@
+src/test/locale/de_DE.ISO8859-1/README
+
+de_DE.ISO-8859-1 (German) locale test.
+Created by Armin Diehl <diehl@net-connection.de>
diff --git a/src/test/locale/de_DE.ISO8859-1/expected/de-ctype.out b/src/test/locale/de_DE.ISO8859-1/expected/de-ctype.out
new file mode 100644
index 0000000..49ec93a
--- /dev/null
+++ b/src/test/locale/de_DE.ISO8859-1/expected/de-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/de_DE.ISO8859-1/expected/test-de-char.sql.out b/src/test/locale/de_DE.ISO8859-1/expected/test-de-char.sql.out
new file mode 100644
index 0000000..7d7201c
--- /dev/null
+++ b/src/test/locale/de_DE.ISO8859-1/expected/test-de-char.sql.out
@@ -0,0 +1,23 @@
+ name_en | name_de
+----------------------+--------------------------------
+ AAA |
+ aaaaaa |
+ AAAAa |
+ aaaaaaa | aaaaaa
+ BBBB | BBBB
+ bbbbbb | bbbbb
+ BBBBBB | BBBBBBB
+ CCC | CCCC
+ ddddd | ddddd
+ OOOOO |
+ oooooo |
+ OOOOOOO | OOOOOOO
+ ooooooo | oooooooo
+ ssssss | ssssss
+ SSSSSSSS | SSSSSSSS
+ |
+ UU | UU
+ uuuu |
+ UUUUU |
+(19 rows)
+
diff --git a/src/test/locale/de_DE.ISO8859-1/expected/test-de-select.sql.out b/src/test/locale/de_DE.ISO8859-1/expected/test-de-select.sql.out
new file mode 100644
index 0000000..556b866
--- /dev/null
+++ b/src/test/locale/de_DE.ISO8859-1/expected/test-de-select.sql.out
@@ -0,0 +1,7 @@
+ name_en | name_de
+----------------------+---------
+ AAA |
+ aaaaaa |
+ AAAAa |
+(3 rows)
+
diff --git a/src/test/locale/de_DE.ISO8859-1/expected/test-de-sort.out b/src/test/locale/de_DE.ISO8859-1/expected/test-de-sort.out
new file mode 100644
index 0000000..4c3fa5a
--- /dev/null
+++ b/src/test/locale/de_DE.ISO8859-1/expected/test-de-sort.out
@@ -0,0 +1,20 @@
+Bording
+Burg
+Brger
+Butter
+drang
+drang
+drngeln
+DRNGELN2
+hoardin
+hoch
+hhe
+hose
+Saat
+Sge
+Sarg
+Sorting
+ber
+Unter
+Zgern
+Zoll
diff --git a/src/test/locale/de_DE.ISO8859-1/expected/test-de-text.sql.out b/src/test/locale/de_DE.ISO8859-1/expected/test-de-text.sql.out
new file mode 100644
index 0000000..fd9350a
--- /dev/null
+++ b/src/test/locale/de_DE.ISO8859-1/expected/test-de-text.sql.out
@@ -0,0 +1,23 @@
+ name_en | name_de
+----------------------+----------
+ AAA |
+ aaaaaa |
+ AAAAa |
+ aaaaaaa | aaaaaa
+ BBBB | BBBB
+ bbbbbb | bbbbb
+ BBBBBB | BBBBBBB
+ CCC | CCCC
+ ddddd | ddddd
+ OOOOO |
+ oooooo |
+ OOOOOOO | OOOOOOO
+ ooooooo | oooooooo
+ ssssss | ssssss
+ SSSSSSSS | SSSSSSSS
+ |
+ UU | UU
+ uuuu |
+ UUUUU |
+(19 rows)
+
diff --git a/src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-char.sql.out b/src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-char.sql.out
new file mode 100644
index 0000000..cafe9d3
--- /dev/null
+++ b/src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-char.sql.out
@@ -0,0 +1,23 @@
+ upper
+--------------------------------
+
+
+
+ AAAAAA
+ BBBB
+ BBBBB
+ BBBBBBB
+ CCCC
+ DDDDD
+
+
+ OOOOOOO
+ OOOOOOOO
+ SSSSSS
+ SSSSSSSS
+
+ UU
+
+
+(19 rows)
+
diff --git a/src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-text.sql.out b/src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-text.sql.out
new file mode 100644
index 0000000..4a4aa12
--- /dev/null
+++ b/src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-text.sql.out
@@ -0,0 +1,23 @@
+ upper
+----------
+
+
+
+ AAAAAA
+ BBBB
+ BBBBB
+ BBBBBBB
+ CCCC
+ DDDDD
+
+
+ OOOOOOO
+ OOOOOOOO
+ SSSSSS
+ SSSSSSSS
+
+ UU
+
+
+(19 rows)
+
diff --git a/src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-varchar.sql.out b/src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-varchar.sql.out
new file mode 100644
index 0000000..4a4aa12
--- /dev/null
+++ b/src/test/locale/de_DE.ISO8859-1/expected/test-de-upper-varchar.sql.out
@@ -0,0 +1,23 @@
+ upper
+----------
+
+
+
+ AAAAAA
+ BBBB
+ BBBBB
+ BBBBBBB
+ CCCC
+ DDDDD
+
+
+ OOOOOOO
+ OOOOOOOO
+ SSSSSS
+ SSSSSSSS
+
+ UU
+
+
+(19 rows)
+
diff --git a/src/test/locale/de_DE.ISO8859-1/expected/test-de-varchar.sql.out b/src/test/locale/de_DE.ISO8859-1/expected/test-de-varchar.sql.out
new file mode 100644
index 0000000..fd9350a
--- /dev/null
+++ b/src/test/locale/de_DE.ISO8859-1/expected/test-de-varchar.sql.out
@@ -0,0 +1,23 @@
+ name_en | name_de
+----------------------+----------
+ AAA |
+ aaaaaa |
+ AAAAa |
+ aaaaaaa | aaaaaa
+ BBBB | BBBB
+ bbbbbb | bbbbb
+ BBBBBB | BBBBBBB
+ CCC | CCCC
+ ddddd | ddddd
+ OOOOO |
+ oooooo |
+ OOOOOOO | OOOOOOO
+ ooooooo | oooooooo
+ ssssss | ssssss
+ SSSSSSSS | SSSSSSSS
+ |
+ UU | UU
+ uuuu |
+ UUUUU |
+(19 rows)
+
diff --git a/src/test/locale/de_DE.ISO8859-1/runall b/src/test/locale/de_DE.ISO8859-1/runall
new file mode 100755
index 0000000..5368e12
--- /dev/null
+++ b/src/test/locale/de_DE.ISO8859-1/runall
@@ -0,0 +1,64 @@
+#! /bin/sh
+
+PATH=..:$PATH
+
+echo "Testing PostgreSQL compilation..."
+
+LC_CTYPE=de_DE.ISO8859-1
+LC_COLLATE=$LC_CTYPE
+export LC_CTYPE LC_COLLATE
+
+echo "Testing LC_CTYPE..."
+if ! test-ctype > de-ctype.out; then
+ exit 1
+fi
+diff expected/de-ctype.out de-ctype.out
+
+echo "Testing LC_COLLATE..."
+perl ../sort-test.pl test-de-sort.in > test-de-sort.out
+diff expected/test-de-sort.out test-de-sort.out
+
+### If you have Python - uncomment the following two lines
+#python ../sort-test.py test-de-sort.in > test-de-sort.out
+#diff expected/test-de-sort.out test-de-sort.out
+
+abort() {
+ [ "$1" ] && echo "$*"
+ exit 1
+}
+
+for f in char varchar text; do
+ if echo $f | grep -q char; then
+ ftype="$f(30)"
+ else
+ ftype="$f"
+ fi
+ echo "Testing PgSQL: sort on $ftype type..."
+
+ dropdb testlocale >/dev/null 2>&1
+ createdb testlocale || abort "createdb failed"
+ psql -X -d testlocale -c "CREATE TABLE wordlist (name_en char(20), name_de $ftype);" >/dev/null 2>&1 || abort "createtable failed"
+ psql -X testlocale < test-de.sql.in > test-de-$f.sql.out 2>/dev/null || abort "test query failed"
+ diff expected/test-de-$f.sql.out test-de-$f.sql.out
+done
+
+for f in char varchar text; do
+ if echo $f | grep -q char; then
+ ftype="$f(30)"
+ else
+ ftype="$f"
+ fi
+ echo "Testing PgSQL: upper () on $ftype type..."
+
+ dropdb testlocale >/dev/null 2>&1
+ createdb testlocale || abort "createdb failed"
+ psql -X -d testlocale -c "CREATE TABLE wordlist (name_en char(20), name_de $ftype);" >/dev/null 2>&1 || abort "createtable failed"
+ psql -X testlocale < test-de-upper.sql.in > test-de-upper-$f.sql.out 2>/dev/null || abort "test query failed"
+ diff expected/test-de-upper-$f.sql.out test-de-upper-$f.sql.out
+done
+
+echo "Testing PgSQL: select on regexp..."
+psql -X testlocale < test-de-select.sql.in > test-de-select.sql.out 2>/dev/null || abort "select query failed"
+diff expected/test-de-select.sql.out test-de-select.sql.out
+dropdb testlocale || abort "dropdb failed"
+echo "Finished."
diff --git a/src/test/locale/de_DE.ISO8859-1/test-de-select.sql.in b/src/test/locale/de_DE.ISO8859-1/test-de-select.sql.in
new file mode 100644
index 0000000..c38a156
--- /dev/null
+++ b/src/test/locale/de_DE.ISO8859-1/test-de-select.sql.in
@@ -0,0 +1 @@
+SELECT * FROM wordlist WHERE name_de ~* '^.*' ORDER BY name_de;
diff --git a/src/test/locale/de_DE.ISO8859-1/test-de-sort.in b/src/test/locale/de_DE.ISO8859-1/test-de-sort.in
new file mode 100644
index 0000000..c9b9272
--- /dev/null
+++ b/src/test/locale/de_DE.ISO8859-1/test-de-sort.in
@@ -0,0 +1,20 @@
+Sorting
+DRNGELN2
+Sarg
+Zgern
+drang
+Zoll
+hhe
+ber
+Brger
+Burg
+hoch
+hose
+Bording
+drngeln
+Unter
+Butter
+Saat
+Sge
+drang
+hoarding
diff --git a/src/test/locale/de_DE.ISO8859-1/test-de-upper.sql.in b/src/test/locale/de_DE.ISO8859-1/test-de-upper.sql.in
new file mode 100644
index 0000000..5149f8c
--- /dev/null
+++ b/src/test/locale/de_DE.ISO8859-1/test-de-upper.sql.in
@@ -0,0 +1,22 @@
+COPY wordlist FROM stdin WITH DELIMITER '|';
+AAA |
+AAAAa |
+BBBB |BBBB
+oooooooo |oooooooo
+uuuu |
+UUUUU |
+CCC |CCCC
+aaaaaa |
+ |
+aaaaaaa |aaaaaa
+bbbbbb |bbbbb
+UU |UU
+oooooo |
+ddddd |ddddd
+OOOOO |
+OOOOOOO |OOOOOOO
+BBBBBB |BBBBBBB
+SSSSSSSS |SSSSSSSS
+ssssss |ssssss
+\.
+SELECT upper (name_de) FROM wordlist ORDER BY upper (name_de);
diff --git a/src/test/locale/de_DE.ISO8859-1/test-de.sql.in b/src/test/locale/de_DE.ISO8859-1/test-de.sql.in
new file mode 100644
index 0000000..7108d02
--- /dev/null
+++ b/src/test/locale/de_DE.ISO8859-1/test-de.sql.in
@@ -0,0 +1,22 @@
+COPY wordlist FROM stdin WITH DELIMITER '|';
+AAA |
+AAAAa |
+BBBB |BBBB
+ooooooo |oooooooo
+uuuu |
+UUUUU |
+CCC |CCCC
+aaaaaa |
+ |
+aaaaaaa |aaaaaa
+bbbbbb |bbbbb
+UU |UU
+oooooo |
+ddddd |ddddd
+OOOOO |
+OOOOOOO |OOOOOOO
+BBBBBB |BBBBBBB
+SSSSSSSS |SSSSSSSS
+ssssss |ssssss
+\.
+SELECT * FROM wordlist ORDER BY name_de;
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 0000000..28a72b7
--- /dev/null
+++ b/src/test/locale/gr_GR.ISO8859-7/Makefile
@@ -0,0 +1,7 @@
+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 0000000..a3dad44
--- /dev/null
+++ b/src/test/locale/gr_GR.ISO8859-7/README
@@ -0,0 +1,4 @@
+src/test/locale/gr_GR.ISO8859-7/README
+
+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 0000000..833d706
--- /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 0000000..eb62e52
--- /dev/null
+++ b/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-char.sql.out
@@ -0,0 +1,54 @@
+ abbrev | name_en | name_gr
+--------+----------------------+--------------------------------------------------------------
+ ID | Idaho |
+ IA | Iowa |
+ AL | Alabama |
+ AK | Alaska |
+ AZ | Arizona |
+ AR | Arkansas |
+ VT | Vermont |
+ VA | Virginia |
+ NC | North Carolina |
+ ND | North Dakota |
+ FL | Florida |
+ IL | Illinois |
+ IN | Indiana |
+ CA | California |
+ KY | Kentucky |
+ CO | Colorado |
+ CT | Connecticut |
+ KA | Kansas |
+ LA | Louisiana |
+ MA | Massachusetts |
+ MD | Maryland |
+ MN | Minnesota |
+ MS | Mississippi |
+ MO | Missouri |
+ MT | Montana |
+ ME | Maine |
+ MI | Michigan |
+ NV | Nevada |
+ NE | Nebraska |
+ DE | Delaware |
+ NJ | New Jersey |
+ NY | New York |
+ NH | New Hampshire |
+ NM | New Mexico |
+ SC | South Carolina |
+ SD | South Dakota |
+ OH | Ohio |
+ OK | Oklahoma |
+ OR | Oregon |
+ PA | Pennsylvania |
+ TN | Tennessee |
+ GA | Georgia |
+ TX | Texas |
+ UT | Utah |
+ WY | Wyoming |
+ WV | West Virginia |
+ WI | Wisconsin |
+ WA | Washington |
+ DC | Washington DC |
+ RI | Rhode Island |
+(50 rows)
+
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 0000000..abfce69
--- /dev/null
+++ b/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-select.sql.out
@@ -0,0 +1,10 @@
+ abbrev | name_en | name_gr
+--------+----------------------+--------------------
+ UT | Utah |
+ WY | Wyoming |
+ WV | West Virginia |
+ WI | Wisconsin |
+ WA | Washington |
+ DC | Washington DC |
+(6 rows)
+
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 0000000..ef9b699
--- /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 0000000..0a128a7
--- /dev/null
+++ b/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-text.sql.out
@@ -0,0 +1,54 @@
+ abbrev | name_en | name_gr
+--------+----------------------+--------------------
+ ID | Idaho |
+ IA | Iowa |
+ AL | Alabama |
+ AK | Alaska |
+ AZ | Arizona |
+ AR | Arkansas |
+ VT | Vermont |
+ VA | Virginia |
+ NC | North Carolina |
+ ND | North Dakota |
+ FL | Florida |
+ IL | Illinois |
+ IN | Indiana |
+ CA | California |
+ KY | Kentucky |
+ CO | Colorado |
+ CT | Connecticut |
+ KA | Kansas |
+ LA | Louisiana |
+ MA | Massachusetts |
+ MD | Maryland |
+ MN | Minnesota |
+ MS | Mississippi |
+ MO | Missouri |
+ MT | Montana |
+ ME | Maine |
+ MI | Michigan |
+ NV | Nevada |
+ NE | Nebraska |
+ DE | Delaware |
+ NJ | New Jersey |
+ NY | New York |
+ NH | New Hampshire |
+ NM | New Mexico |
+ SC | South Carolina |
+ SD | South Dakota |
+ OH | Ohio |
+ OK | Oklahoma |
+ OR | Oregon |
+ PA | Pennsylvania |
+ TN | Tennessee |
+ GA | Georgia |
+ TX | Texas |
+ UT | Utah |
+ WY | Wyoming |
+ WV | West Virginia |
+ WI | Wisconsin |
+ WA | Washington |
+ DC | Washington DC |
+ RI | Rhode Island |
+(50 rows)
+
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 0000000..0a128a7
--- /dev/null
+++ b/src/test/locale/gr_GR.ISO8859-7/expected/test-gr-varchar.sql.out
@@ -0,0 +1,54 @@
+ abbrev | name_en | name_gr
+--------+----------------------+--------------------
+ ID | Idaho |
+ IA | Iowa |
+ AL | Alabama |
+ AK | Alaska |
+ AZ | Arizona |
+ AR | Arkansas |
+ VT | Vermont |
+ VA | Virginia |
+ NC | North Carolina |
+ ND | North Dakota |
+ FL | Florida |
+ IL | Illinois |
+ IN | Indiana |
+ CA | California |
+ KY | Kentucky |
+ CO | Colorado |
+ CT | Connecticut |
+ KA | Kansas |
+ LA | Louisiana |
+ MA | Massachusetts |
+ MD | Maryland |
+ MN | Minnesota |
+ MS | Mississippi |
+ MO | Missouri |
+ MT | Montana |
+ ME | Maine |
+ MI | Michigan |
+ NV | Nevada |
+ NE | Nebraska |
+ DE | Delaware |
+ NJ | New Jersey |
+ NY | New York |
+ NH | New Hampshire |
+ NM | New Mexico |
+ SC | South Carolina |
+ SD | South Dakota |
+ OH | Ohio |
+ OK | Oklahoma |
+ OR | Oregon |
+ PA | Pennsylvania |
+ TN | Tennessee |
+ GA | Georgia |
+ TX | Texas |
+ UT | Utah |
+ WY | Wyoming |
+ WV | West Virginia |
+ WI | Wisconsin |
+ WA | Washington |
+ DC | Washington DC |
+ RI | Rhode Island |
+(50 rows)
+
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 0000000..4db3374
--- /dev/null
+++ b/src/test/locale/gr_GR.ISO8859-7/runall
@@ -0,0 +1,49 @@
+#! /bin/sh
+
+PATH=..:$PATH
+
+echo "Testing PostgreSQL compilation..."
+
+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..."
+
+ dropdb testlocale >/dev/null 2>&1
+ createdb testlocale || abort "createdb failed"
+ psql -X -d testlocale -c "CREATE TABLE usastates (abbrev char(2), name_en char(20), name_gr $ftype);" >/dev/null 2>&1 || abort "createtable failed"
+ psql -X 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 -X 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
+dropdb testlocale || abort "dropdb 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 0000000..e22349c
--- /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 0000000..248f0fa
--- /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 0000000..781f4ef
--- /dev/null
+++ b/src/test/locale/gr_GR.ISO8859-7/test-gr.sql.in
@@ -0,0 +1,53 @@
+COPY usastates FROM stdin WITH DELIMITER '|';
+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-r/Makefile b/src/test/locale/koi8-r/Makefile
new file mode 100644
index 0000000..28a72b7
--- /dev/null
+++ b/src/test/locale/koi8-r/Makefile
@@ -0,0 +1,7 @@
+all:
+
+test:
+ ./runall
+
+clean:
+ rm -f *.out
diff --git a/src/test/locale/koi8-r/expected/koi8-ctype.out b/src/test/locale/koi8-r/expected/koi8-ctype.out
new file mode 100644
index 0000000..9b1d9d4
--- /dev/null
+++ b/src/test/locale/koi8-r/expected/koi8-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/koi8-r/expected/test-koi8-char.sql.out b/src/test/locale/koi8-r/expected/test-koi8-char.sql.out
new file mode 100644
index 0000000..95f52d8
--- /dev/null
+++ b/src/test/locale/koi8-r/expected/test-koi8-char.sql.out
@@ -0,0 +1,54 @@
+ 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)
+
diff --git a/src/test/locale/koi8-r/expected/test-koi8-select.sql.out b/src/test/locale/koi8-r/expected/test-koi8-select.sql.out
new file mode 100644
index 0000000..f5be657
--- /dev/null
+++ b/src/test/locale/koi8-r/expected/test-koi8-select.sql.out
@@ -0,0 +1,8 @@
+ abbrev | name_en | name_ru
+--------+----------------------+------------------------------------------------
+ OH | Ohio |
+ OK | Oklahoma |
+ DC | Washington DC | ( )
+ OR | Oregon |
+(4 rows)
+
diff --git a/src/test/locale/koi8-r/expected/test-koi8-sort.out b/src/test/locale/koi8-r/expected/test-koi8-sort.out
new file mode 100644
index 0000000..0089f41
--- /dev/null
+++ b/src/test/locale/koi8-r/expected/test-koi8-sort.out
@@ -0,0 +1,9 @@
+Bording
+hoarding
+Vesta
+vesta
+
+
+
+
+
diff --git a/src/test/locale/koi8-r/expected/test-koi8-text.sql.out b/src/test/locale/koi8-r/expected/test-koi8-text.sql.out
new file mode 100644
index 0000000..3dc3acf
--- /dev/null
+++ b/src/test/locale/koi8-r/expected/test-koi8-text.sql.out
@@ -0,0 +1,54 @@
+ 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)
+
diff --git a/src/test/locale/koi8-r/expected/test-koi8-varchar.sql.out b/src/test/locale/koi8-r/expected/test-koi8-varchar.sql.out
new file mode 100644
index 0000000..3dc3acf
--- /dev/null
+++ b/src/test/locale/koi8-r/expected/test-koi8-varchar.sql.out
@@ -0,0 +1,54 @@
+ 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)
+
diff --git a/src/test/locale/koi8-r/runall b/src/test/locale/koi8-r/runall
new file mode 100755
index 0000000..5f420d6
--- /dev/null
+++ b/src/test/locale/koi8-r/runall
@@ -0,0 +1,49 @@
+#! /bin/sh
+
+PATH=..:$PATH
+
+echo "Testing PostgreSQL compilation..."
+
+LC_CTYPE=ru_RU.KOI8-R
+LC_COLLATE=$LC_CTYPE
+export LC_CTYPE LC_COLLATE
+
+echo "Testing LC_CTYPE..."
+if ! test-ctype > koi8-ctype.out; then
+ exit 1
+fi
+diff expected/koi8-ctype.out koi8-ctype.out
+
+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..."
+
+ dropdb testlocale >/dev/null 2>&1
+ createdb testlocale || abort "createdb failed"
+ psql -X -d testlocale -c "CREATE TABLE usastates (abbrev char(2), name_en char(20), name_ru $ftype);" >/dev/null 2>&1 || abort "createtable failed"
+ psql -X 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 -X 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
+dropdb testlocale || abort "dropdb failed"
+echo "Finished."
diff --git a/src/test/locale/koi8-r/test-koi8-select.sql.in b/src/test/locale/koi8-r/test-koi8-select.sql.in
new file mode 100644
index 0000000..5cda505
--- /dev/null
+++ b/src/test/locale/koi8-r/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-r/test-koi8-sort.in b/src/test/locale/koi8-r/test-koi8-sort.in
new file mode 100644
index 0000000..3394e59
--- /dev/null
+++ b/src/test/locale/koi8-r/test-koi8-sort.in
@@ -0,0 +1,9 @@
+Vesta
+vesta
+
+
+
+
+
+Bording
+hoarding
diff --git a/src/test/locale/koi8-r/test-koi8.sql.in b/src/test/locale/koi8-r/test-koi8.sql.in
new file mode 100644
index 0000000..6be8392
--- /dev/null
+++ b/src/test/locale/koi8-r/test-koi8.sql.in
@@ -0,0 +1,53 @@
+COPY usastates FROM stdin WITH DELIMITER '|';
+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;
diff --git a/src/test/locale/koi8-to-win1251/Makefile b/src/test/locale/koi8-to-win1251/Makefile
new file mode 100644
index 0000000..28a72b7
--- /dev/null
+++ b/src/test/locale/koi8-to-win1251/Makefile
@@ -0,0 +1,7 @@
+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 0000000..0737803
--- /dev/null
+++ b/src/test/locale/koi8-to-win1251/README
@@ -0,0 +1,6 @@
+src/test/locale/koi8-to-win1251/README
+
+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 0000000..52d8b33
--- /dev/null
+++ b/src/test/locale/koi8-to-win1251/expected/test-koi8-char.sql.out
@@ -0,0 +1,54 @@
+ 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)
+
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 0000000..0feffa2
--- /dev/null
+++ b/src/test/locale/koi8-to-win1251/expected/test-koi8-select.sql.out
@@ -0,0 +1,8 @@
+ abbrev | name_en | name_ru
+--------+----------------------+------------------------------------------------
+ OH | Ohio |
+ OK | Oklahoma |
+ DC | Washington DC | ( )
+ OR | Oregon |
+(4 rows)
+
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 0000000..72242cc
--- /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 0000000..eccc1cb
--- /dev/null
+++ b/src/test/locale/koi8-to-win1251/expected/test-koi8-text.sql.out
@@ -0,0 +1,54 @@
+ 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)
+
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 0000000..eccc1cb
--- /dev/null
+++ b/src/test/locale/koi8-to-win1251/expected/test-koi8-varchar.sql.out
@@ -0,0 +1,54 @@
+ 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)
+
diff --git a/src/test/locale/koi8-to-win1251/runall b/src/test/locale/koi8-to-win1251/runall
new file mode 100755
index 0000000..89306a8
--- /dev/null
+++ b/src/test/locale/koi8-to-win1251/runall
@@ -0,0 +1,46 @@
+#! /bin/sh
+
+PATH=..:$PATH
+
+echo "Testing PostgreSQL compilation..."
+
+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..."
+
+ dropdb testlocale >/dev/null 2>&1
+ createdb testlocale || abort "createdb failed"
+ psql -X -d testlocale -c "CREATE TABLE usastates (abbrev char(2), name_en char(20), name_ru $ftype);" >/dev/null 2>&1 || abort "createtable failed"
+ psql -X 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 -X 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
+dropdb testlocale || abort "dropdb 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 0000000..22658c8
--- /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 0000000..3ce0d46
--- /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 0000000..244e495
--- /dev/null
+++ b/src/test/locale/koi8-to-win1251/test-koi8.sql.in
@@ -0,0 +1,53 @@
+COPY usastates FROM stdin WITH DELIMITER '|';
+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;
diff --git a/src/test/locale/sort-test.pl b/src/test/locale/sort-test.pl
new file mode 100755
index 0000000..318f6ab
--- /dev/null
+++ b/src/test/locale/sort-test.pl
@@ -0,0 +1,16 @@
+#! /usr/bin/perl
+
+# Copyright (c) 2021-2022, PostgreSQL Global Development Group
+
+use strict;
+use warnings;
+use locale;
+
+open(my $in_fh, '<', $ARGV[0]) || die;
+chop(my (@words) = <$in_fh>);
+close($in_fh);
+
+$" = "\n";
+my (@result) = sort @words;
+
+print "@result\n";
diff --git a/src/test/locale/sort-test.py b/src/test/locale/sort-test.py
new file mode 100755
index 0000000..21d6e78
--- /dev/null
+++ b/src/test/locale/sort-test.py
@@ -0,0 +1,20 @@
+#! /usr/bin/env python
+
+import locale
+import sys
+
+locale.setlocale(locale.LC_ALL, "")
+
+if len(sys.argv) != 2:
+ sys.stderr.write("Usage: sort.py filename\n")
+ sys.exit(1)
+
+infile = open(sys.argv[1], 'r')
+list = infile.readlines()
+infile.close()
+
+for i in range(0, len(list)):
+ list[i] = list[i][:-1] # chop!
+
+list.sort(key=locale.strxfrm)
+print('\n'.join(list))
diff --git a/src/test/locale/test-ctype.c b/src/test/locale/test-ctype.c
new file mode 100644
index 0000000..a3f896c
--- /dev/null
+++ b/src/test/locale/test-ctype.c
@@ -0,0 +1,79 @@
+/*
+ * src/test/locale/test-ctype.c
+ */
+
+/*
+
+ test-ctype.c
+
+Written by Oleg BroytMann, phd2@earthling.net
+ with help from Oleg Bartunov, oleg@sai.msu.su
+Copyright (C) 1998 PhiloSoft Design
+
+This is copyrighted but free software. You can use it, modify and distribute
+in original or modified form providing that the author's names and the above
+copyright notice will remain.
+
+Disclaimer, legal notice and absence of warranty.
+ This software provided "as is" without any kind of warranty. In no event
+the author shall be liable for any damage, etc.
+
+*/
+
+#include <stdio.h>
+#include <locale.h>
+#include <ctype.h>
+
+char *flag(int b);
+void describe_char(int c);
+
+#undef LONG_FLAG
+
+char *
+flag(int b)
+{
+#ifdef LONG_FLAG
+ return b ? "yes" : "no";
+#else
+ return b ? "+" : " ";
+#endif
+}
+
+void
+describe_char(int c)
+{
+ unsigned char cp = c,
+ up = toupper(c),
+ lo = tolower(c);
+
+ if (!isprint(cp))
+ cp = ' ';
+ if (!isprint(up))
+ up = ' ';
+ if (!isprint(lo))
+ lo = ' ';
+
+ printf("chr#%-4d%2c%6s%6s%6s%6s%6s%6s%6s%6s%6s%6s%6s%4c%4c\n", c, cp, flag(isalnum(c)), flag(isalpha(c)), flag(iscntrl(c)), flag(isdigit(c)), flag(islower(c)), flag(isgraph(c)), flag(isprint(c)), flag(ispunct(c)), flag(isspace(c)), flag(isupper(c)), flag(isxdigit(c)), lo, up);
+}
+
+int
+main()
+{
+ short c;
+ char *cur_locale;
+
+ cur_locale = setlocale(LC_ALL, "");
+ if (cur_locale)
+ fprintf(stderr, "Successfully set locale to \"%s\"\n", cur_locale);
+ else
+ {
+ fprintf(stderr, "Cannot setup locale. Either your libc does not provide\nlocale support, or your locale data is corrupt, or you have not set\nLANG or LC_CTYPE environment variable to proper value. Program aborted.\n");
+ return 1;
+ }
+
+ printf("char# char alnum alpha cntrl digit lower graph print punct space upper xdigit lo up\n");
+ for (c = 0; c <= 255; c++)
+ describe_char(c);
+
+ return 0;
+}