Re: Yikes! Bitten by line length? - Mailing list pgsql-novice

From Ken Corey
Subject Re: Yikes! Bitten by line length?
Date
Msg-id 3A6742C8.799CA6DC@kencorey.com
Whole thread Raw
In response to Yikes! Bitten by line length?  (Ken Corey <ken@kencorey.com>)
Responses Re: Yikes! Bitten by line length?
List pgsql-novice
Tom Lane wrote:
[...] extraneous bug description removed.
> > 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
> > mean.
>
> Yeesh.  I wonder if any other Unixen are equally broken?

FWIW, I tested it on my Linux box (2.2.15-4mdk, a mandrake 7.2 distro),
and it worked fine.  I can't speak to other unixes.

> Perhaps we should reduce psql's fgets() buffers to 256 bytes or less to
> avoid this problem?

Hrm...I don't know so much about that.  That would limit it on boxes
where the fgets works as advertised.

Actually, how hard is it to add another test to the auto-configurtion
file?  The little program above is small enough that it should be a
fairly simple deal to compile it during configuration, pipe input
through it, and see if fputs is limited. If it is, then the
configuration script could output a big warning message saying 'for your
own good, download and install readline, and then recompile'.

*shrug* At the very least, perhaps it could be put in the FAQ and/or
install docs?

-Ken

pgsql-novice by date:

Previous
From: Ken Corey
Date:
Subject: Re: Yikes! Bitten by line length?
Next
From: "zivit"
Date:
Subject: ERROR: plpgsql: cache lookup from pg_proc failed -- Why?