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 1kZthX-0001Dn-NR for pgsql-admin@arkaria.postgresql.org; Tue, 03 Nov 2020 10:38:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kZthW-0005r2-NI for pgsql-admin@arkaria.postgresql.org; Tue, 03 Nov 2020 10:38:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kZthW-0005qv-9I for pgsql-admin@lists.postgresql.org; Tue, 03 Nov 2020 10:38:06 +0000 Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kZthT-0000JE-Ux for pgsql-admin@postgresql.org; Tue, 03 Nov 2020 10:38:05 +0000 Received: by mail-qk1-x732.google.com with SMTP id b18so14154255qkc.9 for ; Tue, 03 Nov 2020 02:38:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=yW+1nfyvqBmZcrqeS4b1llYeXBuJy2lLNXgwiXPTldk=; b=orkKU7bcpQfUCnN9137uAYKTfAAxoueQAETqD3422GAa0tsamm2GAQ68Y8yYYdUPPY VgYU1zVthob3sShQLtZ3mh+itJw0je3wRLCF4/9vz+J1AHm1wY3i8dgg74BPBm+7tO4w NobGyN9XQ5T+s2BqtrNCQwQ/y2aGX9CtY6rXME9MUyiT9Njmra1jHNUoM2xIQ9PSFb+t wWREoOc3oWN7pvx5FDyKaa0Ma0b1O5QXAbrpqNRwXWPAsh4+oF4JCcYUVodjiGAhIRrX T5CwjO6iFaehhKe398UVNkcCA4N1vkHXzJbueDhAxvF6JPurTNh2w8pvjJNL5LUsz6mV 3f0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=yW+1nfyvqBmZcrqeS4b1llYeXBuJy2lLNXgwiXPTldk=; b=WAfO9EEu4w0iWpXqJKg1xzlFwyT9IC1AminF/3/TCn8rTeOEipj/Eb9kZVn2MCozVW a0TLQulbaWlZKRkqp5X49jahx9UE3vvtLwvONZZEvvEplEsLvfXy4UI8wGA0hxuIIN+4 8edsV/EHONBGMlFZqMVurEHWbbi1iFzR3ilZIsJXxRZZFRT8MQVgWgn3J8KN/H4d0pUv j90xP9PxI9bxf/ng9RG/z65zx1RqPFU6a+mmBLY3u+GjvRaTcgcEwLRM2oSd9f3OF6ha zZKI3fWxkX13VHkDPWlas/T9tqYqinu6bBbNXiTS+eFZo/hBL+5tVLyR7JgVZHP4UgdZ bh+g== X-Gm-Message-State: AOAM533mOEHSG7VpzFgNcQPa1WaeJCEhW2niCgVNYomjkDUpKSl2wHGh hoQ/RtZ0UV11bgDY6prADH8= X-Google-Smtp-Source: ABdhPJxKpBe4p3jMgz7raZygC6sFGmku7E4k1yCb7af2tUv8uBbBj6ssBp95IaIGoeGh/dOOJVdNcA== X-Received: by 2002:ae9:e316:: with SMTP id v22mr19276492qkf.442.1604399882712; Tue, 03 Nov 2020 02:38:02 -0800 (PST) Received: from [192.168.1.35] (cpe-71-72-37-104.neo.res.rr.com. [71.72.37.104]) by smtp.gmail.com with ESMTPSA id r19sm5065584qtm.4.2020.11.03.02.38.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Nov 2020 02:38:02 -0800 (PST) Content-Type: multipart/alternative; boundary=Apple-Mail-E13C5F59-8830-4083-8F13-9A9D4F32CB37 Content-Transfer-Encoding: 7bit From: John Scalia Mime-Version: 1.0 (1.0) Subject: Re: Maybe a possible bug in the partitioning code? Date: Tue, 3 Nov 2020 05:38:00 -0500 Message-Id: References: Cc: Tom Lane , pgsql-admin In-Reply-To: To: Keith X-Mailer: iPad Mail (18A8395) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail-E13C5F59-8830-4083-8F13-9A9D4F32CB37 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Not at all a silly question, Keith. I know that I=E2=80=99ve also done that i= n the past. The issue here, though is I never disconnected from the developm= ent database, and \dt *.table_name produces nothing, while trying to rerun t= he script still produces the error that the table_name already exists. It=E2= =80=99s incredibly strange, as I=E2=80=99ve never had PostgreSQL fail to rol= lback a complete transaction block. To work around it, I just changed the na= me of the partition child table. Since this is just a dev database, I don=E2= =80=99t really care if something is hanging out that no one can see. Sent from my iPad > On Nov 3, 2020, at 12:13 AM, Keith wrote: >=20 > =EF=BB=BF >=20 >=20 >> On Mon, Nov 2, 2020 at 11:38 AM John Scalia wrot= e: >> Ok I also tried that Tom. Psql returned =E2=80=9CDid not find any relatio= ns named =E2=80=9C=E2=80=98.temp_my_table_global=E2=80=9D >>=20 >> Sent from my iPad >>=20 >> > On Nov 2, 2020, at 11:31 AM, Tom Lane wrote: >> >=20 >> > =EF=BB=BFJohn Scalia writes: >> >> While I=E2=80=99m waiting for my devs to confirm the first table that I= partitioned is working correctly, I started working on second of three that= I need to do. So, I added the code to end of my original script, but there w= as a typo in it. Now, as this code runs in a transaction block, so I don=E2=80= =99t think anything it created should actually be present in the database, b= ut on a subsequent rerunning, I got an error that one of the partition table= s actually exists already. However, I cannot see it, nor drop it from the se= rver. The error in the script is: relation =E2=80=9Ctemp_my_second_table_glo= bal=E2=80=9D already exists, but the system cannot see it in order to drop i= t, saying =E2=80=9Ctemp_my_second_table_global=E2=80=9D does not exist. That= =E2=80=99s really a catch-22. Is there a system table where I can look and m= aybe drop it from there directly? >> >=20 >> > Kinda sounds like a confusion over search_path, ie script is creating >> > table in some schema that's not in your interactive search path? >> >=20 >> > In psql, try >> > \d *.temp_my_second_table_global >> > to see instances of temp_my_second_table_global in all schemas. >> >=20 >> > regards, tom lane >>=20 >>=20 >=20 > I know this seems a silly question but are you sure you're connecting to t= he same database when you run your script vs when you're logging in to check= ? Made the same mistake many times myself that led to all kinds of confusion= . >=20 > Keith --Apple-Mail-E13C5F59-8830-4083-8F13-9A9D4F32CB37 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Not at all a silly question, Keith. I know t= hat I=E2=80=99ve also done that in the past. The issue here, though is I nev= er disconnected from the development database, and \dt *.table_name produces= nothing, while trying to rerun the script still produces the error that the= table_name already exists. It=E2=80=99s incredibly strange, as I=E2=80=99ve= never had PostgreSQL fail to rollback a complete transaction block. To work= around it, I just changed the name of the partition child table. Since this= is just a dev database, I don=E2=80=99t really care if something is hanging= out that no one can see.

