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 1wVQXQ-001x6r-2Z for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jun 2026 09:08:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wVQXP-00BHVp-2W for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jun 2026 09:08:23 +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.96) (envelope-from ) id 1wVQUB-00BCId-10 for pgsql-hackers@lists.postgresql.org; Fri, 05 Jun 2026 09:05:03 +0000 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wVQU9-00000001ONi-13Tg for pgsql-hackers@lists.postgresql.org; Fri, 05 Jun 2026 09:05:03 +0000 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-3965f215817so16199001fa.3 for ; Fri, 05 Jun 2026 02:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780650299; x=1781255099; darn=lists.postgresql.org; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:cc:to:date:from:sender:from:to:cc :subject:date:message-id:reply-to; bh=/Gt9B7R0CLyffk4tqtBWtQAyyWBGEnPxcngF8g08k+w=; b=hxnjE/QgrmRjKVWjFMN+WUnvd+vua/4JOPc1nU6XTE38r+KpB95gfKvPEDSu7QIntQ oJVWZ5yE47mVwKTZTHDXw+3mgxOzLlsuxL2a1e08jdmyLcRpsgrhlBn+R0pnHY9bCtjs 517l0PDqIJbYfOgGa6ku9e/xQCsEEsa06rRMZ3X094qRik285FMANKA5a9QbNwEbUV5r tx8++3gKe0vT5CBHKubjVxakgqmrLq8z9QCdA87ueS8n2eqDWCOvWFj6nqnadCtixgqX Ybp+oLi0XfdV38OMGF9ZD/joQ+t1DNSs1/N9JULlhq6FPVlfgueWskZXNoW+sYyhgkTT hS2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780650299; x=1781255099; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:cc:to:date:from:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/Gt9B7R0CLyffk4tqtBWtQAyyWBGEnPxcngF8g08k+w=; b=eXdsLghKiRqpPqPic+85ahxXxvHxOvXbb/a6eagxScm/n9pAEnSQCpG6oe1k5G7q95 aS4hAIlech2HuILItIlQSsJteM2h0N6PlxRXMiLKDaydf6oNo9q/vJb2AUi/4dLpWhcc uosnSbpkNGpEffvSTVvh2Kh/F3T3V94yLyRD/i8AScGPmyJvdEntbtovSGoTCahUzc0l 6R5B82i81eJVoVQfFx9oQhoUl/TCmyG58LOGhgnGvyZ1DJHPNrEeEGB41xvO4zVU70IT TFk7o4ZvpVCaLg5IxwjRHmAUe2pS1IJef1cLm63LJfeL4nI2sR63lE5syEJjXcz+yA33 tpPg== X-Forwarded-Encrypted: i=1; AFNElJ91d89+/dpzKMfAirK7f4sl9UKz9zBsR0xbZ6Eke4WYvNNgFKeL6128+YckABTHThnTMd24ce1+dFMC/xpj@lists.postgresql.org X-Gm-Message-State: AOJu0Yy7Y5o3er+uxqMwLyWUExXfHQS64h3Uzn5BNNfA12vRVukXUdNM ThkOyDCzKfl9TiP57rVyn/pWIdC6TrG3oGXXy1/8r6rAe05911hF5fvrKFBCTotJEhM= X-Gm-Gg: Acq92OFlCGsYDR1agzkjyS7ZrcPHwYFjpvJusUlp7KlgQb/1qj357d9hb4Gm9AQbYS7 QSJ1MWwKz6+PC6q5cxkVhd26NOEksWPIY6ybfQiZJT8+48/DlX7NCmbjxjb7bZbAj1cA7Vm7FXq C2iUbVueCQQ7LXIFYCcZe6LCo7wlMq1MAsH1d4YoFEjg7NRcuD3tvTF+kr5BgpaObapwYvq3had dKthLpzXQIKfSHHD8EAqJz54VQ9Qj+LFWdBtDELpgVyfUsithsf6Egl56Ruj+2r5fL5XvnpjKIH WdkjBHX/mcsCA91WV6c3N5uRr/dB+H0Kj8o3zh9HLHRR5009QAdtMQY8zSiAkBDFTRzK9Y0w6nx gOuSxQqzZAjsL42qMXuxBpbyNA/yT9zKh4hgub/AEpKN6zyf09Sv5vlCgssg4slB/Mc40cz6aKF YWLAY8zGIKVfmfFK937gk0GeQtw9k4InQGtMMCUTnzB94oH7NMy1chMdwJj8sNEvLnNCiKZfEIJ BvjF+I= X-Received: by 2002:a05:6512:1114:b0:5a8:8222:7fc9 with SMTP id 2adb3069b0e04-5aa87ba35c2mr717190e87.13.1780650298581; Fri, 05 Jun 2026 02:04:58 -0700 (PDT) Received: from ehlo.thunderbird.net (68-201-196-88.dyn.estpak.ee. [88.196.201.68]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5aa7b8edf4fsm1734471e87.16.2026.06.05.02.04.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Jun 2026 02:04:57 -0700 (PDT) Sender: Heikki Linnakangas From: Heikki Linnakangas X-Google-Original-From: Heikki Linnakangas Date: Fri, 05 Jun 2026 12:04:52 +0300 To: pgsql-hackers@lists.postgresql.org, Chao Li , Postgres hackers CC: Andrew Dunstan , jian he Subject: Re: Fix domain fast defaults on empty tables User-Agent: K-9 Mail for Android In-Reply-To: <7033D663-DDB4-4B35-922C-F33DE53B1502@gmail.com> References: <7033D663-DDB4-4B35-922C-F33DE53B1502@gmail.com> Message-ID: <219843CF-9B49-404A-838D-88D51902B978@iki.fi> MIME-Version: 1.0 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 On 5 June 2026 10:48:00 EEST, Chao Li wrote= : >Hi, > >I tested "[a0b6ef29a] Enable fast default for domains with non-volatile c= onstraints"=2E After tracing some cases from the regression tests, I came u= p with this test case and found a bug: >``` >evantest=3D# create domain d_div as int check (1 / (value - 1) > 0); >CREATE DOMAIN >evantest=3D# create table t (a int); >CREATE TABLE >evantest=3D# alter table t add column b d_div default 1; >ERROR: division by zero >``` > >It looks like errors inside the CHECK expression itself, such as the int4= div division-by-zero in this test, are still hard errors that can fail the = ALTER TABLE command=2E It seems totally reasonable to get an error in that case=2E '1' is not a v= alid value for the datatype, whether or not there are any rows in the table= =2E - Heikki