I recognised this problem already some years ago using FreeBSD
and Debian - but I ran into it again yesterday and I am not sure if
this is psql related or not postgresql related at all.
Let me explain:
OS - Ubuntu 10.10
Together with other stuff I coded a PL/PgSQL function by using emacs.
Function has had round about 200-300 lines of code.
For testing reason I marked the function code and copy / pasted it into
I got random confusing error message.
Messages like problem with the word IF or with an equal sign.
Messages that you usually get when you forget a semicolon or an END.
Sometimes I got "Function created" - but then on testing if function works
I got error messages like a table couldn't be found because the table name
Even without changing something at the code - every time I copy / paste the
function into psql - I got a different error message.
The given line number for the error always higher then 100.
By using df+ I compared the pasted function with the original and
that after more then 100 somewhere in the middle a line wasn't pasted
The last signs of the line just were truncated.
Or an additional line with a single sign like 'g' or 'b' was added.
Always just a single line. The code after that line was pasted correct
It looks like psql get a hiccup when you copy/paste more then 100 lines
When I copy / paste the original code into a separate file in emacs or
vi - all was
copy /pasted correct.
Also when I used psql -f to upload the code all worked fine.
Is that a psql bug?
It also worked to copy paste the function into psql in smaller pieces.
First the first 100 lines - then the next 100 lines and so on.
Has somebody an idea here why this happens?
Susanne Ebrecht - 2ndQuadrant
PostgreSQL Development, 24x7 Support, Training and Services