Error when pasting function blocks into psql - Mailing list pgsql-general

From Ludwig Isaac Lim
Subject Error when pasting function blocks into psql
Date
Msg-id 1797402460.2041897.1657110240951@mail.yahoo.com
Whole thread Raw
Responses Re: Error when pasting function blocks into psql  (Francisco Olarte <folarte@peoplecall.com>)
Re: Error when pasting function blocks into psql  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hello:

I noticed that I'm getting errors when copy and pasting code for stored procedure from Windows directly into psql running in putty.

To reproduce create a procedure that has multiple statements with each statements having multiple lines, similar to the ones below:

CREATE OR REPLACE PROCEDURE test()
AS
$$
     UPDATE
                     table1
      SET
                   field1 = ?;


       -- more SQL statements
$$
LANGUAGE SQL;

Copy and paste from Windows editor (or IDE) to a psql running in a Putty. Chances are it will complain of syntax error. The error doesn't appear when I copy and paste it to an empty file in vim, and the run:

psql -f <file name>

Is there a way of prevent this kind of error when pasting directly into psql? I'm using the latest version of PostgreSQL (server and client. Version 14.4)

Thank you in advance,
Ludwig Lim

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: ADD COLUMN ts tsvector GENERATED too slow
Next
From: Matthias Apitz
Date:
Subject: Re: lifetime of the old CTID