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

Re: psql copy paste failure

From: Michael Wood <esiotrot(at)gmail(dot)com>
To: Susanne Ebrecht <susanne(at)2ndquadrant(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: psql copy paste failure
Date: 2011-06-29 07:30:24
Message-ID: BANLkTikJm3RKhNZfgP02fSUC47ZnySxP4g@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
Hi

On 29 June 2011 07:42, Susanne Ebrecht <susanne(at)2ndquadrant(dot)com> wrote:
> 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.

Were emacs/vi running in a terminal?

> Also when I used psql -f to upload the code all worked fine.
>
> Is that a psql bug?

I don't think so.

> 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?

I've seen behaviour like this too, but with things other than psql.
e.g. I've definitely seen it with MySQL.  So I don't think it is
specific to psql.  I don't know what causes it, but it is annoying and
I also end up either pasting the code in pieces or saving to a file
and loading it instead.

I haven't checked to see if it's only a single line that gets
corrupted or exactly how it gets corrupted, but otherwise it sounds
like the same problem you are seeing.

I'm not sure where the problem lies.  Gnome Terminal?  SSH (client? server?)

I think I have tried e.g. rxvt to see if that worked better and as far
as I remember I also encountered the problem there, but I might be
remembering incorrectly.

-- 
Michael Wood <esiotrot(at)gmail(dot)com>

In response to

Responses

pgsql-novice by date

Next:From: Susanne EbrechtDate: 2011-06-29 08:28:42
Subject: Re: psql copy paste failure
Previous:From: Susanne EbrechtDate: 2011-06-29 05:42:38
Subject: psql copy paste failure

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