pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: byrnejb@harte-lyne.ca
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: UUID generation problem
Date: Mon, 05 Oct 2020 13:49:39 -0400
Message-ID: <1789313.1601920179@sss.pgh.pa.us> (raw)
In-Reply-To: <403a14de3dc784c868813d275b938866.squirrel@webmail.harte-lyne.ca>
References: <271dfd309957472734a7aab8999659b1.squirrel@webmail.harte-lyne.ca>
	<86544317-8fa2-9193-6af2-6b6e5eab1cba@aklaver.com>
	<d4d8c3b2def5f1cb33bffe21a7085811.squirrel@webmail.harte-lyne.ca>
	<dfc4a83f-c227-684c-c841-e2fa7069bd4b@aklaver.com>
	<13a362eba18fbef24f8170a3e0cd8a9f.squirrel@webmail.harte-lyne.ca>
	<1721392.1601909600@sss.pgh.pa.us>
	<afb165220d3b3404aebaae979fdaeed2.squirrel@webmail.harte-lyne.ca>
	<1732745.1601914016@sss.pgh.pa.us>
	<b1e2554490a1919e2213d85fc57799cd.squirrel@webmail.harte-lyne.ca>
	<1778495.1601916688@sss.pgh.pa.us>
	<403a14de3dc784c868813d275b938866.squirrel@webmail.harte-lyne.ca>

"James B. Byrne" <byrnejb@harte-lyne.ca> writes:
>> It might be worth poking into the pg_db_role_setting catalog,
>> which is the most likely source of a different search_path for
>> different connections.

> It seems so:

> idempiere=# SELECT * FROM pg_db_role_setting;
>  setdatabase | setrole |               setconfig
> -------------+---------+---------------------------------------
>            0 |   21328 | {"search_path=adempiere, pg_catalog"}
> (1 row)

Ah hah!  That explains a good deal: if you connect as role 21328
(whichever that is; do "select 21328::regrole" to confirm), then
your search_path will get changed at the moment of connection.
If you initially connect as some other role, the search_path
stays at default, even if you later SET ROLE to that role.
Probably if you work through what you did, this is enough to
explain all the discrepancies.

To fix, use ALTER ROLE SET or ALTER ROLE RESET to change or drop
this setting.  If you keep it, I'd advise "adempiere, public",
allowing the pg_catalog reference to be implicitly first.
Putting user schemas in front of pg_catalog is generally
hazardous from a security standpoint.

BTW, you might also be well advised to include "IN DATABASE",
to restrict the effects to databases in which
the adempiere schema actually exists.

			regards, tom lane





view thread (53+ messages)  latest in thread

Message-ID: <1789313.1601920179@sss.pgh.pa.us>
Permalink:  ../1789313.1601920179@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1789313.1601920179@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-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, byrnejb@harte-lyne.ca, adrian.klaver@aklaver.com
  Subject: Re: UUID generation problem
  In-Reply-To: <1789313.1601920179@sss.pgh.pa.us>
  References: <271dfd309957472734a7aab8999659b1.squirrel@webmail.harte-lyne.ca> <86544317-8fa2-9193-6af2-6b6e5eab1cba@aklaver.com> <d4d8c3b2def5f1cb33bffe21a7085811.squirrel@webmail.harte-lyne.ca> <dfc4a83f-c227-684c-c841-e2fa7069bd4b@aklaver.com> <13a362eba18fbef24f8170a3e0cd8a9f.squirrel@webmail.harte-lyne.ca> <1721392.1601909600@sss.pgh.pa.us> <afb165220d3b3404aebaae979fdaeed2.squirrel@webmail.harte-lyne.ca> <1732745.1601914016@sss.pgh.pa.us> <b1e2554490a1919e2213d85fc57799cd.squirrel@webmail.harte-lyne.ca> <1778495.1601916688@sss.pgh.pa.us> <403a14de3dc784c868813d275b938866.squirrel@webmail.harte-lyne.ca> <1789313.1601920179@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