Error when pasting function blocks into psql

From: Ludwig Isaac Lim <ludz_lim(at)yahoo(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Error when pasting function blocks into psql
Date: 2022-07-06 12:24:00
Message-ID: 1797402460.2041897.1657110240951@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthias Apitz 2022-07-06 12:26:00 Re: lifetime of the old CTID
Previous Message Alvaro Herrera 2022-07-06 11:33:33 Re: ADD COLUMN ts tsvector GENERATED too slow