Re: [INTERFACES] Bug in psql?

From: José Soares <jose(at)sferacarta(dot)com>
To: Bruce Tong <zztong(at)laxmi(dot)ev(dot)net>
Cc: leif(at)danmos(dot)dk, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [INTERFACES] Bug in psql?
Date: 1999-05-11 13:32:28
Message-ID: 3738316B.47CED3BB@sferacarta.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

The error is about name lenght. Max. 31 char.
SERIAL types automatically creates an index name like:
globalafvigelse_globalafviggelse_key
which is longer than 31 char.
You have to cut the table/key name to fit into 26 char (the sum of both).
take a look:

$ psql prova < 1
create table globalafvigelse
(
globalafvigelse serial ,
startdato date,
slutdato date,
dagskema varchar(50),
primary key (globalafvigelse)
);
ERROR: CREATE TABLE/SERIAL implicit sequence name must be less than 32
characte
rs
Sum of lengths of 'globalafvigelse' and 'globalafvigelse' must be less
t
han 27

create table globalafvigelse
(
globalafvig serial ,
startdato date,
slutdato date,
dagskema varchar(50),
primary key (globalafvig)
);
NOTICE: CREATE TABLE will create implicit sequence
globalafvigelse_globalafvig_
seq for SERIAL column globalafvigelse.globalafvig
NOTICE: CREATE TABLE/UNIQUE will create implicit index
globalafvigelse_globalaf
vig_key for table globalafvigelse
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index
globalafvigelse_pke
y for table globalafvigelse
CREATE
EOF

$ psql -c '\d globalafvigelse'
Table = globalafvigelse
+----------------------------------+----------------------------------+-------+

| Field | Type |
Length|
+----------------------------------+----------------------------------+-------+

| globalafvig | int4 not null default nextval('g | 4
|
| startdato | date | 4
|
| slutdato | date | 4
|
| dagskema | varchar() | 50
|
+----------------------------------+----------------------------------+-------+

Indices: globalafvigelse_globalafvig_key
globalafvigelse_pkey

Jose'

Bruce Tong ha scritto:

> > I tried to create the table below using psql, but it bombed out
> > with a message about loosing the backend, though the backend was
> > still running nicely. It seems to be a problem with the long
> > field name of the serial (and primary key) column.
>
> Have you tried putting the following into a file and using...
>
> # psql -f foo.sql
>
> ... to run it? I _think_ this sometimes gives different messages than
> entering it directly on the psql command line, although I'm not sure why.
> I could be way off here, but its worth a try.
>
> > create table globalafvigelse
> > (
> > globalafvigelse serial ,
> > startdato date,
> > slutdato date,
> > dagskema varchar(50),
> > primary key (globalafvigelse)
> > );
>
> What is type "serial"? It probably not incorrect, but I've not heard of it
> before.
>
> Bruce Tong | Got me an office; I'm there late at night.
> Systems Programmer | Just send me e-mail, maybe I'll write.
> Electronic Vision / FITNE |
> zztong(at)laxmi(dot)ev(dot)net | -- Joe Walsh for the 21st Century

--
______________________________________________________________
PostgreSQL 6.5.0 on i586-pc-linux-gnu, compiled by gcc 2.7.2.3
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jose'

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Peter Harvey 1999-05-11 13:36:56 ODBC
Previous Message Peter Harvey 1999-05-11 13:26:48 subscribe