RE: CR is not removed with psql -f command on Windows.

From: "okano(dot)naoki(at)fujitsu(dot)com" <okano(dot)naoki(at)fujitsu(dot)com>
To: 'Tom Lane' <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: RE: CR is not removed with psql -f command on Windows.
Date: 2021-05-28 10:51:52
Message-ID: OS0PR01MB5762F2EB5BCE2FB1EF3EAE50FF229@OS0PR01MB5762.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thank you for your reply.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> > When creating a function with the psql -f filename command, the prosrc in pg_proc catalog contains \r(CR).
>
> Does that cause you any actual problems?

There is actual no problem.
However, I was puzzled by the difference between psql -f and psql < .

> > But I expect \r to be deleted. Is this a bug?
>
> I'm kind of inclined to ignore it, mainly because of the law of unintended
> consequences: adding code to strip \r is likely to break some scenario
> that's working fine for somebody else.
>
> I see that psql opens -f files with PG_BINARY_R, but that seems to be
> a very ancient decision so I'm hesitant to change it

As you said, changing to remove \r will affect somebody,
so I understand changing the behavior is difficult.

I think it is not necessary to change the mode from PG_BINARY_R,
because it is enough to remove \r in gets_fromFile() function in src/bin/psql/input.c.

Regards,
Naoki, Okano

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2021-05-28 13:08:51 Re: Query is slow when order by and limit clause are used in the query
Previous Message sreekanth vajrapu 2021-05-28 09:40:12 Re: Query is slow when order by and limit clause are used in the query