From 35411a878b50b545d2ceaa15c11015d858c83dda Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 24 Mar 2005 17:22:44 +0000 Subject: Adjust plpython to convert \r\n and \r to \n in Python scripts, per recent discussion concluding that this is the Right Thing. Add regression test check for this behavior. Michael Fuhr --- src/pl/plpython/plpython_function.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/pl/plpython/plpython_function.sql') diff --git a/src/pl/plpython/plpython_function.sql b/src/pl/plpython/plpython_function.sql index 801222f4ef8..c849c3e5b97 100644 --- a/src/pl/plpython/plpython_function.sql +++ b/src/pl/plpython/plpython_function.sql @@ -306,3 +306,19 @@ CREATE OR REPLACE FUNCTION write_file(text,text) RETURNS text AS ' open(args[0],"w").write(args[1]) return "Wrote to file: %s" % args[0] ' LANGUAGE plpythonu; + +-- +-- Universal Newline Support +-- + +CREATE OR REPLACE FUNCTION newline_lf() RETURNS integer AS +'x = 100\ny = 23\nreturn x + y\n' +LANGUAGE plpythonu; + +CREATE OR REPLACE FUNCTION newline_cr() RETURNS integer AS +'x = 100\ry = 23\rreturn x + y\r' +LANGUAGE plpythonu; + +CREATE OR REPLACE FUNCTION newline_crlf() RETURNS integer AS +'x = 100\r\ny = 23\r\nreturn x + y\r\n' +LANGUAGE plpythonu; -- cgit v1.2.3