Re: 7.0.0 long name truncation problem

From: "Gregory Wood" <gregw(at)com-stock(dot)com>
To: "Ed Loehr" <ed(at)www(dot)accuros(dot)com>
Cc: "PostgreSQL-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: 7.0.0 long name truncation problem
Date: 2001-05-14 14:33:10
Message-ID: 009e01c0dc82$dfa44d80$7889ffcc@comstock.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> When the name of a sequence auto-generated from a SERIAL type would be
> longer than 32 chars, it appears that "CREATE TABLE" uses a different
> name truncation algorithm than "DROP SEQUENCE". Example below. Note
> the difference between the following:
>
> 'process_state_subscripti_id_seq'
> 'process_state_subscription_id_s'

The problem is that the CREATE TABLE statement uses the table name, field
name and an identifier "_seq" to generate the sequence name. Because it
knows those values, it is able to intelligently truncate values.

The DROP SEQUENCE statement doesn't know the table name, the field name, or
even that the sequence is being used for a SERIAL field. All it knows is
that the name can't be longer than 32 characters. So when you feed it a
string, the only thing it can really do: truncate the end. It *might* be
possible to parse the string based on separators (underscores) except that
in your example, you use underscores in your table/field names as well, so
what's it to do?

> Might be fixed in 7.1, I dunno. Can anyone confirm this is a problem?

It's a problem for people like you and me, but it's expected behavior.
Personally, I'd love to see someone add a DROP SERIAL that would accept the
Table and Field name and then generate the DROP SEQUENCE statement for you
(hint, hint *g*).

Greg

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message snpe 2001-05-14 14:35:47 Contraints in postgresql ?
Previous Message Ligia Pimentel 2001-05-14 14:28:52 FATAL ERROR running query...