pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nigel J. Andrews <nandrews@investsystems.co.uk>
Cc: Michiel Lange <michiel@minas.demon.nl>
Cc: pgsql-hackers@postgresql.org, Peter Eisentraut <peter_e@gmx.net>
Subject: Re: [ADMIN] Cannot connect to the database (PG 7.3)
Date: Tue, 28 Jan 2003 23:40:58 -0500
Message-ID: <19363.1043815258@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.21.0301290142170.2839-100000@ponder.fairway2k.co.uk>
References: <Pine.LNX.4.21.0301290142170.2839-100000@ponder.fairway2k.co.uk>

>> After some looking, it appears the culprit is
>> assign_session_authorization() in commands/variable.c, which is assuming
>> that a numeric-looking parameter string should be taken as a numeric
>> user sysid, rather than an actual user name.
>> 
>> The reason this was done was to avoid the need to do catalog lookups
>> when restoring a prior setting during error recovery.  That's still a
>> valid concern, so right offhand I don't see an easy fix.  Any ideas?

I've got an idea ... it's a bit grotty, but certainly not as ugly as
prohibiting all-numeric user names.

The problem for assign_session_authorization is to store a numeric sysid
in a form that can't be mistaken for a user name.  There is no string
that can't be generated by a quoted identifier (except for strings with
embedded nulls, which won't really help us here).  However, there *is*
the NAMEDATALEN limit.  What if we generate strings consisting of, say,
NAMEDATALEN+1 'x's and then the numeric sysid?

This might seem a tad wasteful of storage, but at most a couple of such
strings need be stored at one time, so it's really insignificant (the
code space to implement any more-complex solution would probably be
more).

If anyone has a cleaner solution, let's hear it; otherwise I'll put this
in.

			regards, tom lane



view thread (16+ messages)  latest in thread

Message-ID: <19363.1043815258@sss.pgh.pa.us>
Permalink:  ../19363.1043815258@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19363.1043815258@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, nandrews@investsystems.co.uk, michiel@minas.demon.nl, peter_e@gmx.net
  Subject: Re: [ADMIN] Cannot connect to the database (PG 7.3)
  In-Reply-To: <19363.1043815258@sss.pgh.pa.us>
  References: <Pine.LNX.4.21.0301290142170.2839-100000@ponder.fairway2k.co.uk> <19363.1043815258@sss.pgh.pa.us>

* 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