Re: hackers-digest V1 #894

From: Hannu Krosing <hannu(at)trust(dot)ee>
To: pgsql-hackers(at)hub(dot)org
Subject: Re: hackers-digest V1 #894
Date: 1998-07-27 08:46:53
Message-ID: 35BC3E7D.B7630505@trust.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Date: Sun, 26 Jul 1998 21:43:17 +0200 (MET DST)
> From: Maarten Boekhold <maartenb(at)dutepp0(dot)et(dot)tudelft(dot)nl>
> Subject: Re: [HACKERS] Minor bug: inconsistent handling of overlength names
>
> On Sun, 26 Jul 1998, Tom Lane wrote:
>
> > DROP INDEX fails on overlength table names:
> >
> > tgl=> CREATE UNIQUE INDEX MarketOrderHistory_sequenceNo_Index
> > tgl-> ON MarketOrderHistory USING btree (sequenceNo);
> > CREATE
> > tgl=> DROP INDEX MarketOrderHistory_sequenceNo_Index;
> > ERROR: pg_ownercheck: class "marketorderhistory_sequenceno_index" not found
> > tgl=> DROP INDEX MarketOrderHistory_sequenceNo_I;
> > DROP
> >
> > Evidently DROP INDEX is using a second-rate way of reducing the given
> > name to canonical form for comparisons.
> >
> > Some further experimentation shows that CREATE TABLE won't let you
> > create a relation name >= 32 characters in the first place. So there's
> > some inconsistency about what's done with overlength names.
> >
> > It seems to me that we ought to have consistent treatment of long names,
> > and the treatment I like is the one that CREATE INDEX is using:
> > silently truncate the given name to what we can handle, and accept
> > it as long as the truncated form is unique. This is the time-honored
> > way of handling overlength names in compilers, and it works well.
>
> Same thing goes for user-names. I recently created a user named (for the
> sake of example) '1234567890', using CREATE USER. No complaints here, but
> trying to connect with user '1234567890' fails. You can connect with
> '12345678'.

And the actual username can be 32 bytes ;(

investor=> \d pg_user

Table = pg_user
+----------------------------------+----------------------------------+-------+
| Field | Type |
Length|
+----------------------------------+----------------------------------+-------+
| usename | name
| 32 |
| usesysid | int4
| 4 |
| usecreatedb | bool
| 1 |
| usetrace | bool
| 1 |
| usesuper | bool
| 1 |
| usecatupd | bool
| 1 |
| passwd | text
| var |
| valuntil | abstime
| 4 |
+----------------------------------+----------------------------------+-------+

----------------
Hannu

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter T Mount 1998-07-27 10:56:16 Re: [HACKERS] current snapshot
Previous Message Thomas G. Lockhart 1998-07-27 06:51:37 Re: [HACKERS] Bogus "Non-functional update" notices