Re: strange problem with not existing roles

From: "ludwig(at)kni-online(dot)de" <ludwig(at)kni-online(dot)de>
To: "Adrian Klaver" <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: strange problem with not existing roles
Date: 2014-09-18 16:44:53
Message-ID: trinity-8c70f648-bee6-48fa-8b62-e1498e521bd8-1411058693031@3capp-1and1-bs03
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Hi Adrian,</div>

<div>this database runs as develop-version on my PC and was created by hand, no dumps or pg_upgrade.</div>

<div>&nbsp;</div>

<div>The same database runs as production-version on another server (PostgreSQL 9.3.1, compiled by Visual C++ build 1600, 32-bit), so far without these problems.</div>

<div>&nbsp;</div>

<div>pgAdmin shows a mix of the normal roles and these &quot;ghost-roles&quot;, I don&#39;t know the queries running in pgAdmins-background for that result.</div>

<div>&nbsp;</div>

<div>[SNIP]</div>

<div>select * from pg_roles where oid in(10, 482499, 17708, 17687);</div>

<div>=&gt;</div>

<div>[SNIP]</div>

<div>
<div>kniprath;t;t;t;t;t;t;f;-1;********;infinity;;17687<br/>
postgres;t;t;t;t;t;t;t;-1;********;infinity;;10</div>

<div>[/SNIP]</div>

<div>&nbsp;</div>

<div>[SNIP]</div>

<div>select * from pg_roles where rolname in(&#39;482499&#39;, &#39;17708&#39;);</div>

<div>[/SNIP]</div>

<div>=&gt; empty result</div>

<div>&nbsp;</div>

<div>One tested workaround was to dump the schema-contents (tables, sequences, functions etc.), drop and recreate the schema and restore the dumped contents.</div>

<div>But I&#39;m curious about what has caused the problems and how to avoid them...</div>

<div>&nbsp;</div>

<div>Ludwig</div>
</div>

<div>&nbsp;
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b>&nbsp;Donnerstag, 18. September 2014 um 15:53 Uhr<br/>
<b>Von:</b>&nbsp;&quot;Adrian Klaver&quot; &lt;adrian(dot)klaver(at)aklaver(dot)com&gt;<br/>
<b>An:</b>&nbsp;&quot;ludwig(at)kni-online(dot)de&quot; &lt;ludwig(at)kni-online(dot)de&gt;, pgsql-general(at)postgresql(dot)org<br/>
<b>Betreff:</b>&nbsp;Re: [GENERAL] strange problem with not existing roles</div>

<div name="quoted-content">On 09/18/2014 04:12 AM, ludwig(at)kni-online(dot)de wrote:<br/>
&gt; Hi Adrian,<br/>
&gt; data got into the database with normal update/insert-queries from<br/>
&gt; logged-in database-users using &quot;normal&quot; PG-Users/roles,<br/>
&gt; the &quot;ghost-roles&quot; (with these unusual numerical role-names) were never<br/>
&gt; created by me, I don&#39;t know where they come from.<br/>
<br/>
I should have been more specific.<br/>
<br/>
Did the database get created by restoring a dump file from somewhere, or<br/>
via pg_upgrade or just by creating the schema and adding data over time?<br/>
<br/>
The numeric part, at least as shown below, is the oid of the role and<br/>
all roles have that. The question is whether pgAdmin is showing the oid<br/>
or the actual role name? See below for a queries to help determine that.<br/>
<br/>
&gt; The query<br/>
&gt; [SNIP]<br/>
&gt; SELECT * FROM pg_catalog.pg_auth_members WHERE member in<br/>
&gt; (&#39;243683&#39;,&#39;243666&#39;,&#39;243689&#39;,&#39;482499&#39;,&#39;482499&#39;,&#39;17708&#39;);<br/>
&gt; [/SNIP]<br/>
&gt; has the following result:<br/>
&gt; [SNIP]<br/>
&gt; roleid;member;grantor;admin_option;<br/>
&gt; 17699;17708;10;f<br/>
&gt; 17699;482499;17687;f<br/>
&gt; 17701;243666;17687;f<br/>
&gt; 17699;243683;17687;f<br/>
&gt; 17710;243689;17687;f<br/>
&gt; [/SNIP]<br/>
<br/>
So what is the result if you do?:<br/>
<br/>
select * from pg_roles where oid in(10, 482499, 17708, 17687);<br/>
<br/>
select * from pg_roles where rolname in(&#39;482499&#39;, &#39;17708&#39;);<br/>
<br/>
10 should be the postgres role, it is the others that are of interest.<br/>
<br/>
&gt; Yust a thought:<br/>
&gt; In some schemas the public user has full default-privileges (it&#39;s for<br/>
&gt; uploading GIS-data from Shapefiles, each uploaded file generates a new<br/>
&gt; table).<br/>
<br/>
So who originaly created the schema?<br/>
<br/>
&gt; [SNIP]<br/>
&gt; ALTER DEFAULT PRIVILEGES IN SCHEMA user_data<br/>
&gt; GRANT INSERT, SELECT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER<br/>
&gt; ON TABLES<br/>
&gt; TO public;<br/>
&gt; [/SNIP]<br/>
&gt; Another thought:<br/>
&gt; Each &quot;normal&quot; DB-user has *one* granted role, but some of theses roles<br/>
&gt; themselves can have mutliple granted subroles.<br/>
&gt; Perhaps a reason for my problems?<br/>
<br/>
Not sure. At this point just trying to establish the current state.<br/>
<br/>
&gt; Ludwig<br/>
<br/>
--<br/>
Adrian Klaver<br/>
adrian(dot)klaver(at)aklaver(dot)com<br/>
<br/>
<br/>
--<br/>
Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)<br/>
To make changes to your subscription:<br/>
<a href="http://www.postgresql.org/mailpref/pgsql-general" target="_blank">http://www.postgresql.org/mailpref/pgsql-general</a></div>
</div>
</div>
</div></div></body></html>

Attachment Content-Type Size
unknown_filename text/html 4.7 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2014-09-18 16:54:19 Re: Why isn't Java support part of Postgresql core?
Previous Message cowwoc 2014-09-18 16:07:52 Re: Why isn't Java support part of Postgresql core?