Re: pgsql/src/backend/postmaster postmaster.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql/src/backend/postmaster postmaster.c
Date: 2001-02-20 16:39:17
Message-ID: 12858.982687157@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Tom Lane writes:
>> Log message:
>> Truncate incoming username and database name to NAMEDATALEN-1 characters
>> so that we don't reject overlength names unnecessarily.

> Is this necessarily a good idea? ISTM that if you send the wrong name,
> then it's wrong, period.

No, the problem was inconsistent truncation in different places.
Whilst fixing pg_passwd's clearly-broken truncation to 8 characters,
I experimented with overlength names, and found:

regression=# create user a1234567890123456789012345678901234567890;
NOTICE: identifier "a1234567890123456789012345678901234567890" will be truncated to "a123456789012345678901234567890"
CREATE USER

which is fine, but then feeding that same username to psql resulted in
failure to connect, because it was effectively truncated to 32 chars not
31, and so didn't match any pg_shadow entries. If we're going to accept
and truncate overlength identifiers for usernames, then we should do so
consistently.

regards, tom lane

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian - CVS 2001-02-20 17:25:42 pgsql/doc TODO
Previous Message Peter Eisentraut 2001-02-20 15:53:15 Re: pgsql/src/backend/postmaster postmaster.c