Ken Corey <ken@kencorey.com> writes:
> 1) Problem: Under Solaris, when entering a really long sql parameter
> into psql, the first bytes would be chopped off:
> GRE=# select
>
I_SESSION(null,'1',2,'E2K','0x637B9C8B443E9AA0AF4C696D7E8AB27B4FA57B5A6DBDD29851B74BDE5D97A3995F8F8A825F8B4D95D7687CAE94E77F809B589363685A718B72A28C90AA872936297B4020360B46752B2E2042172232171C59F730193153466B2F4A42270E563A29FF4ED30C47E340396056691B1485512D1F3E2E2554124D2D47821E3BF86031335C24444E00063112644D41F09C6F00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
> GRE'# ');
> ERROR: parser: parse error at or near
> "000000000000000000000000000000000"
> GRE=#
> Cause:
> 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?
Perhaps we should reduce psql's fgets() buffers to 256 bytes or less to
avoid this problem?
regards, tom lane