Re: Error when pasting function blocks into psql

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Error when pasting function blocks into psql
Дата
Msg-id 3308507.1657290049@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Error when pasting function blocks into psql  (Ludwig Isaac Lim <ludz_lim@yahoo.com>)
Ответы Re: Error when pasting function blocks into psql  (Ludwig Isaac Lim <ludz_lim@yahoo.com>)
Список pgsql-general
Ludwig Isaac Lim <ludz_lim@yahoo.com> writes:
> Hello:
> I noticed that I'm getting errors when copy and pasting code for stored procedure from Windows directly into psql
runningin putty. 
> To reproduce create a procedure that has multiple statements with each statements having multiple lines, similar to
theones 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?

A gotcha I frequently run into is that if there are any literal tab
characters in the text, pasting it into psql fails because the tabs
invoke tab-completion, producing either no text or unwanted text.
I don't know if that's an issue on Windows (does your psql build
do tab completion?), but if so, the workaround is to disable tab
completion by starting psql with the '-n' switch.

Another fairly likely possibility is that your paste contains
invisible characters that psql does not think are whitespace,
like non-break space ( ).  However, pasting into a file
wouldn't make that problem go away, so the tab idea seems
a shade more likely.

            regards, tom lane



В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: - operator overloading not giving expected result
Следующее
От: Ravi Krishna
Дата:
Сообщение: Re: - operator overloading not giving expected result