4 -- Note: this test case is known to fail if the database encoding is
5 -- EUC_CN, EUC_JP, EUC_KR, or EUC_TW, for lack of any equivalent to
6 -- U+00A0 (no-break space) in those encodings. However, testing with
7 -- plain ASCII data would be rather useless, so we must live with that.
9 SET client_encoding TO UTF8;
10 CREATE TABLE unicode_test (
11 testvalue text NOT NULL
13 CREATE FUNCTION unicode_return() RETURNS text AS E'
16 CREATE FUNCTION unicode_trigger() RETURNS trigger AS E'
17 TD["new"]["testvalue"] = u"\\xA0"
20 CREATE TRIGGER unicode_test_bi BEFORE INSERT ON unicode_test
21 FOR EACH ROW EXECUTE PROCEDURE unicode_trigger();
22 CREATE FUNCTION unicode_plan1() RETURNS text AS E'
23 plan = plpy.prepare("SELECT $1 AS testvalue", ["text"])
24 rv = plpy.execute(plan, [u"\\xA0"], 1)
25 return rv[0]["testvalue"]
27 CREATE FUNCTION unicode_plan2() RETURNS text AS E'
28 plan = plpy.prepare("SELECT $1 || $2 AS testvalue", ["text", u"text"])
29 rv = plpy.execute(plan, ["foo", "bar"], 1)
30 return rv[0]["testvalue"]
32 SELECT unicode_return();
38 INSERT INTO unicode_test (testvalue) VALUES ('test');
39 SELECT * FROM unicode_test;
45 SELECT unicode_plan1();
51 SELECT unicode_plan2();