Add some more citext test cases, per David Wheeler. Also remove the
citext-to-and-from-xml tests, since those caused variation between installations with or without libxml without really proving much. Instead repurpose citext_1.out as the expected results in glibc en_US (and probably other) locales.
This commit is contained in:
parent
399ad77c66
commit
13fdd0e4d1
@ -710,6 +710,30 @@ SELECT 'foo'::citext::name = 'foo'::name AS t;
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT 'f'::char::citext = 'f' AS t;
|
||||
t
|
||||
---
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT 'f'::citext::char = 'f'::char AS t;
|
||||
t
|
||||
---
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT 'f'::"char"::citext = 'f' AS t;
|
||||
t
|
||||
---
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT 'f'::citext::"char" = 'f'::"char" AS t;
|
||||
t
|
||||
---
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT 'foo'::bytea::citext = 'foo' AS t;
|
||||
t
|
||||
---
|
||||
@ -806,18 +830,6 @@ SELECT '08:00:2b:01:02:03'::citext::macaddr = '08:00:2b:01:02:03'::macaddr AS t;
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '<p>foo</p>'::xml::citext = '<p>foo</p>' AS t;
|
||||
t
|
||||
---
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '<p>foo</p>'::citext::xml::text = '<p>foo</p>'::xml::text AS t;
|
||||
t
|
||||
---
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '1999-01-08 04:05:06'::timestamp::citext = '1999-01-08 04:05:06'::timestamp::text AS t;
|
||||
t
|
||||
---
|
||||
@ -1041,6 +1053,8 @@ CREATE TABLE caster (
|
||||
text text,
|
||||
varchar varchar,
|
||||
bpchar bpchar,
|
||||
char char,
|
||||
chr "char",
|
||||
name name,
|
||||
bytea bytea,
|
||||
boolean boolean,
|
||||
@ -1053,7 +1067,6 @@ CREATE TABLE caster (
|
||||
cidr cidr,
|
||||
inet inet,
|
||||
macaddr macaddr,
|
||||
xml xml,
|
||||
money money,
|
||||
timestamp timestamp,
|
||||
timestamptz timestamptz,
|
||||
@ -1083,6 +1096,14 @@ INSERT INTO caster (bpchar) VALUES ('foo'::text);
|
||||
INSERT INTO caster (text) VALUES ('foo'::bpchar);
|
||||
INSERT INTO caster (bpchar) VALUES ('foo'::citext);
|
||||
INSERT INTO caster (citext) VALUES ('foo'::bpchar);
|
||||
INSERT INTO caster (char) VALUES ('f'::text);
|
||||
INSERT INTO caster (text) VALUES ('f'::char);
|
||||
INSERT INTO caster (char) VALUES ('f'::citext);
|
||||
INSERT INTO caster (citext) VALUES ('f'::char);
|
||||
INSERT INTO caster (chr) VALUES ('f'::text);
|
||||
INSERT INTO caster (text) VALUES ('f'::"char");
|
||||
INSERT INTO caster (chr) VALUES ('f'::citext);
|
||||
INSERT INTO caster (citext) VALUES ('f'::"char");
|
||||
INSERT INTO caster (name) VALUES ('foo'::text);
|
||||
INSERT INTO caster (text) VALUES ('foo'::name);
|
||||
INSERT INTO caster (name) VALUES ('foo'::citext);
|
||||
@ -1230,19 +1251,6 @@ LINE 1: INSERT INTO caster (macaddr) VALUES ('08:00:2b:01:02:0...
|
||||
^
|
||||
HINT: You will need to rewrite or cast the expression.
|
||||
INSERT INTO caster (citext) VALUES ('08:00:2b:01:02:03'::macaddr);
|
||||
-- Cannot cast to xml on assignment.
|
||||
INSERT INTO caster (xml) VALUES ('<p>foo</p>'::text);
|
||||
ERROR: column "xml" is of type xml but expression is of type text
|
||||
LINE 1: INSERT INTO caster (xml) VALUES ('<p>foo</p>'::tex...
|
||||
^
|
||||
HINT: You will need to rewrite or cast the expression.
|
||||
INSERT INTO caster (text) VALUES ('<p>foo</p>'::xml);
|
||||
INSERT INTO caster (xml) VALUES ('<p>foo</p>'::citext);
|
||||
ERROR: column "xml" is of type xml but expression is of type citext
|
||||
LINE 1: INSERT INTO caster (xml) VALUES ('<p>foo</p>'::cit...
|
||||
^
|
||||
HINT: You will need to rewrite or cast the expression.
|
||||
INSERT INTO caster (citext) VALUES ('<p>foo</p>'::xml);
|
||||
-- Cannot cast to money on assignment.
|
||||
INSERT INTO caster (money) VALUES ('12'::text);
|
||||
ERROR: column "money" is of type money but expression is of type text
|
||||
|
@ -122,25 +122,25 @@ SELECT 'A'::text <> 'a'::citext AS t;
|
||||
SELECT 'B'::citext < 'a'::text AS t; -- text wins.
|
||||
t
|
||||
---
|
||||
t
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT 'B'::citext <= 'a'::text AS t; -- text wins.
|
||||
t
|
||||
---
|
||||
t
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT 'a'::citext > 'B'::text AS t; -- text wins.
|
||||
t
|
||||
---
|
||||
t
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT 'a'::citext >= 'B'::text AS t; -- text wins.
|
||||
t
|
||||
---
|
||||
t
|
||||
f
|
||||
(1 row)
|
||||
|
||||
-- Test implicit casting. citext casts to varchar, but not vice-versa.
|
||||
@ -159,25 +159,25 @@ SELECT 'A'::varchar <> 'a'::citext AS t;
|
||||
SELECT 'B'::citext < 'a'::varchar AS t; -- varchar wins.
|
||||
t
|
||||
---
|
||||
t
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT 'B'::citext <= 'a'::varchar AS t; -- varchar wins.
|
||||
t
|
||||
---
|
||||
t
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT 'a'::citext > 'B'::varchar AS t; -- varchar wins.
|
||||
t
|
||||
---
|
||||
t
|
||||
f
|
||||
(1 row)
|
||||
|
||||
SELECT 'a'::citext >= 'B'::varchar AS t; -- varchar wins.
|
||||
t
|
||||
---
|
||||
t
|
||||
f
|
||||
(1 row)
|
||||
|
||||
-- A couple of longer examlpes to ensure that we don't get any issues with bad
|
||||
@ -710,6 +710,30 @@ SELECT 'foo'::citext::name = 'foo'::name AS t;
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT 'f'::char::citext = 'f' AS t;
|
||||
t
|
||||
---
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT 'f'::citext::char = 'f'::char AS t;
|
||||
t
|
||||
---
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT 'f'::"char"::citext = 'f' AS t;
|
||||
t
|
||||
---
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT 'f'::citext::"char" = 'f'::"char" AS t;
|
||||
t
|
||||
---
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT 'foo'::bytea::citext = 'foo' AS t;
|
||||
t
|
||||
---
|
||||
@ -806,18 +830,6 @@ SELECT '08:00:2b:01:02:03'::citext::macaddr = '08:00:2b:01:02:03'::macaddr AS t;
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT '<p>foo</p>'::xml::citext = '<p>foo</p>' AS t;
|
||||
ERROR: unsupported XML feature
|
||||
LINE 1: SELECT '<p>foo</p>'::xml::citext = '<p>foo</p>' AS t;
|
||||
^
|
||||
DETAIL: This functionality requires the server to be built with libxml support.
|
||||
HINT: You need to rebuild PostgreSQL using --with-libxml.
|
||||
SELECT '<p>foo</p>'::citext::xml::text = '<p>foo</p>'::xml::text AS t;
|
||||
ERROR: unsupported XML feature
|
||||
LINE 1: SELECT '<p>foo</p>'::citext::xml::text = '<p>foo</p>'::xml::...
|
||||
^
|
||||
DETAIL: This functionality requires the server to be built with libxml support.
|
||||
HINT: You need to rebuild PostgreSQL using --with-libxml.
|
||||
SELECT '1999-01-08 04:05:06'::timestamp::citext = '1999-01-08 04:05:06'::timestamp::text AS t;
|
||||
t
|
||||
---
|
||||
@ -1041,6 +1053,8 @@ CREATE TABLE caster (
|
||||
text text,
|
||||
varchar varchar,
|
||||
bpchar bpchar,
|
||||
char char,
|
||||
chr "char",
|
||||
name name,
|
||||
bytea bytea,
|
||||
boolean boolean,
|
||||
@ -1053,7 +1067,6 @@ CREATE TABLE caster (
|
||||
cidr cidr,
|
||||
inet inet,
|
||||
macaddr macaddr,
|
||||
xml xml,
|
||||
money money,
|
||||
timestamp timestamp,
|
||||
timestamptz timestamptz,
|
||||
@ -1083,6 +1096,14 @@ INSERT INTO caster (bpchar) VALUES ('foo'::text);
|
||||
INSERT INTO caster (text) VALUES ('foo'::bpchar);
|
||||
INSERT INTO caster (bpchar) VALUES ('foo'::citext);
|
||||
INSERT INTO caster (citext) VALUES ('foo'::bpchar);
|
||||
INSERT INTO caster (char) VALUES ('f'::text);
|
||||
INSERT INTO caster (text) VALUES ('f'::char);
|
||||
INSERT INTO caster (char) VALUES ('f'::citext);
|
||||
INSERT INTO caster (citext) VALUES ('f'::char);
|
||||
INSERT INTO caster (chr) VALUES ('f'::text);
|
||||
INSERT INTO caster (text) VALUES ('f'::"char");
|
||||
INSERT INTO caster (chr) VALUES ('f'::citext);
|
||||
INSERT INTO caster (citext) VALUES ('f'::"char");
|
||||
INSERT INTO caster (name) VALUES ('foo'::text);
|
||||
INSERT INTO caster (text) VALUES ('foo'::name);
|
||||
INSERT INTO caster (name) VALUES ('foo'::citext);
|
||||
@ -1230,29 +1251,6 @@ LINE 1: INSERT INTO caster (macaddr) VALUES ('08:00:2b:01:02:0...
|
||||
^
|
||||
HINT: You will need to rewrite or cast the expression.
|
||||
INSERT INTO caster (citext) VALUES ('08:00:2b:01:02:03'::macaddr);
|
||||
-- Cannot cast to xml on assignment.
|
||||
INSERT INTO caster (xml) VALUES ('<p>foo</p>'::text);
|
||||
ERROR: column "xml" is of type xml but expression is of type text
|
||||
LINE 1: INSERT INTO caster (xml) VALUES ('<p>foo</p>'::tex...
|
||||
^
|
||||
HINT: You will need to rewrite or cast the expression.
|
||||
INSERT INTO caster (text) VALUES ('<p>foo</p>'::xml);
|
||||
ERROR: unsupported XML feature
|
||||
LINE 1: INSERT INTO caster (text) VALUES ('<p>foo</p>'::xml...
|
||||
^
|
||||
DETAIL: This functionality requires the server to be built with libxml support.
|
||||
HINT: You need to rebuild PostgreSQL using --with-libxml.
|
||||
INSERT INTO caster (xml) VALUES ('<p>foo</p>'::citext);
|
||||
ERROR: column "xml" is of type xml but expression is of type citext
|
||||
LINE 1: INSERT INTO caster (xml) VALUES ('<p>foo</p>'::cit...
|
||||
^
|
||||
HINT: You will need to rewrite or cast the expression.
|
||||
INSERT INTO caster (citext) VALUES ('<p>foo</p>'::xml);
|
||||
ERROR: unsupported XML feature
|
||||
LINE 1: INSERT INTO caster (citext) VALUES ('<p>foo</p>'::xml...
|
||||
^
|
||||
DETAIL: This functionality requires the server to be built with libxml support.
|
||||
HINT: You need to rebuild PostgreSQL using --with-libxml.
|
||||
-- Cannot cast to money on assignment.
|
||||
INSERT INTO caster (money) VALUES ('12'::text);
|
||||
ERROR: column "money" is of type money but expression is of type text
|
||||
|
@ -220,6 +220,12 @@ SELECT '4.0'::citext::float8 = 4.0 AS t;
|
||||
SELECT 'foo'::name::citext = 'foo' AS t;
|
||||
SELECT 'foo'::citext::name = 'foo'::name AS t;
|
||||
|
||||
SELECT 'f'::char::citext = 'f' AS t;
|
||||
SELECT 'f'::citext::char = 'f'::char AS t;
|
||||
|
||||
SELECT 'f'::"char"::citext = 'f' AS t;
|
||||
SELECT 'f'::citext::"char" = 'f'::"char" AS t;
|
||||
|
||||
SELECT 'foo'::bytea::citext = 'foo' AS t;
|
||||
SELECT 'foo'::citext::bytea = 'foo'::bytea AS t;
|
||||
|
||||
@ -244,9 +250,6 @@ SELECT '192.168.100.128'::citext::inet = '192.168.100.128'::inet AS t;
|
||||
SELECT '08:00:2b:01:02:03'::macaddr::citext = '08:00:2b:01:02:03' AS t;
|
||||
SELECT '08:00:2b:01:02:03'::citext::macaddr = '08:00:2b:01:02:03'::macaddr AS t;
|
||||
|
||||
SELECT '<p>foo</p>'::xml::citext = '<p>foo</p>' AS t;
|
||||
SELECT '<p>foo</p>'::citext::xml::text = '<p>foo</p>'::xml::text AS t;
|
||||
|
||||
SELECT '1999-01-08 04:05:06'::timestamp::citext = '1999-01-08 04:05:06'::timestamp::text AS t;
|
||||
SELECT '1999-01-08 04:05:06'::citext::timestamp = '1999-01-08 04:05:06'::timestamp AS t;
|
||||
SELECT '1999-01-08 04:05:06'::timestamptz::citext = '1999-01-08 04:05:06'::timestamptz::text AS t;
|
||||
@ -300,6 +303,8 @@ CREATE TABLE caster (
|
||||
text text,
|
||||
varchar varchar,
|
||||
bpchar bpchar,
|
||||
char char,
|
||||
chr "char",
|
||||
name name,
|
||||
bytea bytea,
|
||||
boolean boolean,
|
||||
@ -312,7 +317,6 @@ CREATE TABLE caster (
|
||||
cidr cidr,
|
||||
inet inet,
|
||||
macaddr macaddr,
|
||||
xml xml,
|
||||
money money,
|
||||
timestamp timestamp,
|
||||
timestamptz timestamptz,
|
||||
@ -346,6 +350,16 @@ INSERT INTO caster (text) VALUES ('foo'::bpchar);
|
||||
INSERT INTO caster (bpchar) VALUES ('foo'::citext);
|
||||
INSERT INTO caster (citext) VALUES ('foo'::bpchar);
|
||||
|
||||
INSERT INTO caster (char) VALUES ('f'::text);
|
||||
INSERT INTO caster (text) VALUES ('f'::char);
|
||||
INSERT INTO caster (char) VALUES ('f'::citext);
|
||||
INSERT INTO caster (citext) VALUES ('f'::char);
|
||||
|
||||
INSERT INTO caster (chr) VALUES ('f'::text);
|
||||
INSERT INTO caster (text) VALUES ('f'::"char");
|
||||
INSERT INTO caster (chr) VALUES ('f'::citext);
|
||||
INSERT INTO caster (citext) VALUES ('f'::"char");
|
||||
|
||||
INSERT INTO caster (name) VALUES ('foo'::text);
|
||||
INSERT INTO caster (text) VALUES ('foo'::name);
|
||||
INSERT INTO caster (name) VALUES ('foo'::citext);
|
||||
@ -417,12 +431,6 @@ INSERT INTO caster (text) VALUES ('08:00:2b:01:02:03'::macaddr);
|
||||
INSERT INTO caster (macaddr) VALUES ('08:00:2b:01:02:03'::citext);
|
||||
INSERT INTO caster (citext) VALUES ('08:00:2b:01:02:03'::macaddr);
|
||||
|
||||
-- Cannot cast to xml on assignment.
|
||||
INSERT INTO caster (xml) VALUES ('<p>foo</p>'::text);
|
||||
INSERT INTO caster (text) VALUES ('<p>foo</p>'::xml);
|
||||
INSERT INTO caster (xml) VALUES ('<p>foo</p>'::citext);
|
||||
INSERT INTO caster (citext) VALUES ('<p>foo</p>'::xml);
|
||||
|
||||
-- Cannot cast to money on assignment.
|
||||
INSERT INTO caster (money) VALUES ('12'::text);
|
||||
INSERT INTO caster (text) VALUES ('12'::money);
|
||||
|
Loading…
Reference in New Issue
Block a user