literal limits in 8.3

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: literal limits in 8.3
Date: 2008-11-24 12:42:39
Message-ID: 20081124124239.GY2459@frubble.xen.chris-lamb.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrus 2008-11-24 13:29:25 Re: Returning schema name with table name
Previous Message Thomas Markus 2008-11-24 12:39:48 Re: Returning schema name with table name

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2008-11-24 12:46:29 Re: Windowing Function Patch Review -> Standard Conformance
Previous Message Magnus Hagander 2008-11-24 12:29:36 Re: Autoconf, libpq and replacement function