FAQ
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

Search Discussions

  • Michael Wood at Jun 29, 2011 at 7:30 am
    Hi
    On 29 June 2011 07:42, Susanne Ebrecht 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@gmail.com>
  • Susanne Ebrecht at Jun 29, 2011 at 9:29 am

    On 29.06.2011 09:30, Michael Wood wrote:
    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.
    As I said - I remember that I discovered the problem already years ago
    running FreeBSD + KDE.

    And yes - I run emacs / vi in a terminal.
    ssh wasn't involved - all local.

    When it would be terminal related - then copy from emacs terminal to vi
    terminal
    or vice versa also would fail - but this works fine.
    This also excludes a buffer overload.
    Also I can exclude that it is related to "curious" signs. My code only
    use 7-bit-ASCII signs.

    Susanne

    --
    Susanne Ebrecht - 2ndQuadrant
    PostgreSQL Development, 24x7 Support, Training and Services
    www.2ndQuadrant.com
  • Michael Wood at Jun 29, 2011 at 10:24 am

    On 29 June 2011 10:28, Susanne Ebrecht wrote:
    On 29.06.2011 09:30, Michael Wood wrote:

    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.
    As I said - I remember that I  discovered the problem already years ago
    running FreeBSD + KDE.
    You did not mention KDE in your initial e-mail :)
    And yes - I run emacs / vi in a terminal.
    ssh wasn't involved - all local.

    When it would be terminal related - then copy from emacs terminal to vi
    terminal
    or vice versa also would fail - but this works fine.
    This is why I asked if you were running them in the terminal.
    This also excludes a buffer overload.
    Also I can exclude that it is related to "curious" signs. My code only use
    7-bit-ASCII signs.
    Yes, mine also contained only ASCII characters.

    Sorry, I can't help then, but I hope someone else has an idea.

    --
    Michael Wood <esiotrot@gmail.com>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedJun 29, '11 at 6:44a
activeJun 29, '11 at 10:24a
posts4
users2
websitepostgresql.org
irc#postgresql

2 users in discussion

Susanne Ebrecht: 2 posts Michael Wood: 2 posts

People

Translate

site design / logo © 2021 Grokbase