pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: José Soares <jose@sferacarta.com>
To: Bruce Tong <zztong@laxmi.ev.net>
Cc: leif@danmos.dk
Cc: pgsql-interfaces@postgresql.org
Subject: Re: [INTERFACES] Bug in psql?
Date: Tue, 11 May 1999 15:32:28 +0200
Message-ID: <3738316B.47CED3BB@sferacarta.com> (raw)
References: <Pine.LNX.4.04.9905110846330.30630-100000@laxmi.ev.net>

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@laxmi.ev.net        |  -- Joe Walsh for the 21st Century

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

view thread (10+ messages)  latest in thread

Message-ID: <3738316B.47CED3BB@sferacarta.com>
Permalink:  ../3738316B.47CED3BB@sferacarta.com/
Also on:    postgresql.org/message-id/3738316B.47CED3BB@sferacarta.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: jose@sferacarta.com, zztong@laxmi.ev.net, leif@danmos.dk
  Subject: Re: [INTERFACES] Bug in psql?
  In-Reply-To: <3738316B.47CED3BB@sferacarta.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox