diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-03-24 17:22:34 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-03-24 17:22:34 +0000 |
commit | 00aa8ed47a1d42a799eb7e92936d4272417f83b0 (patch) | |
tree | c518c7849a83fa0f65977bd8d00959570c84d081 /src/pl/plpython/plpython_function.sql | |
parent | 218705958aacf580b515b565640542470d5c4aee (diff) | |
download | postgresql-00aa8ed47a1d42a799eb7e92936d4272417f83b0.tar.gz postgresql-00aa8ed47a1d42a799eb7e92936d4272417f83b0.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.sql | 16 |
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; |