Re: failure to drop table due to pg_temp_7 schema

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: failure to drop table due to pg_temp_7 schema
Date: 2025-11-15 15:28:18
Message-ID: CANzqJaD-J8kSsmvUC+9W5hix8WtKkvhr4UGDKggwheRusvVRtg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Nov 15, 2025 at 10:00 AM Peter 'PMc' Much <
pmc(at)citylink(dot)dinoex(dot)sub(dot)org> wrote:

>
> Hi,
> trying to unload (and then reload) a development application,
> failed with this error:
>
> fin(dev)> Que.migrate! version: 0
> ERROR: cannot drop table que_jobs because other objects depend on it
> (PG::DependentObjectsStillExist)
> DETAIL: function pg_temp_7.lock_and_update_priorities(jsonb,que_jobs)
> depends on type que_jobs
> HINT: Use DROP ... CASCADE to drop the dependent objects too.
>
>
> The routine was trying to remove all database objects in the order
> they were formerly created,

In the *REVERSE* order they were created?

[snip]

> I would rather figure out what actually went wrong (and then probably
> fix it for the future).
>
> So I started to investigate. Enabling "System Objects" in pgadmin4,
> I find a vast amount of pg_temp_### schemas, and therein I actually
> find the offending object - it indeed contains some stuff the Que
> software would probably use.
>
> Then, trying to figure out how this is supposed to be cleaned up,
> I find this article by subject matter expert Laurenz Albe:
> https://stackoverflow.com/a/79693897
>
> Temporary tables are automatically removed when the database
> session terminates. Consequently, your users are running long
> database sessions.
>
> Sadly, this does not make much sense to me, because there are
> (currently) no sessions on the database (checked with 'ps ax').
>

Abnormal session termination is the typical reason for them to hang around.

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2025-11-15 15:43:36 Re: failure to drop table due to pg_temp_7 schema
Previous Message Peter 'PMc' Much 2025-11-15 14:57:51 failure to drop table due to pg_temp_7 schema