Make contrib regression tests safe for Danish locale.

In btree_gin and citext, avoid some not-particularly-interesting
dependencies on the sorting of 'aa'.  In tsearch2, use COLLATE "C" to
remove an uninteresting dependency on locale sort order (and thereby
allow removal of a variant expected-file).

Also, in citext, avoid assuming that lower('I') = 'i'.  This isn't relevant
to Danish but it does fail in Turkish.
This commit is contained in:
Tom Lane 2016-07-21 16:52:36 -04:00
parent 0060638c87
commit e15e7886e6
12 changed files with 271 additions and 3311 deletions

View File

@ -4,13 +4,13 @@ SET bytea_output TO escape;
CREATE TABLE test_bytea (
i bytea
);
INSERT INTO test_bytea VALUES ('aaa'),('a'),('abc'),('abb'),('axy'),('xyz');
INSERT INTO test_bytea VALUES ('a'),('ab'),('abc'),('abb'),('axy'),('xyz');
CREATE INDEX idx_bytea ON test_bytea USING gin (i);
SELECT * FROM test_bytea WHERE i<'abc'::bytea ORDER BY i;
i
-----
a
aaa
ab
abb
(3 rows)
@ -18,7 +18,7 @@ SELECT * FROM test_bytea WHERE i<='abc'::bytea ORDER BY i;
i
-----
a
aaa
ab
abb
abc
(4 rows)

View File

@ -2,13 +2,13 @@ set enable_seqscan=off;
CREATE TABLE test_text (
i text
);
INSERT INTO test_text VALUES ('aaa'),('a'),('abc'),('abb'),('axy'),('xyz');
INSERT INTO test_text VALUES ('a'),('ab'),('abc'),('abb'),('axy'),('xyz');
CREATE INDEX idx_text ON test_text USING gin (i);
SELECT * FROM test_text WHERE i<'abc' ORDER BY i;
i
-----
a
aaa
ab
abb
(3 rows)
@ -16,7 +16,7 @@ SELECT * FROM test_text WHERE i<='abc' ORDER BY i;
i
-----
a
aaa
ab
abb
abc
(4 rows)

View File

@ -2,13 +2,13 @@ set enable_seqscan=off;
CREATE TABLE test_varchar (
i varchar
);
INSERT INTO test_varchar VALUES ('aaa'),('a'),('abc'),('abb'),('axy'),('xyz');
INSERT INTO test_varchar VALUES ('a'),('ab'),('abc'),('abb'),('axy'),('xyz');
CREATE INDEX idx_varchar ON test_varchar USING gin (i);
SELECT * FROM test_varchar WHERE i<'abc'::varchar ORDER BY i;
i
-----
a
aaa
ab
abb
(3 rows)
@ -16,7 +16,7 @@ SELECT * FROM test_varchar WHERE i<='abc'::varchar ORDER BY i;
i
-----
a
aaa
ab
abb
abc
(4 rows)

View File

@ -6,7 +6,7 @@ CREATE TABLE test_bytea (
i bytea
);
INSERT INTO test_bytea VALUES ('aaa'),('a'),('abc'),('abb'),('axy'),('xyz');
INSERT INTO test_bytea VALUES ('a'),('ab'),('abc'),('abb'),('axy'),('xyz');
CREATE INDEX idx_bytea ON test_bytea USING gin (i);

View File

@ -4,7 +4,7 @@ CREATE TABLE test_text (
i text
);
INSERT INTO test_text VALUES ('aaa'),('a'),('abc'),('abb'),('axy'),('xyz');
INSERT INTO test_text VALUES ('a'),('ab'),('abc'),('abb'),('axy'),('xyz');
CREATE INDEX idx_text ON test_text USING gin (i);

View File

@ -4,7 +4,7 @@ CREATE TABLE test_varchar (
i varchar
);
INSERT INTO test_varchar VALUES ('aaa'),('a'),('abc'),('abb'),('axy'),('xyz');
INSERT INTO test_varchar VALUES ('a'),('ab'),('abc'),('abb'),('axy'),('xyz');
CREATE INDEX idx_varchar ON test_varchar USING gin (i);

View File

