Commit d70d1191 authored by Tom Lane's avatar Tom Lane

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.
parent 95810ed8
...@@ -4,13 +4,13 @@ SET bytea_output TO escape; ...@@ -4,13 +4,13 @@ SET bytea_output TO escape;
CREATE TABLE test_bytea ( CREATE TABLE test_bytea (
i 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); CREATE INDEX idx_bytea ON test_bytea USING gin (i);
SELECT * FROM test_bytea WHERE i<'abc'::bytea ORDER BY i; SELECT * FROM test_bytea WHERE i<'abc'::bytea ORDER BY i;
i i
----- -----
a a
aaa ab
abb abb
(3 rows) (3 rows)
...@@ -18,7 +18,7 @@ SELECT * FROM test_bytea WHERE i<='abc'::bytea ORDER BY i; ...@@ -18,7 +18,7 @@ SELECT * FROM test_bytea WHERE i<='abc'::bytea ORDER BY i;
i i
----- -----
a a
aaa ab
abb abb
abc abc
(4 rows) (4 rows)
......
...@@ -2,13 +2,13 @@ set enable_seqscan=off; ...@@ -2,13 +2,13 @@ set enable_seqscan=off;
CREATE TABLE test_text ( CREATE TABLE test_text (
i 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); CREATE INDEX idx_text ON test_text USING gin (i);
SELECT * FROM test_text WHERE i<'abc' ORDER BY i; SELECT * FROM test_text WHERE i<'abc' ORDER BY i;
i i
----- -----
a a
aaa ab
abb abb
(3 rows) (3 rows)
...@@ -16,7 +16,7 @@ SELECT * FROM test_text WHERE i<='abc' ORDER BY i; ...@@ -16,7 +16,7 @@ SELECT * FROM test_text WHERE i<='abc' ORDER BY i;
i i
----- -----
a a
aaa ab
abb abb
abc abc
(4 rows) (4 rows)
......
...@@ -2,13 +2,13 @@ set enable_seqscan=off; ...@@ -2,13 +2,13 @@ set enable_seqscan=off;
CREATE TABLE test_varchar ( CREATE TABLE test_varchar (
i 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); CREATE INDEX idx_varchar ON test_varchar USING gin (i);
SELECT * FROM test_varchar WHERE i<'abc'::varchar ORDER BY i; SELECT * FROM test_varchar WHERE i<'abc'::varchar ORDER BY i;
i i
----- -----
a a
aaa ab
abb abb
(3 rows) (3 rows)
...@@ -16,7 +16,7 @@ SELECT * FROM test_varchar WHERE i<='abc'::varchar ORDER BY i; ...@@ -16,7 +16,7 @@ SELECT * FROM test_varchar WHERE i<='abc'::varchar ORDER BY i;
i i
----- -----
a a
aaa ab
abb abb
abc abc
(4 rows) (4 rows)
......
...@@ -6,7 +6,7 @@ CREATE TABLE test_bytea ( ...@@ -6,7 +6,7 @@ CREATE TABLE test_bytea (
i 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); CREATE INDEX idx_bytea ON test_bytea USING gin (i);
......
...@@ -4,7 +4,7 @@ CREATE TABLE test_text ( ...@@ -4,7 +4,7 @@ CREATE TABLE test_text (
i 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); CREATE INDEX idx_text ON test_text USING gin (i);
......
...@@ -4,7 +4,7 @@ CREATE TABLE test_varchar ( ...@@ -4,7 +4,7 @@ CREATE TABLE test_varchar (
i 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); CREATE INDEX idx_varchar ON test_varchar USING gin (i);
......
...@@ -175,7 +175,7 @@ SELECT 'a'::citext >= 'B'::varchar AS t; -- varchar wins. ...@@ -175,7 +175,7 @@ SELECT 'a'::citext >= 'B'::varchar AS t; -- varchar wins.
t t
(1 row) (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. -- conversions to char[] in the c code. Yes, I did do this.
SELECT 'aardvark'::citext = 'aardvark'::citext AS t; SELECT 'aardvark'::citext = 'aardvark'::citext AS t;
t t
...@@ -272,14 +272,14 @@ DETAIL: Key (name)=(A) already exists. ...@@ -272,14 +272,14 @@ DETAIL: Key (name)=(A) already exists.
INSERT INTO try (name) VALUES ('aB'); INSERT INTO try (name) VALUES ('aB');
ERROR: duplicate key value violates unique constraint "try_pkey" ERROR: duplicate key value violates unique constraint "try_pkey"
DETAIL: Key (name)=(aB) already exists. DETAIL: Key (name)=(aB) already exists.
-- Make sure that citext_smaller() and citext_lager() work properly. -- Make sure that citext_smaller() and citext_larger() work properly.
SELECT citext_smaller( 'aa'::citext, 'ab'::citext ) = 'aa' AS t; SELECT citext_smaller( 'ab'::citext, 'ac'::citext ) = 'ab' AS t;
t t
--- ---
t t
(1 row) (1 row)
SELECT citext_smaller( 'AAAA'::citext, 'bbbb'::citext ) = 'AAAA' AS t; SELECT citext_smaller( 'ABC'::citext, 'bbbb'::citext ) = 'ABC' AS t;
t t
--- ---
t t
...@@ -297,13 +297,13 @@ SELECT citext_smaller( 'aardvark'::citext, 'AARDVARK'::citext ) = 'AARDVARK' AS ...@@ -297,13 +297,13 @@ SELECT citext_smaller( 'aardvark'::citext, 'AARDVARK'::citext ) = 'AARDVARK' AS
t t
(1 row) (1 row)
SELECT citext_larger( 'aa'::citext, 'ab'::citext ) = 'ab' AS t; SELECT citext_larger( 'ab'::citext, 'ac'::citext ) = 'ac' AS t;
t t
--- ---
t t
(1 row) (1 row)
SELECT citext_larger( 'AAAA'::citext, 'bbbb'::citext ) = 'bbbb' AS t; SELECT citext_larger( 'ABC'::citext, 'bbbb'::citext ) = 'bbbb' AS t;
t t
--- ---
t t
...@@ -320,18 +320,17 @@ CREATE TEMP TABLE srt ( ...@@ -320,18 +320,17 @@ CREATE TEMP TABLE srt (
name CITEXT name CITEXT
); );
INSERT INTO srt (name) INSERT INTO srt (name)
VALUES ('aardvark'), VALUES ('abb'),
('AAA'), ('ABA'),
('aba'),
('ABC'), ('ABC'),
('abd'); ('abd');
CREATE INDEX srt_name ON srt (name); CREATE INDEX srt_name ON srt (name);
-- Check the min() and max() aggregates, with and without index. -- Check the min() and max() aggregates, with and without index.
set enable_seqscan = off; set enable_seqscan = off;
SELECT MIN(name) AS "AAA" FROM srt; SELECT MIN(name) AS "ABA" FROM srt;
AAA ABA
----- -----
AAA ABA
(1 row) (1 row)
SELECT MAX(name) AS abd FROM srt; SELECT MAX(name) AS abd FROM srt;
...@@ -342,10 +341,10 @@ SELECT MAX(name) AS abd FROM srt; ...@@ -342,10 +341,10 @@ SELECT MAX(name) AS abd FROM srt;
reset enable_seqscan; reset enable_seqscan;
set enable_indexscan = off; set enable_indexscan = off;
SELECT MIN(name) AS "AAA" FROM srt; SELECT MIN(name) AS "ABA" FROM srt;
AAA ABA
----- -----
AAA ABA
(1 row) (1 row)
SELECT MAX(name) AS abd FROM srt; SELECT MAX(name) AS abd FROM srt;
...@@ -359,161 +358,145 @@ reset enable_indexscan; ...@@ -359,161 +358,145 @@ reset enable_indexscan;
set enable_seqscan = off; set enable_seqscan = off;
SELECT name FROM srt ORDER BY name; SELECT name FROM srt ORDER BY name;
name name
---------- ------
AAA ABA
aardvark abb
aba
ABC ABC
abd abd
(5 rows) (4 rows)
reset enable_seqscan; reset enable_seqscan;
set enable_indexscan = off; set enable_indexscan = off;
SELECT name FROM srt ORDER BY name; SELECT name FROM srt ORDER BY name;
name name
---------- ------
AAA ABA
aardvark abb
aba
ABC ABC
abd abd
(5 rows) (4 rows)
reset enable_indexscan; reset enable_indexscan;
-- Test assignment casts. -- Test assignment casts.
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::text; SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::text;
aaa aba
----- -----
aaa aba
(1 row) (1 row)
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::varchar; SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::varchar;
aaa aba
----- -----
aaa aba
(1 row) (1 row)
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::bpchar; SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::bpchar;
aaa aba
----- -----
aaa aba
(1 row) (1 row)
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'; SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA';
aaa aba
----- -----
aaa aba
(1 row) (1 row)
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::citext; SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::citext;
aaa aba
----- -----
aaa aba
(1 row) (1 row)
-- LIKE should be case-insensitive -- LIKE should be case-insensitive
SELECT name FROM srt WHERE name LIKE '%a%' ORDER BY name; SELECT name FROM srt WHERE name LIKE '%a%' ORDER BY name;
name name
---------- ------
AAA ABA
aardvark abb
aba
ABC ABC
abd abd
(5 rows) (4 rows)
SELECT name FROM srt WHERE name NOT LIKE '%b%' ORDER BY name; SELECT name FROM srt WHERE name NOT LIKE '%b%' ORDER BY name;
name name
---------- ------
AAA (0 rows)
aardvark
(2 rows)
SELECT name FROM srt WHERE name LIKE '%A%' ORDER BY name; SELECT name FROM srt WHERE name LIKE '%A%' ORDER BY name;
name name
---------- ------
AAA ABA
aardvark abb
aba
ABC ABC
abd abd
(5 rows) (4 rows)
SELECT name FROM srt WHERE name NOT LIKE '%B%' ORDER BY name; SELECT name FROM srt WHERE name NOT LIKE '%B%' ORDER BY name;
name name
---------- ------
AAA (0 rows)
aardvark
(2 rows)
-- ~~ should be case-insensitive -- ~~ should be case-insensitive
SELECT name FROM srt WHERE name ~~ '%a%' ORDER BY name; SELECT name FROM srt WHERE name ~~ '%a%' ORDER BY name;
name name
---------- ------
AAA ABA
aardvark abb
aba
ABC ABC
abd abd
(5 rows) (4 rows)
SELECT name FROM srt WHERE name !~~ '%b%' ORDER BY name; SELECT name FROM srt WHERE name !~~ '%b%' ORDER BY name;
name name
---------- ------
AAA (0 rows)
aardvark
(2 rows)
SELECT name FROM srt WHERE name ~~ '%A%' ORDER BY name; SELECT name FROM srt WHERE name ~~ '%A%' ORDER BY name;
name name
---------- ------
AAA ABA
aardvark abb
aba
ABC ABC
abd abd
(5 rows) (4 rows)
SELECT name FROM srt WHERE name !~~ '%B%' ORDER BY name; SELECT name FROM srt WHERE name !~~ '%B%' ORDER BY name;
name name
---------- ------
AAA (0 rows)
aardvark
(2 rows)
-- ~ should be case-insensitive -- ~ should be case-insensitive
SELECT name FROM srt WHERE name ~ '^a' ORDER BY name; SELECT name FROM srt WHERE name ~ '^a' ORDER BY name;
name name
---------- ------
AAA ABA
aardvark abb
aba
ABC ABC
abd abd
(5 rows) (4 rows)
SELECT name FROM srt WHERE name !~ 'a$' ORDER BY name; SELECT name FROM srt WHERE name !~ 'a$' ORDER BY name;
name name
---------- ------
aardvark abb
ABC ABC
abd abd
(3 rows) (3 rows)
SELECT name FROM srt WHERE name ~ '^A' ORDER BY name; SELECT name FROM srt WHERE name ~ '^A' ORDER BY name;
name name
---------- ------
AAA ABA
aardvark abb
aba
ABC ABC
abd abd
(5 rows) (4 rows)
SELECT name FROM srt WHERE name !~ 'A$' ORDER BY name; SELECT name FROM srt WHERE name !~ 'A$' ORDER BY name;
name name
---------- ------
aardvark abb
ABC ABC
abd abd
(3 rows) (3 rows)
...@@ -522,16 +505,14 @@ SELECT name FROM srt WHERE name !~ 'A$' ORDER BY name; ...@@ -522,16 +505,14 @@ SELECT name FROM srt WHERE name !~ 'A$' ORDER BY name;
SELECT name FROM srt WHERE name SIMILAR TO '%a.*'; SELECT name FROM srt WHERE name SIMILAR TO '%a.*';
name name
------ ------
AAA ABA
aba (1 row)
(2 rows)
SELECT name FROM srt WHERE name SIMILAR TO '%A.*'; SELECT name FROM srt WHERE name SIMILAR TO '%A.*';
name name
------ ------
AAA ABA
aba (1 row)
(2 rows)
-- Explicit casts. -- Explicit casts.
SELECT true::citext = 'true' AS t; SELECT true::citext = 'true' AS t;
...@@ -1503,8 +1484,7 @@ SELECT bit_length( name ) = bit_length( name::text ) AS t FROM srt; ...@@ -1503,8 +1484,7 @@ SELECT bit_length( name ) = bit_length( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT textlen( name ) = textlen( name::text ) AS t FROM srt; SELECT textlen( name ) = textlen( name::text ) AS t FROM srt;
t t
...@@ -1513,8 +1493,7 @@ SELECT textlen( name ) = textlen( name::text ) AS t FROM srt; ...@@ -1513,8 +1493,7 @@ SELECT textlen( name ) = textlen( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT char_length( name ) = char_length( name::text ) AS t FROM srt; SELECT char_length( name ) = char_length( name::text ) AS t FROM srt;
t t
...@@ -1523,8 +1502,7 @@ SELECT char_length( name ) = char_length( name::text ) AS t FROM srt; ...@@ -1523,8 +1502,7 @@ SELECT char_length( name ) = char_length( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT lower( name ) = lower( name::text ) AS t FROM srt; SELECT lower( name ) = lower( name::text ) AS t FROM srt;
t t
...@@ -1533,8 +1511,7 @@ SELECT lower( name ) = lower( name::text ) AS t FROM srt; ...@@ -1533,8 +1511,7 @@ SELECT lower( name ) = lower( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT octet_length( name ) = octet_length( name::text ) AS t FROM srt; SELECT octet_length( name ) = octet_length( name::text ) AS t FROM srt;
t t
...@@ -1543,8 +1520,7 @@ SELECT octet_length( name ) = octet_length( name::text ) AS t FROM srt; ...@@ -1543,8 +1520,7 @@ SELECT octet_length( name ) = octet_length( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT overlay( name placing 'hom' from 2 for 4) = overlay( name::text placing 'hom' from 2 for 4) AS t FROM srt; SELECT overlay( name placing 'hom' from 2 for 4) = overlay( name::text placing 'hom' from 2 for 4) AS t FROM srt;
t t
...@@ -1553,8 +1529,7 @@ SELECT overlay( name placing 'hom' from 2 for 4) = overlay( name::text placing ' ...@@ -1553,8 +1529,7 @@ SELECT overlay( name placing 'hom' from 2 for 4) = overlay( name::text placing '
t t
t t
t t
t (4 rows)
(5 rows)
SELECT position( 'a' IN name ) = position( 'a' IN name::text ) AS t FROM srt; SELECT position( 'a' IN name ) = position( 'a' IN name::text ) AS t FROM srt;
t t
...@@ -1563,8 +1538,7 @@ SELECT position( 'a' IN name ) = position( 'a' IN name::text ) AS t FROM srt; ...@@ -1563,8 +1538,7 @@ SELECT position( 'a' IN name ) = position( 'a' IN name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT substr('alphabet'::citext, 3) = 'phabet' AS t; SELECT substr('alphabet'::citext, 3) = 'phabet' AS t;
t t
...@@ -1645,8 +1619,7 @@ SELECT upper( name ) = upper( name::text ) AS t FROM srt; ...@@ -1645,8 +1619,7 @@ SELECT upper( name ) = upper( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
-- Table 9-6. Other String Functions. -- Table 9-6. Other String Functions.
SELECT ascii( name ) = ascii( name::text ) AS t FROM srt; SELECT ascii( name ) = ascii( name::text ) AS t FROM srt;
...@@ -1656,8 +1629,7 @@ SELECT ascii( name ) = ascii( name::text ) AS t FROM srt; ...@@ -1656,8 +1629,7 @@ SELECT ascii( name ) = ascii( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT btrim(' trim'::citext ) = 'trim' AS t; SELECT btrim(' trim'::citext ) = 'trim' AS t;
t t
...@@ -1698,8 +1670,7 @@ SELECT convert_from( name::bytea, 'SQL_ASCII' ) = convert_from( name::text::byte ...@@ -1698,8 +1670,7 @@ SELECT convert_from( name::bytea, 'SQL_ASCII' ) = convert_from( name::text::byte
t t
t t
t t
t (4 rows)
(5 rows)
SELECT decode('MTIzAAE='::citext, 'base64') = decode('MTIzAAE='::text, 'base64') AS t; SELECT decode('MTIzAAE='::citext, 'base64') = decode('MTIzAAE='::text, 'base64') AS t;
t t
...@@ -1721,8 +1692,7 @@ SELECT length( name ) = length( name::text ) AS t FROM srt; ...@@ -1721,8 +1692,7 @@ SELECT length( name ) = length( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT lpad('hi'::citext, 5 ) = ' hi' AS t; SELECT lpad('hi'::citext, 5 ) = ' hi' AS t;
t t
...@@ -1779,8 +1749,7 @@ SELECT md5( name ) = md5( name::text ) AS t FROM srt; ...@@ -1779,8 +1749,7 @@ SELECT md5( name ) = md5( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
-- pg_client_encoding() takes no args and returns name. -- pg_client_encoding() takes no args and returns name.
SELECT quote_ident( name ) = quote_ident( name::text ) AS t FROM srt; SELECT quote_ident( name ) = quote_ident( name::text ) AS t FROM srt;
...@@ -1790,8 +1759,7 @@ SELECT quote_ident( name ) = quote_ident( name::text ) AS t FROM srt; ...@@ -1790,8 +1759,7 @@ SELECT quote_ident( name ) = quote_ident( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT quote_literal( name ) = quote_literal( name::text ) AS t FROM srt; SELECT quote_literal( name ) = quote_literal( name::text ) AS t FROM srt;
t t
...@@ -1800,8 +1768,7 @@ SELECT quote_literal( name ) = quote_literal( name::text ) AS t FROM srt; ...@@ -1800,8 +1768,7 @@ SELECT quote_literal( name ) = quote_literal( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT regexp_matches('foobarbequebaz'::citext, '(bar)(beque)') = ARRAY[ 'bar', 'beque' ] AS t; SELECT regexp_matches('foobarbequebaz'::citext, '(bar)(beque)') = ARRAY[ 'bar', 'beque' ] AS t;
t t
...@@ -2106,37 +2073,37 @@ SELECT split_part('abcTdefTghi', 't'::citext, 2) = 'def' AS t; ...@@ -2106,37 +2073,37 @@ SELECT split_part('abcTdefTghi', 't'::citext, 2) = 'def' AS t;
t t
(1 row) (1 row)
SELECT strpos('high'::citext, 'ig' ) = 2 AS t; SELECT strpos('high'::citext, 'gh' ) = 3 AS t;
t t
--- ---
t t
(1 row) (1 row)
SELECT strpos('high', 'ig'::citext) = 2 AS t; SELECT strpos('high', 'gh'::citext) = 3 AS t;
t t
--- ---
t t
(1 row) (1 row)
SELECT strpos('high'::citext, 'ig'::citext) = 2 AS t; SELECT strpos('high'::citext, 'gh'::citext) = 3 AS t;
t t
--- ---
t t
(1 row) (1 row)
SELECT strpos('high'::citext, 'IG' ) = 2 AS t; SELECT strpos('high'::citext, 'GH' ) = 3 AS t;
t t
--- ---
t t
(1 row) (1 row)
SELECT strpos('high', 'IG'::citext) = 2 AS t; SELECT strpos('high', 'GH'::citext) = 3 AS t;
t t
--- ---
t t
(1 row) (1 row)
SELECT strpos('high'::citext, 'IG'::citext) = 2 AS t; SELECT strpos('high'::citext, 'GH'::citext) = 3 AS t;
t t
--- ---
t t
...@@ -2270,8 +2237,7 @@ SELECT like_escape( name, '' ) = like_escape( name::text, '' ) AS t FROM srt; ...@@ -2270,8 +2237,7 @@ SELECT like_escape( name, '' ) = like_escape( name::text, '' ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT like_escape( name::text, ''::citext ) = like_escape( name::text, '' ) AS t FROM srt; SELECT like_escape( name::text, ''::citext ) = like_escape( name::text, '' ) AS t FROM srt;
t t
...@@ -2280,8 +2246,7 @@ SELECT like_escape( name::text, ''::citext ) = like_escape( name::text, '' ) AS ...@@ -2280,8 +2246,7 @@ SELECT like_escape( name::text, ''::citext ) = like_escape( name::text, '' ) AS
t t
t t
t t
t (4 rows)
(5 rows)
-- Ensure correct behavior for citext with materialized views. -- Ensure correct behavior for citext with materialized views.
CREATE TABLE citext_table ( CREATE TABLE citext_table (
......
...@@ -175,7 +175,7 @@ SELECT 'a'::citext >= 'B'::varchar AS t; -- varchar wins. ...@@ -175,7 +175,7 @@ SELECT 'a'::citext >= 'B'::varchar AS t; -- varchar wins.
f f
(1 row) (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. -- conversions to char[] in the c code. Yes, I did do this.
SELECT 'aardvark'::citext = 'aardvark'::citext AS t; SELECT 'aardvark'::citext = 'aardvark'::citext AS t;
t t
...@@ -272,14 +272,14 @@ DETAIL: Key (name)=(A) already exists. ...@@ -272,14 +272,14 @@ DETAIL: Key (name)=(A) already exists.
INSERT INTO try (name) VALUES ('aB'); INSERT INTO try (name) VALUES ('aB');
ERROR: duplicate key value violates unique constraint "try_pkey" ERROR: duplicate key value violates unique constraint "try_pkey"
DETAIL: Key (name)=(aB) already exists. DETAIL: Key (name)=(aB) already exists.
-- Make sure that citext_smaller() and citext_lager() work properly. -- Make sure that citext_smaller() and citext_larger() work properly.
SELECT citext_smaller( 'aa'::citext, 'ab'::citext ) = 'aa' AS t; SELECT citext_smaller( 'ab'::citext, 'ac'::citext ) = 'ab' AS t;
t t
--- ---
t t
(1 row) (1 row)
SELECT citext_smaller( 'AAAA'::citext, 'bbbb'::citext ) = 'AAAA' AS t; SELECT citext_smaller( 'ABC'::citext, 'bbbb'::citext ) = 'ABC' AS t;
t t
--- ---
t t
...@@ -297,13 +297,13 @@ SELECT citext_smaller( 'aardvark'::citext, 'AARDVARK'::citext ) = 'AARDVARK' AS ...@@ -297,13 +297,13 @@ SELECT citext_smaller( 'aardvark'::citext, 'AARDVARK'::citext ) = 'AARDVARK' AS
t t
(1 row) (1 row)
SELECT citext_larger( 'aa'::citext, 'ab'::citext ) = 'ab' AS t; SELECT citext_larger( 'ab'::citext, 'ac'::citext ) = 'ac' AS t;
t t
--- ---
t t
(1 row) (1 row)
SELECT citext_larger( 'AAAA'::citext, 'bbbb'::citext ) = 'bbbb' AS t; SELECT citext_larger( 'ABC'::citext, 'bbbb'::citext ) = 'bbbb' AS t;
t t
--- ---
t t
...@@ -320,18 +320,17 @@ CREATE TEMP TABLE srt ( ...@@ -320,18 +320,17 @@ CREATE TEMP TABLE srt (
name CITEXT name CITEXT
); );
INSERT INTO srt (name) INSERT INTO srt (name)
VALUES ('aardvark'), VALUES ('abb'),
('AAA'), ('ABA'),
('aba'),
('ABC'), ('ABC'),
('abd'); ('abd');
CREATE INDEX srt_name ON srt (name); CREATE INDEX srt_name ON srt (name);
-- Check the min() and max() aggregates, with and without index. -- Check the min() and max() aggregates, with and without index.
set enable_seqscan = off; set enable_seqscan = off;
SELECT MIN(name) AS "AAA" FROM srt; SELECT MIN(name) AS "ABA" FROM srt;
AAA ABA
----- -----
AAA ABA
(1 row) (1 row)
SELECT MAX(name) AS abd FROM srt; SELECT MAX(name) AS abd FROM srt;
...@@ -342,10 +341,10 @@ SELECT MAX(name) AS abd FROM srt; ...@@ -342,10 +341,10 @@ SELECT MAX(name) AS abd FROM srt;
reset enable_seqscan; reset enable_seqscan;
set enable_indexscan = off; set enable_indexscan = off;
SELECT MIN(name) AS "AAA" FROM srt; SELECT MIN(name) AS "ABA" FROM srt;
AAA ABA
----- -----
AAA ABA
(1 row) (1 row)
SELECT MAX(name) AS abd FROM srt; SELECT MAX(name) AS abd FROM srt;
...@@ -359,161 +358,145 @@ reset enable_indexscan; ...@@ -359,161 +358,145 @@ reset enable_indexscan;
set enable_seqscan = off; set enable_seqscan = off;
SELECT name FROM srt ORDER BY name; SELECT name FROM srt ORDER BY name;
name name
---------- ------
AAA ABA
aardvark abb
aba
ABC ABC
abd abd
(5 rows) (4 rows)
reset enable_seqscan; reset enable_seqscan;
set enable_indexscan = off; set enable_indexscan = off;
SELECT name FROM srt ORDER BY name; SELECT name FROM srt ORDER BY name;
name name
---------- ------
AAA ABA
aardvark abb
aba
ABC ABC
abd abd
(5 rows) (4 rows)
reset enable_indexscan; reset enable_indexscan;
-- Test assignment casts. -- Test assignment casts.
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::text; SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::text;
aaa aba
----- -----
aaa aba
(1 row) (1 row)
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::varchar; SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::varchar;
aaa aba
----- -----
aaa aba
(1 row) (1 row)
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::bpchar; SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::bpchar;
aaa aba
----- -----
aaa aba
(1 row) (1 row)
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'; SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA';
aaa aba
----- -----
aaa aba
(1 row) (1 row)
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::citext; SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::citext;
aaa aba
----- -----
aaa aba
(1 row) (1 row)
-- LIKE should be case-insensitive -- LIKE should be case-insensitive
SELECT name FROM srt WHERE name LIKE '%a%' ORDER BY name; SELECT name FROM srt WHERE name LIKE '%a%' ORDER BY name;
name name
---------- ------
AAA ABA
aardvark abb
aba
ABC ABC
abd abd
(5 rows) (4 rows)
SELECT name FROM srt WHERE name NOT LIKE '%b%' ORDER BY name; SELECT name FROM srt WHERE name NOT LIKE '%b%' ORDER BY name;
name name
---------- ------
AAA (0 rows)
aardvark
(2 rows)
SELECT name FROM srt WHERE name LIKE '%A%' ORDER BY name; SELECT name FROM srt WHERE name LIKE '%A%' ORDER BY name;
name name
---------- ------
AAA ABA
aardvark abb
aba
ABC ABC
abd abd
(5 rows) (4 rows)
SELECT name FROM srt WHERE name NOT LIKE '%B%' ORDER BY name; SELECT name FROM srt WHERE name NOT LIKE '%B%' ORDER BY name;
name name
---------- ------
AAA (0 rows)
aardvark
(2 rows)
-- ~~ should be case-insensitive -- ~~ should be case-insensitive
SELECT name FROM srt WHERE name ~~ '%a%' ORDER BY name; SELECT name FROM srt WHERE name ~~ '%a%' ORDER BY name;
name name
---------- ------
AAA ABA
aardvark abb
aba
ABC ABC
abd abd
(5 rows) (4 rows)
SELECT name FROM srt WHERE name !~~ '%b%' ORDER BY name; SELECT name FROM srt WHERE name !~~ '%b%' ORDER BY name;
name name
---------- ------
AAA (0 rows)
aardvark
(2 rows)
SELECT name FROM srt WHERE name ~~ '%A%' ORDER BY name; SELECT name FROM srt WHERE name ~~ '%A%' ORDER BY name;
name name
---------- ------
AAA ABA
aardvark abb
aba
ABC ABC
abd abd
(5 rows) (4 rows)
SELECT name FROM srt WHERE name !~~ '%B%' ORDER BY name; SELECT name FROM srt WHERE name !~~ '%B%' ORDER BY name;
name name
---------- ------
AAA (0 rows)
aardvark
(2 rows)
-- ~ should be case-insensitive -- ~ should be case-insensitive
SELECT name FROM srt WHERE name ~ '^a' ORDER BY name; SELECT name FROM srt WHERE name ~ '^a' ORDER BY name;
name name
---------- ------
AAA ABA
aardvark abb
aba
ABC ABC
abd abd
(5 rows) (4 rows)
SELECT name FROM srt WHERE name !~ 'a$' ORDER BY name; SELECT name FROM srt WHERE name !~ 'a$' ORDER BY name;
name name
---------- ------
aardvark abb
ABC ABC
abd abd
(3 rows) (3 rows)
SELECT name FROM srt WHERE name ~ '^A' ORDER BY name; SELECT name FROM srt WHERE name ~ '^A' ORDER BY name;
name name
---------- ------
AAA ABA
aardvark abb
aba
ABC ABC
abd abd
(5 rows) (4 rows)
SELECT name FROM srt WHERE name !~ 'A$' ORDER BY name; SELECT name FROM srt WHERE name !~ 'A$' ORDER BY name;
name name
---------- ------
aardvark abb
ABC ABC
abd abd
(3 rows) (3 rows)
...@@ -522,16 +505,14 @@ SELECT name FROM srt WHERE name !~ 'A$' ORDER BY name; ...@@ -522,16 +505,14 @@ SELECT name FROM srt WHERE name !~ 'A$' ORDER BY name;
SELECT name FROM srt WHERE name SIMILAR TO '%a.*'; SELECT name FROM srt WHERE name SIMILAR TO '%a.*';
name name
------ ------
AAA ABA
aba (1 row)
(2 rows)
SELECT name FROM srt WHERE name SIMILAR TO '%A.*'; SELECT name FROM srt WHERE name SIMILAR TO '%A.*';
name name
------ ------
AAA ABA
aba (1 row)
(2 rows)
-- Explicit casts. -- Explicit casts.
SELECT true::citext = 'true' AS t; SELECT true::citext = 'true' AS t;
...@@ -1503,8 +1484,7 @@ SELECT bit_length( name ) = bit_length( name::text ) AS t FROM srt; ...@@ -1503,8 +1484,7 @@ SELECT bit_length( name ) = bit_length( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT textlen( name ) = textlen( name::text ) AS t FROM srt; SELECT textlen( name ) = textlen( name::text ) AS t FROM srt;
t t
...@@ -1513,8 +1493,7 @@ SELECT textlen( name ) = textlen( name::text ) AS t FROM srt; ...@@ -1513,8 +1493,7 @@ SELECT textlen( name ) = textlen( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT char_length( name ) = char_length( name::text ) AS t FROM srt; SELECT char_length( name ) = char_length( name::text ) AS t FROM srt;
t t
...@@ -1523,8 +1502,7 @@ SELECT char_length( name ) = char_length( name::text ) AS t FROM srt; ...@@ -1523,8 +1502,7 @@ SELECT char_length( name ) = char_length( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT lower( name ) = lower( name::text ) AS t FROM srt; SELECT lower( name ) = lower( name::text ) AS t FROM srt;
t t
...@@ -1533,8 +1511,7 @@ SELECT lower( name ) = lower( name::text ) AS t FROM srt; ...@@ -1533,8 +1511,7 @@ SELECT lower( name ) = lower( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT octet_length( name ) = octet_length( name::text ) AS t FROM srt; SELECT octet_length( name ) = octet_length( name::text ) AS t FROM srt;
t t
...@@ -1543,8 +1520,7 @@ SELECT octet_length( name ) = octet_length( name::text ) AS t FROM srt; ...@@ -1543,8 +1520,7 @@ SELECT octet_length( name ) = octet_length( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT overlay( name placing 'hom' from 2 for 4) = overlay( name::text placing 'hom' from 2 for 4) AS t FROM srt; SELECT overlay( name placing 'hom' from 2 for 4) = overlay( name::text placing 'hom' from 2 for 4) AS t FROM srt;
t t
...@@ -1553,8 +1529,7 @@ SELECT overlay( name placing 'hom' from 2 for 4) = overlay( name::text placing ' ...@@ -1553,8 +1529,7 @@ SELECT overlay( name placing 'hom' from 2 for 4) = overlay( name::text placing '
t t
t t
t t
t (4 rows)
(5 rows)
SELECT position( 'a' IN name ) = position( 'a' IN name::text ) AS t FROM srt; SELECT position( 'a' IN name ) = position( 'a' IN name::text ) AS t FROM srt;
t t
...@@ -1563,8 +1538,7 @@ SELECT position( 'a' IN name ) = position( 'a' IN name::text ) AS t FROM srt; ...@@ -1563,8 +1538,7 @@ SELECT position( 'a' IN name ) = position( 'a' IN name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT substr('alphabet'::citext, 3) = 'phabet' AS t; SELECT substr('alphabet'::citext, 3) = 'phabet' AS t;
t t
...@@ -1645,8 +1619,7 @@ SELECT upper( name ) = upper( name::text ) AS t FROM srt; ...@@ -1645,8 +1619,7 @@ SELECT upper( name ) = upper( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
-- Table 9-6. Other String Functions. -- Table 9-6. Other String Functions.
SELECT ascii( name ) = ascii( name::text ) AS t FROM srt; SELECT ascii( name ) = ascii( name::text ) AS t FROM srt;
...@@ -1656,8 +1629,7 @@ SELECT ascii( name ) = ascii( name::text ) AS t FROM srt; ...@@ -1656,8 +1629,7 @@ SELECT ascii( name ) = ascii( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT btrim(' trim'::citext ) = 'trim' AS t; SELECT btrim(' trim'::citext ) = 'trim' AS t;
t t
...@@ -1698,8 +1670,7 @@ SELECT convert_from( name::bytea, 'SQL_ASCII' ) = convert_from( name::text::byte ...@@ -1698,8 +1670,7 @@ SELECT convert_from( name::bytea, 'SQL_ASCII' ) = convert_from( name::text::byte
t t
t t
t t
t (4 rows)
(5 rows)
SELECT decode('MTIzAAE='::citext, 'base64') = decode('MTIzAAE='::text, 'base64') AS t; SELECT decode('MTIzAAE='::citext, 'base64') = decode('MTIzAAE='::text, 'base64') AS t;
t t
...@@ -1721,8 +1692,7 @@ SELECT length( name ) = length( name::text ) AS t FROM srt; ...@@ -1721,8 +1692,7 @@ SELECT length( name ) = length( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT lpad('hi'::citext, 5 ) = ' hi' AS t; SELECT lpad('hi'::citext, 5 ) = ' hi' AS t;
t t
...@@ -1779,8 +1749,7 @@ SELECT md5( name ) = md5( name::text ) AS t FROM srt; ...@@ -1779,8 +1749,7 @@ SELECT md5( name ) = md5( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
-- pg_client_encoding() takes no args and returns name. -- pg_client_encoding() takes no args and returns name.
SELECT quote_ident( name ) = quote_ident( name::text ) AS t FROM srt; SELECT quote_ident( name ) = quote_ident( name::text ) AS t FROM srt;
...@@ -1790,8 +1759,7 @@ SELECT quote_ident( name ) = quote_ident( name::text ) AS t FROM srt; ...@@ -1790,8 +1759,7 @@ SELECT quote_ident( name ) = quote_ident( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT quote_literal( name ) = quote_literal( name::text ) AS t FROM srt; SELECT quote_literal( name ) = quote_literal( name::text ) AS t FROM srt;
t t
...@@ -1800,8 +1768,7 @@ SELECT quote_literal( name ) = quote_literal( name::text ) AS t FROM srt; ...@@ -1800,8 +1768,7 @@ SELECT quote_literal( name ) = quote_literal( name::text ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT regexp_matches('foobarbequebaz'::citext, '(bar)(beque)') = ARRAY[ 'bar', 'beque' ] AS t; SELECT regexp_matches('foobarbequebaz'::citext, '(bar)(beque)') = ARRAY[ 'bar', 'beque' ] AS t;
t t
...@@ -2106,37 +2073,37 @@ SELECT split_part('abcTdefTghi', 't'::citext, 2) = 'def' AS t; ...@@ -2106,37 +2073,37 @@ SELECT split_part('abcTdefTghi', 't'::citext, 2) = 'def' AS t;
t t
(1 row) (1 row)
SELECT strpos('high'::citext, 'ig' ) = 2 AS t; SELECT strpos('high'::citext, 'gh' ) = 3 AS t;
t t
--- ---
t t
(1 row) (1 row)
SELECT strpos('high', 'ig'::citext) = 2 AS t; SELECT strpos('high', 'gh'::citext) = 3 AS t;
t t
--- ---
t t
(1 row) (1 row)
SELECT strpos('high'::citext, 'ig'::citext) = 2 AS t; SELECT strpos('high'::citext, 'gh'::citext) = 3 AS t;
t t
--- ---
t t
(1 row) (1 row)
SELECT strpos('high'::citext, 'IG' ) = 2 AS t; SELECT strpos('high'::citext, 'GH' ) = 3 AS t;
t t
--- ---
t t
(1 row) (1 row)
SELECT strpos('high', 'IG'::citext) = 2 AS t; SELECT strpos('high', 'GH'::citext) = 3 AS t;
t t
--- ---
t t
(1 row) (1 row)
SELECT strpos('high'::citext, 'IG'::citext) = 2 AS t; SELECT strpos('high'::citext, 'GH'::citext) = 3 AS t;
t t
--- ---
t t
...@@ -2270,8 +2237,7 @@ SELECT like_escape( name, '' ) = like_escape( name::text, '' ) AS t FROM srt; ...@@ -2270,8 +2237,7 @@ SELECT like_escape( name, '' ) = like_escape( name::text, '' ) AS t FROM srt;
t t
t t
t t
t (4 rows)
(5 rows)
SELECT like_escape( name::text, ''::citext ) = like_escape( name::text, '' ) AS t FROM srt; SELECT like_escape( name::text, ''::citext ) = like_escape( name::text, '' ) AS t FROM srt;
t t
...@@ -2280,8 +2246,7 @@ SELECT like_escape( name::text, ''::citext ) = like_escape( name::text, '' ) AS ...@@ -2280,8 +2246,7 @@ SELECT like_escape( name::text, ''::citext ) = like_escape( name::text, '' ) AS
t t
t t
t t
t (4 rows)
(5 rows)
-- Ensure correct behavior for citext with materialized views. -- Ensure correct behavior for citext with materialized views.
CREATE TABLE citext_table ( CREATE TABLE citext_table (
......
...@@ -72,7 +72,7 @@ SELECT 'B'::citext <= 'a'::varchar AS t; -- varchar wins. ...@@ -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.
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. -- conversions to char[] in the c code. Yes, I did do this.
SELECT 'aardvark'::citext = 'aardvark'::citext AS t; SELECT 'aardvark'::citext = 'aardvark'::citext AS t;
...@@ -104,14 +104,14 @@ INSERT INTO try (name) VALUES ('a'); ...@@ -104,14 +104,14 @@ INSERT INTO try (name) VALUES ('a');
INSERT INTO try (name) VALUES ('A'); INSERT INTO try (name) VALUES ('A');
INSERT INTO try (name) VALUES ('aB'); INSERT INTO try (name) VALUES ('aB');
-- Make sure that citext_smaller() and citext_lager() work properly. -- Make sure that citext_smaller() and citext_larger() work properly.
SELECT citext_smaller( 'aa'::citext, 'ab'::citext ) = 'aa' AS t; SELECT citext_smaller( 'ab'::citext, 'ac'::citext ) = 'ab' AS t;
SELECT citext_smaller( 'AAAA'::citext, 'bbbb'::citext ) = 'AAAA' 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, 'Aaba'::citext ) = 'Aaba' AS t;
SELECT citext_smaller( 'aardvark'::citext, 'AARDVARK'::citext ) = 'AARDVARK' 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( 'ab'::citext, 'ac'::citext ) = 'ac' AS t;
SELECT citext_larger( 'AAAA'::citext, 'bbbb'::citext ) = 'bbbb' AS t; SELECT citext_larger( 'ABC'::citext, 'bbbb'::citext ) = 'bbbb' AS t;
SELECT citext_larger( 'aardvark'::citext, 'Aaba'::citext ) = 'aardvark' AS t; SELECT citext_larger( 'aardvark'::citext, 'Aaba'::citext ) = 'aardvark' AS t;
-- Test aggregate functions and sort ordering -- Test aggregate functions and sort ordering
...@@ -121,9 +121,8 @@ CREATE TEMP TABLE srt ( ...@@ -121,9 +121,8 @@ CREATE TEMP TABLE srt (
); );
INSERT INTO srt (name) INSERT INTO srt (name)
VALUES ('aardvark'), VALUES ('abb'),
('AAA'), ('ABA'),
('aba'),
('ABC'), ('ABC'),
('abd'); ('abd');
...@@ -131,11 +130,11 @@ CREATE INDEX srt_name ON srt (name); ...@@ -131,11 +130,11 @@ CREATE INDEX srt_name ON srt (name);
-- Check the min() and max() aggregates, with and without index. -- Check the min() and max() aggregates, with and without index.
set enable_seqscan = off; 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; SELECT MAX(name) AS abd FROM srt;
reset enable_seqscan; reset enable_seqscan;
set enable_indexscan = off; 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; SELECT MAX(name) AS abd FROM srt;
reset enable_indexscan; reset enable_indexscan;
...@@ -148,11 +147,11 @@ SELECT name FROM srt ORDER BY name; ...@@ -148,11 +147,11 @@ SELECT name FROM srt ORDER BY name;
reset enable_indexscan; reset enable_indexscan;
-- Test assignment casts. -- Test assignment casts.
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::text; SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::text;
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::varchar; SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::varchar;
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::bpchar; SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::bpchar;
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'; SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA';
SELECT LOWER(name) as aaa FROM srt WHERE name = 'AAA'::citext; SELECT LOWER(name) as aba FROM srt WHERE name = 'ABA'::citext;
-- LIKE should be case-insensitive -- LIKE should be case-insensitive
SELECT name FROM srt WHERE name LIKE '%a%' ORDER BY name; SELECT name FROM srt WHERE name LIKE '%a%' ORDER BY name;
...@@ -657,12 +656,12 @@ SELECT split_part('abcTdefTghi'::citext, 't', 2) = 'def' AS t; ...@@ -657,12 +656,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'::citext, 't'::citext, 2) = 'def' AS t;
SELECT split_part('abcTdefTghi', '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'::citext, 'gh' ) = 3 AS t;
SELECT strpos('high', 'ig'::citext) = 2 AS t; SELECT strpos('high', 'gh'::citext) = 3 AS t;
SELECT strpos('high'::citext, 'ig'::citext) = 2 AS t; SELECT strpos('high'::citext, 'gh'::citext) = 3 AS t;
SELECT strpos('high'::citext, 'IG' ) = 2 AS t; SELECT strpos('high'::citext, 'GH' ) = 3 AS t;
SELECT strpos('high', 'IG'::citext) = 2 AS t; SELECT strpos('high', 'GH'::citext) = 3 AS t;
SELECT strpos('high'::citext, 'IG'::citext) = 2 AS t; SELECT strpos('high'::citext, 'GH'::citext) = 3 AS t;
-- to_ascii() does not support UTF-8. -- to_ascii() does not support UTF-8.
-- to_hex() takes a numeric argument. -- to_hex() takes a numeric argument.
......
...@@ -1067,7 +1067,7 @@ select rank(' a:1 s:2 d g'::tsvector, 'a & s'); ...@@ -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'); insert into test_tsvector (t) values ('foo bar foo the over foo qq bar');
drop trigger tsvectorupdate on test_tsvector; 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 word | ndoc | nentry
-----------+------+-------- -----------+------+--------
qq | 109 | 109 qq | 109 | 109
...@@ -2220,28 +2220,28 @@ select * from stat('select a from test_tsvector') order by ndoc desc, nentry des ...@@ -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,3b b:5a,6a,7c,8');
insert into test_tsvector values ('1', 'a:1a,2,3c b:5a,6b,7c,8b'); 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 word | ndoc | nentry
------+------+-------- ------+------+--------
b | 2 | 3 b | 2 | 3
a | 2 | 2 a | 2 | 2
(2 rows) (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 word | ndoc | nentry
------+------+-------- ------+------+--------
b | 1 | 2 b | 1 | 2
a | 1 | 1 a | 1 | 1
(2 rows) (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 word | ndoc | nentry
------+------+-------- ------+------+--------
b | 2 | 2 b | 2 | 2
a | 1 | 1 a | 1 | 1
(2 rows) (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 word | ndoc | nentry
-----------+------+-------- -----------+------+--------
a | 2 | 2 a | 2 | 2
...@@ -2254,7 +2254,7 @@ select * from stat('select a from test_tsvector','d') order by ndoc desc, nentry ...@@ -2254,7 +2254,7 @@ select * from stat('select a from test_tsvector','d') order by ndoc desc, nentry
qwerti | 1 | 1 qwerti | 1 | 1
(8 rows) (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 word | ndoc | nentry
-----------+------+-------- -----------+------+--------
a | 2 | 4 a | 2 | 4
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -230,14 +230,14 @@ select rank(' a:1 s:2 d g'::tsvector, 'a & s'); ...@@ -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'); insert into test_tsvector (t) values ('foo bar foo the over foo qq bar');
drop trigger tsvectorupdate on test_tsvector; 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,3b b:5a,6a,7c,8');
insert into test_tsvector values ('1', 'a:1a,2,3c b:5a,6b,7c,8b'); 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";
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";
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";
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";
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";
select to_tsquery('english', 'skies & books'); select to_tsquery('english', 'skies & books');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment