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

Re: Yikes! Bitten by line length?

From: Ken Corey <ken(at)kencorey(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Yikes! Bitten by line length?
Date: 2001-01-18 18:55:22
Message-ID: (view raw or whole thread)
Lists: pgsql-novice
Tom Lane wrote:
> Ken Corey <ken(at)kencorey(dot)com> writes:
> > Drat!  Thought this wa identified...but sure enough it's still causing troubles.  Will report shortly.
> Do you mean your previous description was incorrect, or that it is
> correct but there are more squirrelies besides that one?  If what you
> said was correct as far as it went, then we do have a bug to fix,
> I think.  plpgsql should either work or generate a reasonable error
> message when the actual parameter length exceeds the declared length
> of the formal parameter.
> Right offhand, I would have said that the declared length of a function
> parameter would be completely ignored, but perhaps I am mistaken ...

Aha.  Well.  Finally got to the bottom of it, and got it all fixed.

There were two problems.

1) Problem: Under Solaris, when entering a really long sql parameter
into psql, the first bytes would be chopped off:

GRE=# select
GRE'# ');
ERROR:  parser: parse error at or near

Solaris' fgets function *only* returns the last part of a string if the
string is over 256 bytes!  The test was this little program:

#include <stdio.h>
int main(int argc,char **argv) {
  char line[1024];
  while((fgets(line,1024,stdin)) != EOF) {
    printf("Got '%s'\n",line);

Enter in really big lines (> 256 characters), and you'll see what I


The fix is to install the GNU Readline library, and recompile postgres
to use it.  Job done, and the interface is *much* nicer, now.

2) The libpq problem was my mis-handling of pointers.  Gotta love C.  As
near as I can tell, it's working okay now (although I think I'm getting
some error messages back that I should explore, at least it's not


In response to


pgsql-novice by date

Next:From: Tom LaneDate: 2001-01-18 19:00:01
Subject: Re: Yikes! Bitten by line length?
Previous:From: Tom LaneDate: 2001-01-18 18:40:00
Subject: Re: Novice lo_import problem (7.0.3)

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