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 1qqXGW-00Asar-Ir for pgsql-general@arkaria.postgresql.org; Wed, 11 Oct 2023 11:20:36 +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 1qqXGU-00FEwS-2A for pgsql-general@arkaria.postgresql.org; Wed, 11 Oct 2023 11:20:34 +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 1qqXGT-00FErk-I4 for pgsql-general@lists.postgresql.org; Wed, 11 Oct 2023 11:20:34 +0000 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qqXGR-0017K2-Rh for pgsql-general@lists.postgresql.org; Wed, 11 Oct 2023 11:20:33 +0000 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-53da72739c3so2298001a12.3 for ; Wed, 11 Oct 2023 04:20:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20230601.gappssmtp.com; s=20230601; t=1697023230; x=1697628030; 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=XriI7Diy3qF8tpGsbhniALYKTDOoerHt0FTkobWX7ZQ=; b=fGfZEf+im4GfPJ+pD8Qy47Ux4SfZQXWyT3NgGhDYyKgVHvFfZNeH7OF4zFXeAKysgK 9VDRdCZwycT3tagum8ZKOSKeeo2phYT/TeCMeYezBwJPfwnF1mi3NSpXbjodSTF7Eqjk rtkYl9NPXQ1AqUx80EmiGw0DY6USvOynsS/zXZ8VDFKDXzk5sKMYTSLfjaTD5RC6olDr okWvks1Eg/ZupO7v/vh5ETwrgb417m21ivB0/BcmgAMA5iybRzAFMFvWKsfaUoc81OAr rBFtcJJSFnHO9S0f83dLx55YKmAP58cLrWtauTB7cIM0IBPqZDCIPuLHG5tuGUk6dmxp 7baw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697023230; x=1697628030; 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=XriI7Diy3qF8tpGsbhniALYKTDOoerHt0FTkobWX7ZQ=; b=doA+QMkdSDL6QVFW39MKkQyLDwyVwPJezg0B3Ytikiw3OCA8ZhuY8fgSNm+IyXL54H j1pdfuYKLthbBWOz++fibgYdBgJs3QpgwBkGHEkzus2FYAu29Yb1TAj6upqhNyvwt4iA l+qDBIYVMfn+lx1tRFcLi1TYXsfQF+0AEfQZXkQjzdBLTxCm89MAxRAFDBVGM4hEj+pa o3M2G1T/WeR18LcHEHMldGoB0HZPmP8aGi68RGM0XByattwcydUdMHuJdw/3144I86gQ yr/oTh1D+QoixfWe2qGizjWO9l8DUNyXzBDUCgOiq6PfRzF3KhHEcYbkotKN6iD51Dch tU7w== X-Gm-Message-State: AOJu0YxXQIqmOjUc9hzeGkY/SktCJkjEbyK6h/xY5WnyATusmz/ZkGPS yS+0E4SXCA2NRU2q0vscCWgjuk5wySon9MJN6Rk= X-Google-Smtp-Source: AGHT+IG6g3Wrk4SHDAjhU14MJiut4tKhYFcoD49FsvBJuwPqJTx2oTyQhxYEDU+q2la5RxAJjCaZtg== X-Received: by 2002:aa7:db45:0:b0:533:520:a5a8 with SMTP id n5-20020aa7db45000000b005330520a5a8mr18480665edt.29.1697023230227; Wed, 11 Oct 2023 04:20:30 -0700 (PDT) Received: from localhost.localdomain ([2001:871:5e:6a2c:cc97:efad:aba0:d0d0]) by smtp.gmail.com with ESMTPSA id n24-20020aa7d058000000b0053331f9094dsm8786041edo.52.2023.10.11.04.20.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 04:20:30 -0700 (PDT) Message-ID: <4734b034a623e8fa9d7522e4b4b7995cd1f3728f.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: Wed, 11 Oct 2023 13:20:29 +0200 In-Reply-To: <5E197F1B-BDDF-40AF-9D87-D6792CE1A3B9@ya.ru> References: <5E197F1B-BDDF-40AF-9D87-D6792CE1A3B9@ya.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 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: > There are two common practice to drop partition from partitioned table: j= ust drop or detach-drop. > But simple drop don't work if exist foreign key. Example script attached. That is working as designed. You cannot detach a partition of a table if a foreign key points to it. Create the foreign key constraints between the partitions instead. Yours, Laurenz Albe