Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kPUcO-0005fP-Mw for pgsql-general@arkaria.postgresql.org; Mon, 05 Oct 2020 17:49:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kPUcN-0004tC-L7 for pgsql-general@arkaria.postgresql.org; Mon, 05 Oct 2020 17:49:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kPUcN-0004t5-Dh for pgsql-general@lists.postgresql.org; Mon, 05 Oct 2020 17:49:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kPUcL-0006kQ-D3 for pgsql-general@lists.postgresql.org; Mon, 05 Oct 2020 17:49:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 095Hnd9a1789314; Mon, 5 Oct 2020 13:49:39 -0400 From: Tom Lane To: byrnejb@harte-lyne.ca cc: "Adrian Klaver" , pgsql-general@lists.postgresql.org Subject: Re: UUID generation problem In-reply-to: <403a14de3dc784c868813d275b938866.squirrel@webmail.harte-lyne.ca> References: <271dfd309957472734a7aab8999659b1.squirrel@webmail.harte-lyne.ca> <86544317-8fa2-9193-6af2-6b6e5eab1cba@aklaver.com> <13a362eba18fbef24f8170a3e0cd8a9f.squirrel@webmail.harte-lyne.ca> <1721392.1601909600@sss.pgh.pa.us> <1732745.1601914016@sss.pgh.pa.us> <1778495.1601916688@sss.pgh.pa.us> <403a14de3dc784c868813d275b938866.squirrel@webmail.harte-lyne.ca> Comments: In-reply-to "James B. Byrne" message dated "Mon, 05 Oct 2020 12:59:05 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1789312.1601920179.1@sss.pgh.pa.us> Date: Mon, 05 Oct 2020 13:49:39 -0400 Message-ID: <1789313.1601920179@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "James B. Byrne" 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