1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

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
This commit is contained in:
Tom Lane
2005-03-24 17:22:34 +00:00
parent 218705958a
commit 00aa8ed47a
4 changed files with 48 additions and 3 deletions

View File

@ -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.59 2005/03/24 17:22:34 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++;