Thread: automatic sequences

automatic sequences

From
Richard Harvey Chapman
Date:
I'm having trouble with postgres' default naming scheme for sequences.

Does it only use the first 13 characters of the table name and column name
so it doesn't pass the 32 character name limit?

Thanks,

R.

jui=# CREATE TABLE cpu_interface_type (
jui(#         cpu_interface_type_code SERIAL PRIMARY KEY,
jui(#         name                    VARCHAR(40) UNIQUE NOT NULL
jui(# );
NOTICE:  CREATE TABLE will create implicit sequence
'cpu_interface_cpu_interface_seq' for SERIAL column
'cpu_interface_type.cpu_interface_type_code'
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index
'cpu_interface_type_pkey' for table 'cpu_interface_type'
NOTICE:  CREATE TABLE/UNIQUE will create implicit index
'cpu_interface_type_name_key' for table 'cpu_interface_type'
CREATE
jui=#
jui=# CREATE TABLE cpu_interface_config (
jui(#         cpu_interface_config_code       SERIAL PRIMARY KEY,
jui(#         cpu_interface_type_code INTEGER REFERENCES
cpu_interface_type NOT NULL
jui(# );
NOTICE:  CREATE TABLE will create implicit sequence
'cpu_interface_cpu_interface_seq' for SERIAL column
'cpu_interface_config.cpu_interface_config_code'
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index
'cpu_interface_config_pkey' for table 'cpu_interface_config'
NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
ERROR:  Relation 'cpu_interface_cpu_interface_seq' already exists
jui=#
jui=# CREATE TABLE cpu_interface (
jui(#         cpu_interface_code      SERIAL PRIMARY KEY,
jui(#         cpu_interface_config_code       INTEGER REFERENCES
cpu_interface_config NOT NULL,
jui(#         ip_stack_code           INTEGER REFERENCES ip_stack NOT NULL
jui(# );
NOTICE:  CREATE TABLE will create implicit sequence
'cpu_interface_cpu_interface_seq' for SERIAL column
'cpu_interface.cpu_interface_code'
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index
'cpu_interface_pkey' for table 'cpu_interface'
NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
ERROR:  Relation 'cpu_interface_config' does not exist
jui=#



Re: automatic sequences

From
Richard Harvey Chapman
Date:
On Wed, 12 Jul 2000, Richard Harvey Chapman wrote:

> I'm having trouble with postgres' default naming scheme for sequences.
>
> Does it only use the first 13 characters of the table name and column name
> so it doesn't pass the 32 character name limit?

nevermind, it is in fact as listed above.  I'll just have to start varying
my names before the first 13 characters.

R.


jui=# create table abcdefghijklmnop (
jui(# abcdefghijklmnop SERIAL PRIMARY KEY);
NOTICE:  CREATE TABLE will create implicit sequence
'abcdefghijklm_abcdefghijklm_seq' for SERIAL column
'abcdefghijklmnop.abcdefghijklmnop'
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index
'abcdefghijklmnop_pkey' for table 'abcdefghijklmnop'
CREATE