Sent from my iPad

On Nov 3, 2020, at 12:13 AM, Kei= th <keith@keithf4.com> wrote:

=EF=BB=BF

=

O= n Mon, Nov 2, 2020 at 11:38 AM John Scalia <jayknowsunix@gmail.com> wrote:
Ok I also tried that Tom. Psql returned =E2= =80=9CDid not find any relations named =E2=80=9C=E2=80=98.temp_my_table_glob= al=E2=80=9D

Sent from my iPad

> On Nov 2, 2020, at 11:31 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> =EF=BB=BFJohn Scalia <jayknowsunix@gmail.com> writes:
>> While I=E2=80=99m waiting for my devs to confirm the first table th= at I partitioned is working correctly, I started working on second of three t= hat I need to do. So, I added the code to end of my original script, but the= re was a typo in it. Now, as this code runs in a transaction block, so I don= =E2=80=99t think anything it created should actually be present in the datab= ase, but on a subsequent rerunning, I got an error that one of the partition= tables actually exists already. However, I cannot see it, nor drop it from t= he server. The error in the script is: relation =E2=80=9Ctemp_my_second_tabl= e_global=E2=80=9D already exists, but the system cannot see it in order to d= rop it, saying =E2=80=9Ctemp_my_second_table_global=E2=80=9D does not exist.= That=E2=80=99s really a catch-22. Is there a system table where I can look a= nd maybe drop it from there directly?
>
> Kinda sounds like a confusion over search_path, ie script is creating > table in some schema that's not in your interactive search path?
>
> In psql, try
>   \d *.temp_my_second_table_global
> to see instances of temp_my_second_table_global in all schemas.
>
>            regards, tom lane



I know this seems a silly question but a= re you sure you're connecting to the same database when you run your script v= s when you're logging in to check? Made the same mistake many times myself t= hat led to all kinds of confusion.

Keith
<= /div>
= --Apple-Mail-E13C5F59-8830-4083-8F13-9A9D4F32CB37--