aboutsummaryrefslogtreecommitdiff
path: root/src/pl/plpython/plpython.c
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.c
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.c')
-rw-r--r--src/pl/plpython/plpython.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c
index 5f5b36b0a50..ff584f077dd 100644
--- a/src/pl/plpython/plpython.c
+++ b/src/pl/plpython/plpython.c
@@ -29,7 +29,7 @@
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.58 2004/12/17 02:14:48 tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.58.4.1 2005/03/24 17:22:44 tgl Exp $
*
*********************************************************************
*/
@@ -1206,10 +1206,14 @@ PLy_procedure_munge_source(const char *name, const char *src)
while (*sp != '\0')
{
- if (*sp == '\n')
+ if (*sp == '\r' && *(sp + 1) == '\n')
+ sp++;
+
+ if (*sp == '\n' || *sp == '\r')
{
- *mp++ = *sp++;
+ *mp++ = '\n';
*mp++ = '\t';
+ sp++;
}
else
*mp++ = *sp++;