diff --git a/contrib/citext/expected/citext.out b/contrib/citext/expected/citext.out index 8d9c66e3c3..4d8f1ac066 100644 --- a/contrib/citext/expected/citext.out +++ b/contrib/citext/expected/citext.out @@ -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 '
foo
'::xml::citext = 'foo
' AS t; - t ---- - t -(1 row) - -SELECT 'foo
'::citext::xml::text = 'foo
'::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 ('foo
'::text); -ERROR: column "xml" is of type xml but expression is of type text -LINE 1: INSERT INTO caster (xml) VALUES ('foo
'::tex... - ^ -HINT: You will need to rewrite or cast the expression. -INSERT INTO caster (text) VALUES ('foo
'::xml); -INSERT INTO caster (xml) VALUES ('foo
'::citext); -ERROR: column "xml" is of type xml but expression is of type citext -LINE 1: INSERT INTO caster (xml) VALUES ('foo
'::cit... - ^ -HINT: You will need to rewrite or cast the expression. -INSERT INTO caster (citext) VALUES ('foo
'::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 diff --git a/contrib/citext/expected/citext_1.out b/contrib/citext/expected/citext_1.out index ff93842a91..e9bb6124c8 100644 --- a/contrib/citext/expected/citext_1.out +++ b/contrib/citext/expected/citext_1.out @@ -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 'foo
'::xml::citext = 'foo
' AS t; -ERROR: unsupported XML feature -LINE 1: SELECT 'foo
'::xml::citext = 'foo
' AS t; - ^ -DETAIL: This functionality requires the server to be built with libxml support. -HINT: You need to rebuild PostgreSQL using --with-libxml. -SELECT 'foo
'::citext::xml::text = 'foo
'::xml::text AS t; -ERROR: unsupported XML feature -LINE 1: SELECT 'foo
'::citext::xml::text = 'foo
'::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 ('foo
'::text); -ERROR: column "xml" is of type xml but expression is of type text -LINE 1: INSERT INTO caster (xml) VALUES ('foo
'::tex... - ^ -HINT: You will need to rewrite or cast the expression. -INSERT INTO caster (text) VALUES ('foo
'::xml); -ERROR: unsupported XML feature -LINE 1: INSERT INTO caster (text) VALUES ('foo
'::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 ('foo
'::citext); -ERROR: column "xml" is of type xml but expression is of type citext -LINE 1: INSERT INTO caster (xml) VALUES ('foo
'::cit... - ^ -HINT: You will need to rewrite or cast the expression. -INSERT INTO caster (citext) VALUES ('foo
'::xml); -ERROR: unsupported XML feature -LINE 1: INSERT INTO caster (citext) VALUES ('foo
'::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 diff --git a/contrib/citext/sql/citext.sql b/contrib/citext/sql/citext.sql index 428f6e1cfc..379c0786f1 100644 --- a/contrib/citext/sql/citext.sql +++ b/contrib/citext/sql/citext.sql @@ -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 'foo
'::xml::citext = 'foo
' AS t; -SELECT 'foo
'::citext::xml::text = 'foo
'::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 ('foo
'::text); -INSERT INTO caster (text) VALUES ('foo
'::xml); -INSERT INTO caster (xml) VALUES ('foo
'::citext); -INSERT INTO caster (citext) VALUES ('foo
'::xml); - -- Cannot cast to money on assignment. INSERT INTO caster (money) VALUES ('12'::text); INSERT INTO caster (text) VALUES ('12'::money);