aboutsummaryrefslogtreecommitdiff
path: root/src/pl/plpython/plpython_function.sql
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-03-24 17:22:44 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-03-24 17:22:44 +0000
commit35411a878b50b545d2ceaa15c11015d858c83dda (patch)
treeea728de7f4a08fcac609e9789a2d152d5d315974 /src/pl/plpython/plpython_function.sql
parent291cd954fbfa48d8db79f22ffa8d596c837f7ee3 (diff)
downloadpostgresql-35411a878b50b545d2ceaa15c11015d858c83dda.tar.gz
postgresql-35411a878b50b545d2ceaa15c11015d858c83dda.zip
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
Diffstat (limited to 'src/pl/plpython/plpython_function.sql')
-rw-r--r--src/pl/plpython/plpython_function.sql16
1 files changed, 16 insertions, 0 deletions
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;