@ -175,7 +175,7 @@ SELECT 'a'::citext >= 'B'::varchar AS t; -- varchar wins.
t
(1 row)
-- A couple of longer examlpes to ensure that we don't get any issues with bad
-- A couple of longer examples to ensure that we don't get any issues with bad
-- conversions to char[] in the c code. Yes, I did do this.
SELECT 'aardvark'::citext = 'aardvark'::citext AS t;
t
@ -272,14 +272,14 @@ DETAIL: Key (name)=(A) already exists.
INSERT INTO try (name) VALUES ('aB');
ERROR: duplicate key value violates unique constraint "try_pkey"
DETAIL: Key (name)=(aB) already exists.
-- Make sure that citext_smaller() and citext_lager() work properly.
SELECT citext_smaller( 'aa'::citext, 'ab'::citext ) = 'aa' AS t;
-- Make sure that citext_smaller() and citext_larger() work properly.
SELECT citext_smaller( 'ab'::citext, 'ac'::citext ) = 'ab' AS t;
t
---
t
(1 row)
SELECT citext_smaller( 'AAAA'::citext, 'bbbb'::citext ) = 'AAAA' AS t;
SELECT citext_smaller( 'ABC'::citext, 'bbbb'::citext ) = 'ABC' AS t;
t
---
t
@ -297,13 +297,13 @@ SELECT citext_smaller( 'aardvark'::citext, 'AARDVARK'::citext ) = 'AARDVARK' AS
t
(1 row)
SELECT citext_larger( 'aa'::citext, 'ab'::citext ) = 'ab' AS t;
SELECT citext_larger( 'ab'::citext, 'ac'::citext ) = 'ac' AS t;
t
---
t
(1 row)
SELECT citext_larger( 'AAAA'::citext, 'bbbb'::citext ) = 'bbbb' AS t;
SELECT citext_larger( 'ABC'::citext, 'bbbb'::citext ) = 'bbbb' AS t;
t
---
t
@ -320,17 +320,16 @@ CREATE TEMP TABLE srt (
name CITEXT
);
INSERT INTO srt (name)
VALUES ('aardvark'),
('AAA'),
('aba'),
VALUES ('abb'),
('ABA'),
('ABC'),
('abd');
-- Check the min() and max() aggregates, with and without index.
set enable_seqscan = off;
SELECT MIN(name) AS "AAA" FROM srt;
AAA
SELECT MIN(name) AS "ABA" FROM srt;
ABA
-----
AAA
ABA
(1 row)
SELECT MAX(name) AS abd FROM srt;
@ -341,10 +340,10 @@ SELECT MAX(name) AS abd FROM srt;
reset enable_seqscan;
set enable_indexscan = off;
SELECT MIN(name) AS "AAA" FROM srt;
AAA
SELECT MIN(name) AS "ABA" FROM srt;
ABA
-----
AAA
ABA
(1 row)
SELECT MAX(name) AS abd FROM srt;
@ -357,162 +356,146 @@ reset enable_indexscan;
-- Check sorting likewise
set enable_seqscan = off;
SELECT name FROM srt ORDER BY name;
name
----------
AAA
aardvark
aba
name
------
ABA
abb
ABC
abd
(5 rows)
(4 rows)
reset enable_seqscan;
set enable_indexscan = off;
SELECT name FROM srt ORDER BY name;
name
----------
AAA
aardvark
aba
name
------
ABA
abb
ABC
abd
(5 rows)
(4 rows)
reset enable_indexscan;
-- Test assignment casts.
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::text;
aaa
SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::text;
aba
-----
aaa
aba
(1 row)
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::varchar;
aaa
SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::varchar;
aba
-----
aaa
aba
(1 row)
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::bpchar;
aaa
SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::bpchar;
aba
-----
aaa
aba
(1 row)
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA';
aaa
SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA';
aba
-----
aaa
aba
(1 row)
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::citext;
aaa
SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::citext;
aba
-----
aaa
aba
(1 row)
-- LIKE should be case-insensitive
SELECT name FROM srt WHERE name LIKE '%a%' ORDER BY name;
name
----------
AAA
aardvark
aba
name
------
ABA
abb
ABC
abd
(5 rows)
(4 rows)
SELECT name FROM srt WHERE name NOT LIKE '%b%' ORDER BY name;
name
----------
AAA
aardvark
(2 rows)
name
------
(0 rows)
SELECT name FROM srt WHERE name LIKE '%A%' ORDER BY name;
name
----------
AAA
aardvark
aba
name
------
ABA
abb
ABC
abd
(5 rows)
(4 rows)
SELECT name FROM srt WHERE name NOT LIKE '%B%' ORDER BY name;
name
----------
AAA
aardvark
(2 rows)
name
------
(0 rows)
-- ~~ should be case-insensitive
SELECT name FROM srt WHERE name ~~ '%a%' ORDER BY name;
name
----------
AAA
aardvark
aba
name
------
ABA
abb
ABC
abd
(5 rows)
(4 rows)
SELECT name FROM srt WHERE name !~~ '%b%' ORDER BY name;
name
----------
AAA
aardvark
(2 rows)
name
------
(0 rows)
SELECT name FROM srt WHERE name ~~ '%A%' ORDER BY name;
name
----------
AAA
aardvark
aba
name
------
ABA
abb
ABC
abd
(5 rows)
(4 rows)
SELECT name FROM srt WHERE name !~~ '%B%' ORDER BY name;
name
----------
AAA
aardvark
(2 rows)
name
------
(0 rows)
-- ~ should be case-insensitive
SELECT name FROM srt WHERE name ~ '^a' ORDER BY name;
name
----------
AAA
aardvark
aba
name
------
ABA
abb
ABC
abd
(5 rows)
(4 rows)
SELECT name FROM srt WHERE name !~ 'a$' ORDER BY name;
name
----------
aardvark
name
------
abb
ABC
abd
(3 rows)
SELECT name FROM srt WHERE name ~ '^A' ORDER BY name;
name
----------
AAA
aardvark
aba
name
------
ABA
abb
ABC
abd
(5 rows)
(4 rows)
SELECT name FROM srt WHERE name !~ 'A$' ORDER BY name;
name
----------
aardvark
name
------
abb
ABC
abd
(3 rows)
@ -521,16 +504,14 @@ SELECT name FROM srt WHERE name !~ 'A$' ORDER BY name;
SELECT name FROM srt WHERE name SIMILAR TO '%a.*';
name
------
AAA
aba
(2 rows)
ABA
(1 row)
SELECT name FROM srt WHERE name SIMILAR TO '%A.*';
name
------
AAA
aba
(2 rows)
ABA
(1 row)
-- Explicit casts.
SELECT true::citext = 'true' AS t;
@ -1502,8 +1483,7 @@ SELECT bit_length( name ) = bit_length( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT textlen( name ) = textlen( name::text ) AS t FROM srt;
t
@ -1512,8 +1492,7 @@ SELECT textlen( name ) = textlen( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT char_length( name ) = char_length( name::text ) AS t FROM srt;
t
@ -1522,8 +1501,7 @@ SELECT char_length( name ) = char_length( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT lower( name ) = lower( name::text ) AS t FROM srt;
t
@ -1532,8 +1510,7 @@ SELECT lower( name ) = lower( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT octet_length( name ) = octet_length( name::text ) AS t FROM srt;
t
@ -1542,8 +1519,7 @@ SELECT octet_length( name ) = octet_length( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT overlay( name placing 'hom' from 2 for 4) = overlay( name::text placing 'hom' from 2 for 4) AS t FROM srt;
t
@ -1552,8 +1528,7 @@ SELECT overlay( name placing 'hom' from 2 for 4) = overlay( name::text placing '
t
t
t
t
(5 rows)
(4 rows)
SELECT position( 'a' IN name ) = position( 'a' IN name::text ) AS t FROM srt;
t
@ -1562,8 +1537,7 @@ SELECT position( 'a' IN name ) = position( 'a' IN name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT substr('alphabet'::citext, 3) = 'phabet' AS t;
t
@ -1644,8 +1618,7 @@ SELECT upper( name ) = upper( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
-- Table 9-6. Other String Functions.
SELECT ascii( name ) = ascii( name::text ) AS t FROM srt;
@ -1655,8 +1628,7 @@ SELECT ascii( name ) = ascii( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT btrim(' trim'::citext ) = 'trim' AS t;
t
@ -1697,8 +1669,7 @@ SELECT convert_to( name, 'ISO-8859-1' ) = convert_to( name::text, 'ISO-8859-1' )
t
t
t
t
(5 rows)
(4 rows)
SELECT decode('MTIzAAE='::citext, 'base64') = decode('MTIzAAE='::text, 'base64') AS t;
t
@ -1720,8 +1691,7 @@ SELECT length( name ) = length( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT lpad('hi'::citext, 5 ) = ' hi' AS t;
t
@ -1778,8 +1748,7 @@ SELECT md5( name ) = md5( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
-- pg_client_encoding() takes no args and returns name.
SELECT quote_ident( name ) = quote_ident( name::text ) AS t FROM srt;
@ -1789,8 +1758,7 @@ SELECT quote_ident( name ) = quote_ident( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT quote_literal( name ) = quote_literal( name::text ) AS t FROM srt;
t
@ -1799,8 +1767,7 @@ SELECT quote_literal( name ) = quote_literal( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT regexp_matches('foobarbequebaz'::citext, '(bar)(beque)') = ARRAY[ 'bar', 'beque' ] AS t;
t
@ -2098,37 +2065,37 @@ SELECT split_part('abcTdefTghi', 't'::citext, 2) = 'def' AS t;
t
(1 row)
SELECT strpos('high'::citext, 'ig' ) = 2 AS t;
SELECT strpos('high'::citext, 'gh' ) = 3 AS t;
t
---
t
(1 row)
SELECT strpos('high', 'ig'::citext) = 2 AS t;
SELECT strpos('high', 'gh'::citext) = 3 AS t;
t
---
t
(1 row)
SELECT strpos('high'::citext, 'ig'::citext) = 2 AS t;
SELECT strpos('high'::citext, 'gh'::citext) = 3 AS t;
t
---
t
(1 row)
SELECT strpos('high'::citext, 'IG' ) = 2 AS t;
SELECT strpos('high'::citext, 'GH' ) = 3 AS t;
t
---
t
(1 row)
SELECT strpos('high', 'IG'::citext) = 2 AS t;
SELECT strpos('high', 'GH'::citext) = 3 AS t;
t
---
t
(1 row)
SELECT strpos('high'::citext, 'IG'::citext) = 2 AS t;
SELECT strpos('high'::citext, 'GH'::citext) = 3 AS t;
t
---
t
@ -2262,8 +2229,7 @@ SELECT like_escape( name, '' ) = like_escape( name::text, '' ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT like_escape( name::text, ''::citext ) = like_escape( name::text, '' ) AS t FROM srt;
t
@ -2272,6 +2238,5 @@ SELECT like_escape( name::text, ''::citext ) = like_escape( name::text, '' ) AS
t
t
t
t
(5 rows)
(4 rows)

View File

@ -175,7 +175,7 @@ SELECT 'a'::citext >= 'B'::varchar AS t; -- varchar wins.
f
(1 row)
-- A couple of longer examlpes to ensure that we don't get any issues with bad
-- A couple of longer examples to ensure that we don't get any issues with bad
-- conversions to char[] in the c code. Yes, I did do this.
SELECT 'aardvark'::citext = 'aardvark'::citext AS t;
t
@ -272,14 +272,14 @@ DETAIL: Key (name)=(A) already exists.
INSERT INTO try (name) VALUES ('aB');
ERROR: duplicate key value violates unique constraint "try_pkey"
DETAIL: Key (name)=(aB) already exists.
-- Make sure that citext_smaller() and citext_lager() work properly.
SELECT citext_smaller( 'aa'::citext, 'ab'::citext ) = 'aa' AS t;
-- Make sure that citext_smaller() and citext_larger() work properly.
SELECT citext_smaller( 'ab'::citext, 'ac'::citext ) = 'ab' AS t;
t
---
t
(1 row)
SELECT citext_smaller( 'AAAA'::citext, 'bbbb'::citext ) = 'AAAA' AS t;
SELECT citext_smaller( 'ABC'::citext, 'bbbb'::citext ) = 'ABC' AS t;
t
---
t
@ -297,13 +297,13 @@ SELECT citext_smaller( 'aardvark'::citext, 'AARDVARK'::citext ) = 'AARDVARK' AS
t
(1 row)
SELECT citext_larger( 'aa'::citext, 'ab'::citext ) = 'ab' AS t;
SELECT citext_larger( 'ab'::citext, 'ac'::citext ) = 'ac' AS t;
t
---
t
(1 row)
SELECT citext_larger( 'AAAA'::citext, 'bbbb'::citext ) = 'bbbb' AS t;
SELECT citext_larger( 'ABC'::citext, 'bbbb'::citext ) = 'bbbb' AS t;
t
---
t
@ -320,17 +320,16 @@ CREATE TEMP TABLE srt (
name CITEXT
);
INSERT INTO srt (name)
VALUES ('aardvark'),
('AAA'),
('aba'),
VALUES ('abb'),
('ABA'),
('ABC'),
('abd');
-- Check the min() and max() aggregates, with and without index.
set enable_seqscan = off;
SELECT MIN(name) AS "AAA" FROM srt;
AAA
SELECT MIN(name) AS "ABA" FROM srt;
ABA
-----
AAA
ABA
(1 row)
SELECT MAX(name) AS abd FROM srt;
@ -341,10 +340,10 @@ SELECT MAX(name) AS abd FROM srt;
reset enable_seqscan;
set enable_indexscan = off;
SELECT MIN(name) AS "AAA" FROM srt;
AAA
SELECT MIN(name) AS "ABA" FROM srt;
ABA
-----
AAA
ABA
(1 row)
SELECT MAX(name) AS abd FROM srt;
@ -357,162 +356,146 @@ reset enable_indexscan;
-- Check sorting likewise
set enable_seqscan = off;
SELECT name FROM srt ORDER BY name;
name
----------
AAA
aardvark
aba
name
------
ABA
abb
ABC
abd
(5 rows)
(4 rows)
reset enable_seqscan;
set enable_indexscan = off;
SELECT name FROM srt ORDER BY name;
name
----------
AAA
aardvark
aba
name
------
ABA
abb
ABC
abd
(5 rows)
(4 rows)
reset enable_indexscan;
-- Test assignment casts.
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::text;
aaa
SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::text;
aba
-----
aaa
aba
(1 row)
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::varchar;
aaa
SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::varchar;
aba
-----
aaa
aba
(1 row)
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::bpchar;
aaa
SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::bpchar;
aba
-----
aaa
aba
(1 row)
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA';
aaa
SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA';
aba
-----
aaa
aba
(1 row)
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::citext;
aaa
SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::citext;
aba
-----
aaa
aba
(1 row)
-- LIKE should be case-insensitive
SELECT name FROM srt WHERE name LIKE '%a%' ORDER BY name;
name
----------
AAA
aardvark
aba
name
------
ABA
abb
ABC
abd
(5 rows)
(4 rows)
SELECT name FROM srt WHERE name NOT LIKE '%b%' ORDER BY name;
name
----------
AAA
aardvark
(2 rows)
name
------
(0 rows)
SELECT name FROM srt WHERE name LIKE '%A%' ORDER BY name;
name
----------
AAA
aardvark
aba
name
------
ABA
abb
ABC
abd
(5 rows)
(4 rows)
SELECT name FROM srt WHERE name NOT LIKE '%B%' ORDER BY name;
name
----------
AAA
aardvark
(2 rows)
name
------
(0 rows)
-- ~~ should be case-insensitive
SELECT name FROM srt WHERE name ~~ '%a%' ORDER BY name;
name
----------
AAA
aardvark
aba
name
------
ABA
abb
ABC
abd
(5 rows)
(4 rows)
SELECT name FROM srt WHERE name !~~ '%b%' ORDER BY name;
name
----------
AAA
aardvark
(2 rows)
name
------
(0 rows)
SELECT name FROM srt WHERE name ~~ '%A%' ORDER BY name;
name
----------
AAA
aardvark
aba
name
------
ABA
abb
ABC
abd
(5 rows)
(4 rows)
SELECT name FROM srt WHERE name !~~ '%B%' ORDER BY name;
name
----------
AAA
aardvark
(2 rows)
name
------
(0 rows)
-- ~ should be case-insensitive
SELECT name FROM srt WHERE name ~ '^a' ORDER BY name;
name
----------
AAA
aardvark
aba
name
------
ABA
abb
ABC
abd
(5 rows)
(4 rows)
SELECT name FROM srt WHERE name !~ 'a$' ORDER BY name;
name
----------
aardvark
name
------
abb
ABC
abd
(3 rows)
SELECT name FROM srt WHERE name ~ '^A' ORDER BY name;
name
----------
AAA
aardvark
aba
name
------
ABA
abb
ABC
abd
(5 rows)
(4 rows)
SELECT name FROM srt WHERE name !~ 'A$' ORDER BY name;
name
----------
aardvark
name
------
abb
ABC
abd
(3 rows)
@ -521,16 +504,14 @@ SELECT name FROM srt WHERE name !~ 'A$' ORDER BY name;
SELECT name FROM srt WHERE name SIMILAR TO '%a.*';
name
------
AAA
aba
(2 rows)
ABA
(1 row)
SELECT name FROM srt WHERE name SIMILAR TO '%A.*';
name
------
AAA
aba
(2 rows)
ABA
(1 row)
-- Explicit casts.
SELECT true::citext = 'true' AS t;
@ -1502,8 +1483,7 @@ SELECT bit_length( name ) = bit_length( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT textlen( name ) = textlen( name::text ) AS t FROM srt;
t
@ -1512,8 +1492,7 @@ SELECT textlen( name ) = textlen( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT char_length( name ) = char_length( name::text ) AS t FROM srt;
t
@ -1522,8 +1501,7 @@ SELECT char_length( name ) = char_length( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT lower( name ) = lower( name::text ) AS t FROM srt;
t
@ -1532,8 +1510,7 @@ SELECT lower( name ) = lower( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT octet_length( name ) = octet_length( name::text ) AS t FROM srt;
t
@ -1542,8 +1519,7 @@ SELECT octet_length( name ) = octet_length( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT overlay( name placing 'hom' from 2 for 4) = overlay( name::text placing 'hom' from 2 for 4) AS t FROM srt;
t
@ -1552,8 +1528,7 @@ SELECT overlay( name placing 'hom' from 2 for 4) = overlay( name::text placing '
t
t
t
t
(5 rows)
(4 rows)
SELECT position( 'a' IN name ) = position( 'a' IN name::text ) AS t FROM srt;
t
@ -1562,8 +1537,7 @@ SELECT position( 'a' IN name ) = position( 'a' IN name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT substr('alphabet'::citext, 3) = 'phabet' AS t;
t
@ -1644,8 +1618,7 @@ SELECT upper( name ) = upper( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
-- Table 9-6. Other String Functions.
SELECT ascii( name ) = ascii( name::text ) AS t FROM srt;
@ -1655,8 +1628,7 @@ SELECT ascii( name ) = ascii( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT btrim(' trim'::citext ) = 'trim' AS t;
t
@ -1697,8 +1669,7 @@ SELECT convert_to( name, 'ISO-8859-1' ) = convert_to( name::text, 'ISO-8859-1' )
t
t
t
t
(5 rows)
(4 rows)
SELECT decode('MTIzAAE='::citext, 'base64') = decode('MTIzAAE='::text, 'base64') AS t;
t
@ -1720,8 +1691,7 @@ SELECT length( name ) = length( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT lpad('hi'::citext, 5 ) = ' hi' AS t;
t
@ -1778,8 +1748,7 @@ SELECT md5( name ) = md5( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
-- pg_client_encoding() takes no args and returns name.
SELECT quote_ident( name ) = quote_ident( name::text ) AS t FROM srt;
@ -1789,8 +1758,7 @@ SELECT quote_ident( name ) = quote_ident( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT quote_literal( name ) = quote_literal( name::text ) AS t FROM srt;
t
@ -1799,8 +1767,7 @@ SELECT quote_literal( name ) = quote_literal( name::text ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT regexp_matches('foobarbequebaz'::citext, '(bar)(beque)') = ARRAY[ 'bar', 'beque' ] AS t;
t
@ -2098,37 +2065,37 @@ SELECT split_part('abcTdefTghi', 't'::citext, 2) = 'def' AS t;
t
(1 row)
SELECT strpos('high'::citext, 'ig' ) = 2 AS t;
SELECT strpos('high'::citext, 'gh' ) = 3 AS t;
t
---
t
(1 row)
SELECT strpos('high', 'ig'::citext) = 2 AS t;
SELECT strpos('high', 'gh'::citext) = 3 AS t;
t
---
t
(1 row)
SELECT strpos('high'::citext, 'ig'::citext) = 2 AS t;
SELECT strpos('high'::citext, 'gh'::citext) = 3 AS t;
t
---
t
(1 row)
SELECT strpos('high'::citext, 'IG' ) = 2 AS t;
SELECT strpos('high'::citext, 'GH' ) = 3 AS t;
t
---
t
(1 row)
SELECT strpos('high', 'IG'::citext) = 2 AS t;
SELECT strpos('high', 'GH'::citext) = 3 AS t;
t
---
t
(1 row)
SELECT strpos('high'::citext, 'IG'::citext) = 2 AS t;
SELECT strpos('high'::citext, 'GH'::citext) = 3 AS t;
t
---
t
@ -2262,8 +2229,7 @@ SELECT like_escape( name, '' ) = like_escape( name::text, '' ) AS t FROM srt;
t
t
t
t
(5 rows)
(4 rows)
SELECT like_escape( name::text, ''::citext ) = like_escape( name::text, '' ) AS t FROM srt;
t
@ -2272,6 +2238,5 @@ SELECT like_escape( name::text, ''::citext ) = like_escape( name::text, '' ) AS
t
t
t
t
(5 rows)
(4 rows)

View File

@ -72,7 +72,7 @@ SELECT 'B'::citext <= 'a'::varchar AS t; -- varchar wins.
SELECT 'a'::citext > 'B'::varchar AS t; -- varchar wins.
SELECT 'a'::citext >= 'B'::varchar AS t; -- varchar wins.
-- A couple of longer examlpes to ensure that we don't get any issues with bad
-- A couple of longer examples to ensure that we don't get any issues with bad
-- conversions to char[] in the c code. Yes, I did do this.
SELECT 'aardvark'::citext = 'aardvark'::citext AS t;
@ -104,14 +104,14 @@ INSERT INTO try (name) VALUES ('a');
INSERT INTO try (name) VALUES ('A');
INSERT INTO try (name) VALUES ('aB');
-- Make sure that citext_smaller() and citext_lager() work properly.
SELECT citext_smaller( 'aa'::citext, 'ab'::citext ) = 'aa' AS t;
SELECT citext_smaller( 'AAAA'::citext, 'bbbb'::citext ) = 'AAAA' AS t;
-- Make sure that citext_smaller() and citext_larger() work properly.
SELECT citext_smaller( 'ab'::citext, 'ac'::citext ) = 'ab' AS t;
SELECT citext_smaller( 'ABC'::citext, 'bbbb'::citext ) = 'ABC' AS t;
SELECT citext_smaller( 'aardvark'::citext, 'Aaba'::citext ) = 'Aaba' AS t;
SELECT citext_smaller( 'aardvark'::citext, 'AARDVARK'::citext ) = 'AARDVARK' AS t;
SELECT citext_larger( 'aa'::citext, 'ab'::citext ) = 'ab' AS t;
SELECT citext_larger( 'AAAA'::citext, 'bbbb'::citext ) = 'bbbb' AS t;
SELECT citext_larger( 'ab'::citext, 'ac'::citext ) = 'ac' AS t;
SELECT citext_larger( 'ABC'::citext, 'bbbb'::citext ) = 'bbbb' AS t;
SELECT citext_larger( 'aardvark'::citext, 'Aaba'::citext ) = 'aardvark' AS t;
-- Test aggregate functions and sort ordering
@ -121,19 +121,18 @@ CREATE TEMP TABLE srt (
);
INSERT INTO srt (name)
VALUES ('aardvark'),
('AAA'),
('aba'),
VALUES ('abb'),
('ABA'),
('ABC'),
('abd');
-- Check the min() and max() aggregates, with and without index.
set enable_seqscan = off;
SELECT MIN(name) AS "AAA" FROM srt;
SELECT MIN(name) AS "ABA" FROM srt;
SELECT MAX(name) AS abd FROM srt;
reset enable_seqscan;
set enable_indexscan = off;
SELECT MIN(name) AS "AAA" FROM srt;
SELECT MIN(name) AS "ABA" FROM srt;
SELECT MAX(name) AS abd FROM srt;
reset enable_indexscan;
@ -146,11 +145,11 @@ SELECT name FROM srt ORDER BY name;
reset enable_indexscan;
-- Test assignment casts.
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::text;
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::varchar;
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::bpchar;
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA';
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::citext;
SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::text;
SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::varchar;
SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::bpchar;
SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA';
SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::citext;
-- LIKE should be case-insensitive
SELECT name FROM srt WHERE name LIKE '%a%' ORDER BY name;
@ -653,12 +652,12 @@ SELECT split_part('abcTdefTghi'::citext, 't', 2) = 'def' AS t;
SELECT split_part('abcTdefTghi'::citext, 't'::citext, 2) = 'def' AS t;
SELECT split_part('abcTdefTghi', 't'::citext, 2) = 'def' AS t;
SELECT strpos('high'::citext, 'ig' ) = 2 AS t;
SELECT strpos('high', 'ig'::citext) = 2 AS t;
SELECT strpos('high'::citext, 'ig'::citext) = 2 AS t;
SELECT strpos('high'::citext, 'IG' ) = 2 AS t;
SELECT strpos('high', 'IG'::citext) = 2 AS t;
SELECT strpos('high'::citext, 'IG'::citext) = 2 AS t;
SELECT strpos('high'::citext, 'gh' ) = 3 AS t;
SELECT strpos('high', 'gh'::citext) = 3 AS t;
SELECT strpos('high'::citext, 'gh'::citext) = 3 AS t;
SELECT strpos('high'::citext, 'GH' ) = 3 AS t;
SELECT strpos('high', 'GH'::citext) = 3 AS t;
SELECT strpos('high'::citext, 'GH'::citext) = 3 AS t;
-- to_ascii() does not support UTF-8.
-- to_hex() takes a numeric argument.

View File

@ -1067,7 +1067,7 @@ select rank(' a:1 s:2 d g'::tsvector, 'a & s');
insert into test_tsvector (t) values ('foo bar foo the over foo qq bar');
drop trigger tsvectorupdate on test_tsvector;
select * from stat('select a from test_tsvector') order by ndoc desc, nentry desc, word;
select * from stat('select a from test_tsvector') order by ndoc desc, nentry desc, word collate "C";
word | ndoc | nentry
-----------+------+--------
qq | 109 | 109
@ -2220,28 +2220,28 @@ select * from stat('select a from test_tsvector') order by ndoc desc, nentry des
insert into test_tsvector values ('1', 'a:1a,2,3b b:5a,6a,7c,8');
insert into test_tsvector values ('1', 'a:1a,2,3c b:5a,6b,7c,8b');
select * from stat('select a from test_tsvector','a') order by ndoc desc, nentry desc, word;
select * from stat('select a from test_tsvector','a') order by ndoc desc, nentry desc, word collate "C";
word | ndoc | nentry
------+------+--------
b | 2 | 3
a | 2 | 2
(2 rows)
select * from stat('select a from test_tsvector','b') order by ndoc desc, nentry desc, word;
select * from stat('select a from test_tsvector','b') order by ndoc desc, nentry desc, word collate "C";
word | ndoc | nentry
------+------+--------
b | 1 | 2
a | 1 | 1
(2 rows)
select * from stat('select a from test_tsvector','c') order by ndoc desc, nentry desc, word;
select * from stat('select a from test_tsvector','c') order by ndoc desc, nentry desc, word collate "C";
word | ndoc | nentry
------+------+--------
b | 2 | 2
a | 1 | 1
(2 rows)
select * from stat('select a from test_tsvector','d') order by ndoc desc, nentry desc, word;
select * from stat('select a from test_tsvector','d') order by ndoc desc, nentry desc, word collate "C";
word | ndoc | nentry
-----------+------+--------
a | 2 | 2
@ -2254,7 +2254,7 @@ select * from stat('select a from test_tsvector','d') order by ndoc desc, nentry
qwerti | 1 | 1
(8 rows)
select * from stat('select a from test_tsvector','ad') order by ndoc desc, nentry desc, word;
select * from stat('select a from test_tsvector','ad') order by ndoc desc, nentry desc, word collate "C";
word | ndoc | nentry
-----------+------+--------
a | 2 | 4

File diff suppressed because it is too large Load Diff

View File

@ -230,14 +230,14 @@ select rank(' a:1 s:2 d g'::tsvector, 'a & s');
insert into test_tsvector (t) values ('foo bar foo the over foo qq bar');
drop trigger tsvectorupdate on test_tsvector;
select * from stat('select a from test_tsvector') order by ndoc desc, nentry desc, word;
select * from stat('select a from test_tsvector') order by ndoc desc, nentry desc, word collate "C";
insert into test_tsvector values ('1', 'a:1a,2,3b b:5a,6a,7c,8');
insert into test_tsvector values ('1', 'a:1a,2,3c b:5a,6b,7c,8b');
select * from stat('select a from test_tsvector','a') order by ndoc desc, nentry desc, word;
select * from stat('select a from test_tsvector','b') order by ndoc desc, nentry desc, word;
select * from stat('select a from test_tsvector','c') order by ndoc desc, nentry desc, word;
select * from stat('select a from test_tsvector','d') order by ndoc desc, nentry desc, word;
select * from stat('select a from test_tsvector','ad') order by ndoc desc, nentry desc, word;
select * from stat('select a from test_tsvector','a') order by ndoc desc, nentry desc, word collate "C";
select * from stat('select a from test_tsvector','b') order by ndoc desc, nentry desc, word collate "C";
select * from stat('select a from test_tsvector','c') order by ndoc desc, nentry desc, word collate "C";
select * from stat('select a from test_tsvector','d') order by ndoc desc, nentry desc, word collate "C";
select * from stat('select a from test_tsvector','ad') order by ndoc desc, nentry desc, word collate "C";
select to_tsquery('english', 'skies & books');