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 1qrBIu-002xyv-Gs for pgsql-general@arkaria.postgresql.org; Fri, 13 Oct 2023 06:05:44 +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 1qrBIs-00EkrN-4M for pgsql-general@arkaria.postgresql.org; Fri, 13 Oct 2023 06:05:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qrBIr-00EkqM-PT for pgsql-general@lists.postgresql.org; Fri, 13 Oct 2023 06:05:42 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qrBIp-000Icw-4Q for pgsql-general@lists.postgresql.org; Fri, 13 Oct 2023 06:05:41 +0000 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-99bdeae1d0aso280644266b.1 for ; Thu, 12 Oct 2023 23:05:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20230601.gappssmtp.com; s=20230601; t=1697177139; x=1697781939; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=p7FhHLDvkwSnhPtuQnwwZiHnso8w1abgXvZg0/MwvP8=; b=JNUR2N6/GKlZRuhh8TAvNE+9tor3mgZ8vjM1xH4pVAESjq+odmY3BILPMx/CeB9C1h OBm9AKl5RHh5YfTSd8I1OweepKNTV9m6v3Pn6jZyCP4FQUbhjzDcroQCrjOhRFKy5CaW epn1nv6vLo8wfEDv61s4PC2yd26glHNjB3egX00vN389PVShjvhFa3gPffEv4m/LzlpR e+DezVYfXmD1N31yGFld1g/5JLrP+R4SweYxeHIsJU57Eba2j9+GFglg9xEuR/+1RHFY Q0oUFtFBHggP4px29z4DmrAkLt2EZ/7f5JA6Q1e+KuZc5yWkryF0bpC/nvQjhIqnjf4c bD+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697177139; x=1697781939; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=p7FhHLDvkwSnhPtuQnwwZiHnso8w1abgXvZg0/MwvP8=; b=k+Gx9nRamC94vMc9+HRno0rF8bsoPzgyenfaPo1Mrea26c+PlmA9cWPBGHAn7Y8YKg e38IOlJ7zkWMufy+sTbaZDiMfYBQkmQVqViWqgntHbbzYkI5lYnnAIqbbYeBynnQmwcd 2Rerh1KQqUzMLQr57ThUAdAvgDjhaJdv6G6k6kVWX0KhmhSP9yzTGfyyTXGkYlfE4ELe 4tuNsN/qAi42xDBYbgILqWZcAsmuUwKpOdXUxYl0hfl4Mi50qMnjuv/+7YvYseqUVN3f /TVO7yANNfTsm7aG8U4QaFgC+qvMTopEHb232HO9IVqgJvqIy0wNabPYp1Rm1svtOWOf t+IA== X-Gm-Message-State: AOJu0YxSBinG345O2DELA4itlhnLIJsqnk9ze9rGTbeg1jCJlnyx+YHz 8v8q09sR7qOLzOI/vYr+28Or1EuTSctiX+7VGSk= X-Google-Smtp-Source: AGHT+IF0G0E9a5ugaswo8AgP3ko3LVv66D9To5EEBHM0BtfYsYnCJOJJY361vNqPAfqwzE5and0rcw== X-Received: by 2002:a17:907:60c7:b0:9ba:1a52:77fd with SMTP id hv7-20020a17090760c700b009ba1a5277fdmr12234495ejc.17.1697177139034; Thu, 12 Oct 2023 23:05:39 -0700 (PDT) Received: from localhost.localdomain ([2001:871:5e:39a:9c21:f6c2:efbf:ff4d]) by smtp.gmail.com with ESMTPSA id c12-20020a170906694c00b009b8a4f9f20esm11936489ejs.102.2023.10.12.23.05.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 23:05:38 -0700 (PDT) Message-ID: <77e53f8b7d255e6ca62bf3db3e4dd0336e1a6fee.camel@cybertec.at> Subject: Re: Can not drop partition if exist foreign keys From: Laurenz Albe To: =?UTF-8?Q?=D0=9E=D0=BB=D0=B5=D0=B3_?= =?UTF-8?Q?=D0=A1=D0=B0=D0=BC=D0=BE=D0=B9=D0=BB=D0=BE=D0=B2?= , "pgsql-generallists.postgresql.org" Date: Fri, 13 Oct 2023 08:05:38 +0200 In-Reply-To: <1113211697122316@mail.yandex.ru> References: <5E197F1B-BDDF-40AF-9D87-D6792CE1A3B9@ya.ru> <4734b034a623e8fa9d7522e4b4b7995cd1f3728f.camel@cybertec.at> <1113211697122316@mail.yandex.ru> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2023-10-12 at 17:56 +0300, =D0=9E=D0=BB=D0=B5=D0=B3 =D0=A1=D0=B0=D0= =BC=D0=BE=D0=B9=D0=BB=D0=BE=D0=B2 wrote:=C2=A0 > 11.10.2023, 14:20, "Laurenz Albe" : > > On Wed, 2023-10-11 at 14:08 +0300, =D0=9E=D0=BB=D0=B5=D0=B3 =D0=A1=D0= =B0=D0=BC=D0=BE=D0=B9=D0=BB=D0=BE=D0=B2 wrote: > > > =C2=A0There are two common practice to drop partition from partitione= d table: just drop or detach-drop. > > > =C2=A0But simple drop don't work if exist foreign key. Example script= attached. > >=20 > > That is working as designed. You cannot detach a partition of a table i= f a > > foreign key points to it. > > Nope, of cause any can detach a partition of a empty table even if a fore= ign key points to it. You are right, and I was wrong. You can detach partitions from tables with= a foreign key pointing to them. Yours, Laurenz Albe