Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 10104479F60 for ; Wed, 29 Jan 2003 00:18:54 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 7E60C476CEF for ; Tue, 28 Jan 2003 23:41:02 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id h0T4ew5u019364; Tue, 28 Jan 2003 23:40:58 -0500 (EST) To: "Nigel J. Andrews" Cc: Michiel Lange , pgsql-hackers@postgresql.org, Peter Eisentraut Subject: Re: [ADMIN] Cannot connect to the database (PG 7.3) In-reply-to: References: Comments: In-reply-to "Nigel J. Andrews" message dated "Wed, 29 Jan 2003 01:44:55 +0000" Date: Tue, 28 Jan 2003 23:40:58 -0500 Message-ID: <19363.1043815258@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/1096 X-Sequence-Number: 34706 >> 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