On Sun, Nov 23, 2008 at 12:08:30PM -0700, Scott Marlowe wrote:
> There are no character limits for sql statements in pgsql

That's what I thought!

However, I've just tried today and am getting some strange results.  The
strange results are that above a certain length PG says that it's put a
string in OK but there's nothing there when I look back afterward.  The
code I'm tickling this with is:

  #include <stdio.h>
  #include <stdlib.h>
  int main(int argc, char ** argv)
  {
    int i = 0, x = atoi(argv[1]);
    char letters[] = 
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
    printf("INSERT INTO test (col) VALUES ('");
    while (i < x*1024*1024) {
      int n = printf ("%s",letters);
      if (n == EOF) return 1;
      i += n;
    }
    printf ("');\n");
    return 0;
  }

I ran the following in psql first:

  CREATE TABLE test (col TEXT);

Then a series of:

  ./test 32 | psql
  ./test 64 | psql
  ./test 128 | psql

the test is a simple:

  SELECT length(col) FROM test;

in psql.  I get a count of zero back (and the string equals '') for the
strange rows.  The execution of "test" also completes far too quickly
when things go strange.

One computer (still 8.3.3 I think) goes strange at 256MB and another
(8.3.4) goes strange at 512MB.  Any idea what's going on?


  Sam

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to