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

Commitea2467d

Browse files
committed
Add alternative expected file for unicode test for client encoding not UTF8
1 parente2a4195 commitea2467d

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

‎src/pl/plpython/expected/README

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ Guide to alternative expected files:
33
plpython_error_2.outPython 2.2, 2.3, 2.4
44
plpython_error.outPython 2.5, 2.6
55

6-
plpython_unicode.outany version, when server encoding != SQL_ASCII; else ...
6+
plpython_unicode.outany version, when server encoding != SQL_ASCII and client encoding = UTF8; else ...
7+
plpython_unicode_0.outany version, when server encoding != SQL_ASCII and client encoding != UTF8; else ...
78
plpython_unicode_2.outPython 2.2
89
plpython_unicode_3.outPython 2.3, 2.4
910
plpython_unicode_5.outPython 2.5, 2.6
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