Skip site navigation (1) Skip section navigation (2)

psql copy paste failure

From: Susanne Ebrecht <susanne(at)2ndQuadrant(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: psql copy paste failure
Date: 2011-06-29 05:42:38
Message-ID: 4E0ABB4E.9090504@2ndQuadrant.com (view raw or flat)
Thread:
Lists: pgsql-novice
Hello,

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
PostgreSQL 9.0.3
emacs

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
psql.

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
was truncated.

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 
figured out
that after more then 100 somewhere in the middle a line wasn't pasted 
correct.
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 
again.

It looks like psql get a hiccup when you copy/paste more then 100 lines 
at once.

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?

Best Regards,

Susanne

-- 
Susanne Ebrecht - 2ndQuadrant
PostgreSQL Development, 24x7 Support, Training and Services
www.2ndQuadrant.com


Responses

pgsql-novice by date

Next:From: Michael WoodDate: 2011-06-29 07:30:24
Subject: Re: psql copy paste failure
Previous:From: LewDate: 2011-06-29 04:55:44
Subject: Re: terminate a coonextion within pg

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group