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.96) (envelope-from ) id 1vWuoi-00Ci8K-0u for pgsql-hackers@arkaria.postgresql.org; Sat, 20 Dec 2025 11:08:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vWuoh-00ADDg-0c for pgsql-hackers@arkaria.postgresql.org; Sat, 20 Dec 2025 11:08:07 +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.96) (envelope-from ) id 1vWuog-00ADDY-2t for pgsql-hackers@lists.postgresql.org; Sat, 20 Dec 2025 11:08:07 +0000 Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vWuof-001eil-2w for pgsql-hackers@lists.postgresql.org; Sat, 20 Dec 2025 11:08:06 +0000 Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-65cf597a717so1037433eaf.2 for ; Sat, 20 Dec 2025 03:08:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766228884; x=1766833684; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=/SNS+2syEHPoAub25H6binUBEYn7bVgNU0RiOjLg9jY=; b=WmGDSZb2y87MMFvyTjwzFPNUXsojuWGL8sB2eMRJUsAzXS3B9vQ+EJ2y1AcyLBmj19 MpCfLgtY3h3CMJBfp4O9cjjOVUjyJyq4Cj5liZUUeJIAwT2zQwhb2Rx848oN77ugBZAT m9q3W2+dJ/tmM9AdBUI7QBu9CdcRdEc62F5tcmjNC7NlLTOjCzyC8lBqokzClji8e79a jec5oAqif+8jVbSnepwQu3dEI6FwwCPtJuXPMaZ7fueFvqgSojmFjyvjhAlqkaMzizpD SqOZiGW3lVE+Q0lZvmpxyEfaM23iOqb6jtpB3x0nioTSynz5Nb/DBfKW7cFL3dWAOLpf 0Vcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766228884; x=1766833684; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=/SNS+2syEHPoAub25H6binUBEYn7bVgNU0RiOjLg9jY=; b=mfECQj4QCbg3i1CFbdJlzQ7P9HUyTF/BM25e+P+aS7rO+LWqiC6rCWiLnQB6XrN0la VLbiBq5Fx+qJFWrYZRkPHM+hc8Oak9L7EAx8p9XwRW3pXQxJNK7LN2qvADYWsyUnL7ni HlbWDZ7+kK5bRK/4wX4gYGXc5LDxWUJhdmT8KHYhWW3eMdH/78DBCWVKLfT0c5ZifcEB OF3Mw0aMK6+OAU3TUTRVqzWeMgTE9HYXwR3x+xQ7EEJBt5dRdYKg2uSSvqxPcp9Lk800 Sp8pDvw6lgWT1ZVH5Sj/xQCUoWaJ8517nCcO7G5uABgyfJjUFWyFTpzDi0gdFXQxQjAw 7rDw== X-Gm-Message-State: AOJu0YxMVGD1838svDmu/+Dm4bj3WiLkMTZo8eP9oU96mS0zWbTmfjb5 cBC8jUNo8K+UJU3tFmflgBlwLUaUSyyF5ce6Y9ka4ufo7bdcUY0wL5f61IWfzt2zufZTArbQdHx mHP2r4zxB7o85BWv4BYsRCCL0Bh19AS4= X-Gm-Gg: AY/fxX49Y1k1RDQKOR+qs+3l8wy2waGFSpptN+NJJsbSV7kdBCwVYUI7hQt5gU4yiwQ hp4FO4etpsyORqBSALUcXEcY5rcNXr00OuhRCyrSWp+B27WDiz3YKQTKqexmGMvLJjcfC6jegFb tU2G5YzbXAOWQJpxO9Oxdj2DVMD72/gAYScpINYJXApi2sfDpgFm7J9G3/Nx/3iMHN5Mq9pHILj O1Kz1dE3mnJfIDuLwBlucYnZlUtoQ8Mpph5tf9IcxewUPxz1az1p6lg9ASYPZdcaCESAgIUQDHu +8OX8sRwK2rn1bTVVrPB5CW92GUpYbkS4vqBtqq3QtExmeNMa3EQ9YhXolW+QKocl+DeF/R070C GSIcs X-Google-Smtp-Source: AGHT+IHWkUpeMYbyFSHCUQKcFC7obl/SiL6dQRle7jh9fCIls1Kz0k1ytAZoRH5d5mdtqY4MyqKQ7IafdKOen7gnT78= X-Received: by 2002:a4a:b34a:0:b0:65c:fc52:c347 with SMTP id 006d021491bc7-65d0e9fe39amr1702349eaf.14.1766228884355; Sat, 20 Dec 2025 03:08:04 -0800 (PST) MIME-Version: 1.0 References: <171085360143.2046436.7217841141682511557.pgcf@coridan.postgresql.org> <2643645f-2a02-43de-9321-c995ab1b7ef8@postgrespro.ru> <57a94d8a-d7b6-4c5e-9001-be1cd403b172@postgrespro.ru> <54414932-9E82-47AA-902B-2DED18F07F64@gmail.com> <3280c458-a886-4c58-8e2b-4d220b73161d@postgrespro.ru> <09414bf8-9326-431c-9422-b13bddf5f554@postgrespro.ru> <29ff27f5-d359-4479-b11c-ce28e525d806@postgrespro.ru> In-Reply-To: From: Alexander Korotkov Date: Sat, 20 Dec 2025 13:07:51 +0200 X-Gm-Features: AQt7F2r46APuVIT6aOcuD9NgcWauiGeYIObfl7f2hhDkiO6DozKKvnqJSwemweU Message-ID: Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands To: Tender Wang Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Tender, On Sat, Dec 20, 2025 at 5:18=E2=80=AFAM Tender Wang wr= ote: > I found this feature merged; thanks for this work. > I tested it and found that one place in the error errcode may need to be = changed. > In checkPartition(): > ... > if (get_partition_parent(partRelOid, false) !=3D RelationGetRelid(rel)) > ereport(ERROR, > errcode(ERRCODE_UNDEFINED_TABLE), > errmsg("relation \"%s\" is not a partition of relation \"%s\"", > ... > > ERRCODE_UNDEFINED_TABLE usually means "table does not exist." > When entering here, the table should exist, otherwise table_open() alread= y reports an error. > I found another two errcode in checkPartition() use ERRCODE_WRONG_OBJECT_= TYPE, > In the attached patch, I replace ERRCODE_UNDEFINED_TABLE with ERRCODE_WRO= NG_OBJECT_TYPE. I agree with you that ERRCODE_UNDEFINED_TABLE is certainly wrong error code because the table actually exists. ERRCODE_WRONG_OBJECT_TYPE is better. For example, we throw it when trying to attach a partition to non-partitioned table. So, the parent table type is wrong. However, are objects in the situation under consideration really have wrong type? The problem is that one table is not partition of another. However, it's possibly that they could be attached without changing of their types. So, I think about ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE. What do you think? ------ Regards, Alexander Korotkov Supabase