Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8fb54e9

Browse files
committed
Put back plpython_unicode_2.out for SQL_ASCII case.
This alternative expected output file is required when using SQL_ASCIIas the client and server encoding. The python encoding conversion used tothrow an error on that, but it is now accepted and you get the UTF-8representation of the string. I thought that case was already covered bythe other expected output files, but the buildfarm says otherwise.This is only required on REL9_2_STABLE. In 9.1, we explicitly setclient_encoding to UTF-8 to avoid this.
1 parent7fbe5aa commit8fb54e9

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
--
2+
-- Unicode handling
3+
--
4+
CREATE TABLE unicode_test (
5+
testvalue text NOT NULL
6+
);
7+
CREATE FUNCTION unicode_return() RETURNS text AS E'
8+
return u"\\x80"
9+
' LANGUAGE plpythonu;
10+
CREATE FUNCTION unicode_trigger() RETURNS trigger AS E'
11+
TD["new"]["testvalue"] = u"\\x80"
12+
return "MODIFY"
13+
' LANGUAGE plpythonu;
14+
CREATE TRIGGER unicode_test_bi BEFORE INSERT ON unicode_test
15+
FOR EACH ROW EXECUTE PROCEDURE unicode_trigger();
16+
CREATE FUNCTION unicode_plan1() RETURNS text AS E'
17+
plan = plpy.prepare("SELECT $1 AS testvalue", ["text"])
18+
rv = plpy.execute(plan, [u"\\x80"], 1)
19+
return rv[0]["testvalue"]
20+
' LANGUAGE plpythonu;
21+
CREATE FUNCTION unicode_plan2() RETURNS text AS E'
22+
plan = plpy.prepare("SELECT $1 || $2 AS testvalue", ["text", u"text"])
23+
rv = plpy.execute(plan, ["foo", "bar"], 1)
24+
return rv[0]["testvalue"]
25+
' LANGUAGE plpythonu;
26+
SELECT unicode_return();
27+
unicode_return
28+
----------------
29+
€
30+
(1 row)
31+
32+
INSERT INTO unicode_test (testvalue) VALUES ('test');
33+
SELECT * FROM unicode_test;
34+
testvalue
35+
-----------
36+
€
37+
(1 row)
38+
39+
SELECT unicode_plan1();
40+
unicode_plan1
41+
---------------
42+
€
43+
(1 row)
44+
45+
SELECT unicode_plan2();
46+
unicode_plan2
47+
---------------
48+
foobar
49+
(1 row)
50+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp