Apologies if this has been raised before.

This:

create table a12345678901234567890 ( b1234567890  serial );

causes this:

pqReadData() -- backend closed the channel unexpectedly.
        This probably means the backend terminated abnormally before or
while processing the request.
We have lost the connection to the backend, so further processing is
impossible.  Terminating.


This is on postgres 6.4.1 (the "fixed" 6.4.1, not the accidental
snapshot) on BSDI.

The same problem exists in 6.4 on FreeBSD.


Tue, 29 Dec 1998 12:32:20 -0500
"Nat Howard" <Nat.Howard@cello-us.com>
bug with long serial names
> create table a12345678901234567890 ( b1234567890  serial );
> causes this:
> pqReadData() -- backend closed the channel unexpectedly.

I hadn't heard about this. Will look at it. In the meantime, don't do
that :)

The upper limit on names is probably something like

   <table name length> + <column name length> + 5 <= 31

                      - Tom

Tue, 29 Dec 1998 18:01:17 +0000
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
Re: [HACKERS] bug with long serial names
> > create table a12345678901234567890 ( b1234567890  serial );
> > causes this:
> > pqReadData() -- backend closed the channel unexpectedly.
> The upper limit on names is probably something like
>    <table name length> + <column name length> + 5 <= 31

Here is a patch which should catch the problem:

pg=> create table a12345678901234567890 ( b1234567890  serial );
ERROR:  CREATE TABLE/SERIAL implicit sequence name must be less than 32
characters
        Sum of lengths of 'a12345678901234567890' and 'b1234567890' must
be less than 27

Will be in the next release. Apply the patch by putting it into the
backend/parser/ directory, then typing:

  patch < analyze.c.patch

btw, the patch should apply cleanly but with offsets since my source
code has some other changes you will not want (yet).

                       - Tom
Tue, 29 Dec 1998 18:34:26 +0000
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
Re: [HACKERS] bug with long serial names