Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uScPi-00AR6u-6D for pgsql-general@arkaria.postgresql.org; Fri, 20 Jun 2025 14:08:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uScPf-001pRZ-V2 for pgsql-general@arkaria.postgresql.org; Fri, 20 Jun 2025 14:08:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uScPf-001pRQ-JV for pgsql-general@lists.postgresql.org; Fri, 20 Jun 2025 14:08:16 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uScPe-0034GE-1P for pgsql-general@lists.postgresql.org; Fri, 20 Jun 2025 14:08:15 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-553cf020383so1940570e87.2 for ; Fri, 20 Jun 2025 07:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750428493; x=1751033293; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=JVViQqyaCtLy79PU7sKcMuP758PgI3OUGmy9vuPpxmo=; b=LQe3idgD8atn0dlSzpqGStF5bk46Dy3lPMruf0GPJnrKgU8WO/K+HfQi9bbEY+z51m 8TW26ZaEbq86zqoMq7itbPY16Tkd4wGOcsgvRCQ31LDmFYR8TvoUlgVWABHP7iJ3ChCO q8Nk8PD/RMbT4mbv2Q2XLltECRlrXYqciDfO2CelMwO2PA9dnQJHhNr8v1HxUtnxTbMK XfVwwoYWNxybI2iys/MSHxTiesQIwBQ1Z5LETcrsR+6CxTogu8qYwgJhsu04nXCeNutg WB3aqGOXnk0mmYhDpJuZzsC/yKKz9EEY0EQib663cLFD1afJC8kBQ/pGNgMHaVCOZbo+ lMQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750428493; x=1751033293; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JVViQqyaCtLy79PU7sKcMuP758PgI3OUGmy9vuPpxmo=; b=Vp3RsGTeLSFYN7JwvzaIsapTTz1SrkaZVeN3WVeiuPKeICDwXGntNf1xK8y4Ej/0oz A85FOYBt5YxMz/LwMzZ26ShQ23JSk8K7CQuvBwgbYWiWWSRbyo4n0lLC6yR64arKvI0w Q14AqeiotPBHMRGbqU2a6dtZw5WsUzab1xj7b3wTFrySMoI6hIH/QmTV75VFK/7ji75X fhHtWwxYfcHZg02Cskh1VvY8v+veB5j8T9bl3240QFA5XmFxRTfneWq+eOUY+eMeWjF6 iw+TWjMtDYV/mMczNS7790A9zUko1hCPYLJWmEjWQMxthF0FC7NXSDuKltXqmfHprpao NcsQ== X-Gm-Message-State: AOJu0Yx/LU/mPsKtg3GIfuMRdalyoS7c/79EutnAouF5a4oOgDv3Og7y z37hhFTvnd7kri7TRrkOt6RF4qIxpwkUKC2xa06G3xsZEOYdgnuZwTQ+lbZUvdADGU0QNftPVM3 vki3nJSIlJYtG0ljoBbK0i49zYet1tF0= X-Gm-Gg: ASbGncv+B5N7P3MFyRNT97nY51wb6eody67Kk9fyJc9nbWE2WD2ucnx3Y3OuyB5mIch FVese1hTcZFDhxMFje9CuM14U3CxA0Rz/IivQdTQET3KNDX0L6py9plS+Jtizga9IJ7r1l44RJA dxmH1jWPysRMFUXp4I8MCnQILdIu7HlVO4GubV1QPW/yssMI+D4nqFTuyt0JAB7PdHG3U3e1ojY K4a X-Google-Smtp-Source: AGHT+IFpbYDaBzlc8KIRP8eLkt/UrHhkn0jFE1OLZUVDf3c19wEZfi2t4pPjcWOgkU9Fpp2j0b31OBJy+YQcDyBkDs0= X-Received: by 2002:a05:6512:3055:b0:553:ccef:e31f with SMTP id 2adb3069b0e04-553e3ba78a9mr850751e87.13.1750428492502; Fri, 20 Jun 2025 07:08:12 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Merlin Moncure Date: Fri, 20 Jun 2025 09:07:59 -0500 X-Gm-Features: Ac12FXzYuzSG26GRRyzRZ3RRCBkzpSrN132hEqeP6w-s3NPvdj4E1CnMZbs2gzc Message-ID: Subject: Re: Extension disappearing act To: Dominique Devienne Cc: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000801d7e0638016449" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000801d7e0638016449 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jun 19, 2025 at 8:09=E2=80=AFAM Dominique Devienne wrote: > Hi. Little mystery we don't understand. v17. > > Create new DB, owned by dedicated new ROLE. > Create extension (pgcrypto) in our case. Installed in public, owned by > DB owner role. > Create schemas and populate them inside the DB. > This also creates roles associated to those schemas. > One of the schema is owned by the DB owner (in case that matters). > Creates functions using pgcrypto, in some of those schemas. > Drop all schemas (and associated roles), thus pgcrypto-using functins are > gone. > Of course, the DB owner role was not dropped. Can't in fact. > Somehow, the pgcrypto extension has disappeared, as side-effects of the > drops. > We did a LIBPQ trace of the command to does all the drops, > Suggestion: 1. Turn on statement logging to 'all'. Make sure times are logged 2. Install a trace. this could be as simple as: select now(), count(*) FILTER (WHERE extname =3D 'pgcrypto') from pg_extension ; \watch ...in psql 3. that should nail the time of the drop. at that time, you can then find the offending statement merlin --000000000000801d7e0638016449 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Thu, Jun 19,= 2025 at 8:09=E2=80=AFAM Dominique Devienne <ddevienne@gmail.com> wrote:
Hi. Little mystery we don't understand= . v17.

Create new DB, owned by dedicated new ROLE.
Create extension (pgcrypto) in our case. Installed in public, owned by
DB owner role.
Create schemas and populate them inside the DB.
This also creates roles associated to those schemas.
One of the schema is owned by the DB owner (in case that matters).
Creates functions using pgcrypto, in some of those schemas.
Drop all schemas (and associated roles), thus pgcrypto-using functins are g= one.
Of course, the DB owner role was not dropped. Can't in fact.
Somehow, the pgcrypto extension has disappeared, as side-effects of the dro= ps.
We did a LIBPQ trace of the command to does all the drops,
=

=C2=A0Suggestion:
1. Turn on statement loggin= g to 'all'.=C2=A0 Make sure times are logged
2. Install a= trace. this could be as simple as:
select now(), count(*) FILTER= (WHERE extname =3D 'pgcrypto') from pg_extension ;
\watc= h
...in psql
3. that should nail the time of the drop. = at that time, you can then find the offending statement

merlin
--000000000000801d7e0638016449--