mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-04 04:37:20 +02:00
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:
parent
95e8b44f03
commit
d365dc3d1b
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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,18 +320,17 @@ CREATE TEMP TABLE srt (
|
||||
name CITEXT
|
||||
);
|
||||
INSERT INTO srt (name)
|
||||
VALUES ('aardvark'),
|
||||
('AAA'),
|
||||
('aba'),
|
||||
VALUES ('abb'),
|
||||
('ABA'),
|
||||
('ABC'),
|
||||
('abd');
|
||||
CREATE INDEX srt_name ON srt (name);
|
||||
-- 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;
|
||||
@ -342,10 +341,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;
|
||||
@ -358,162 +357,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)
|
||||
@ -522,16 +505,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;
|
||||
@ -1503,8 +1484,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
|
||||
@ -1513,8 +1493,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
|
||||
@ -1523,8 +1502,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
|
||||
@ -1533,8 +1511,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
|
||||
@ -1543,8 +1520,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
|
||||
@ -1553,8 +1529,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
|
||||
@ -1563,8 +1538,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
|
||||
@ -1645,8 +1619,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;
|
||||
@ -1656,8 +1629,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
|
||||
@ -1698,8 +1670,7 @@ SELECT convert_from( name::bytea, 'SQL_ASCII' ) = convert_from( name::text::byte
|
||||
t
|
||||
t
|
||||
t
|
||||
t
|
||||
(5 rows)
|
||||
(4 rows)
|
||||
|
||||
SELECT decode('MTIzAAE='::citext, 'base64') = decode('MTIzAAE='::text, 'base64') AS t;
|
||||
t
|
||||
@ -1721,8 +1692,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
|
||||
@ -1779,8 +1749,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;
|
||||
@ -1790,8 +1759,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
|
||||
@ -1800,8 +1768,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
|
||||
@ -2106,37 +2073,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
|
||||
@ -2270,8 +2237,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
|
||||
@ -2280,8 +2246,7 @@ SELECT like_escape( name::text, ''::citext ) = like_escape( name::text, '' ) AS
|
||||
t
|
||||
t
|
||||
t
|
||||
t
|
||||
(5 rows)
|
||||
(4 rows)
|
||||
|
||||
-- Ensure correct behavior for citext with materialized views.
|
||||
CREATE TABLE citext_table (
|
||||
|
@ -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,18 +320,17 @@ CREATE TEMP TABLE srt (
|
||||
name CITEXT
|
||||
);
|
||||
INSERT INTO srt (name)
|
||||
VALUES ('aardvark'),
|
||||
('AAA'),
|
||||
('aba'),
|
||||
VALUES ('abb'),
|
||||
('ABA'),
|
||||
('ABC'),
|
||||
('abd');
|
||||
CREATE INDEX srt_name ON srt (name);
|
||||
-- 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;
|
||||
@ -342,10 +341,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;
|
||||
@ -358,162 +357,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)
|
||||
@ -522,16 +505,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;
|
||||
@ -1503,8 +1484,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
|
||||
@ -1513,8 +1493,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
|
||||
@ -1523,8 +1502,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
|
||||
@ -1533,8 +1511,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
|
||||
@ -1543,8 +1520,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
|
||||
@ -1553,8 +1529,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
|
||||
@ -1563,8 +1538,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
|
||||
@ -1645,8 +1619,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;
|
||||
@ -1656,8 +1629,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
|
||||
@ -1698,8 +1670,7 @@ SELECT convert_from( name::bytea, 'SQL_ASCII' ) = convert_from( name::text::byte
|
||||
t
|
||||
t
|
||||
t
|
||||
t
|
||||
(5 rows)
|
||||
(4 rows)
|
||||
|
||||
SELECT decode('MTIzAAE='::citext, 'base64') = decode('MTIzAAE='::text, 'base64') AS t;
|
||||
t
|
||||
@ -1721,8 +1692,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
|
||||
@ -1779,8 +1749,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;
|
||||
@ -1790,8 +1759,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
|
||||
@ -1800,8 +1768,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
|
||||
@ -2106,37 +2073,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
|
||||
@ -2270,8 +2237,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
|
||||
@ -2280,8 +2246,7 @@ SELECT like_escape( name::text, ''::citext ) = like_escape( name::text, '' ) AS
|
||||
t
|
||||
t
|
||||
t
|
||||
t
|
||||
(5 rows)
|
||||
(4 rows)
|
||||
|
||||
-- Ensure correct behavior for citext with materialized views.
|
||||
CREATE TABLE citext_table (
|
||||
|
@ -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,9 +121,8 @@ CREATE TEMP TABLE srt (
|
||||
);
|
||||
|
||||
INSERT INTO srt (name)
|
||||
VALUES ('aardvark'),
|
||||
('AAA'),
|
||||
('aba'),
|
||||
VALUES ('abb'),
|
||||
('ABA'),
|
||||
('ABC'),
|
||||
('abd');
|
||||
|
||||
@ -131,11 +130,11 @@ CREATE INDEX srt_name ON srt (name);
|
||||
|
||||
-- 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;
|
||||
|
||||
@ -148,11 +147,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;
|
||||
@ -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', '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.
|
||||
|
@ -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
@ -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');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user