Re: CREATE TABLE NOT VALID for check and foreign key

From: Yasuo Honda <yasuo(dot)honda(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: CREATE TABLE NOT VALID for check and foreign key
Date: 2025-01-07 10:54:35
Message-ID: CAKmOUTmJdOguNM4SObfPTbZP8AZ3hY88WSWEjD-cDqCKXg-tmw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Mon, Dec 23, 2024 at 10:10 AM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:

> Maybe it would have been wise to forbid NOT VALID when used with CREATE
> TABLE. But we didn't. Should we do that now? Maybe we can just
> document that you can specify it but it doesn't do anything.

I'd like PostgreSQL to raise errors and/or warnings for the NOT VALID
check constraint for CREATE TABLE.
Ruby on Rails supports creating check constraints with the NOT VALID
option and I was not aware that it is just ignored until
https://github.com/rails/rails/issues/53732 issue is reported.

Rails has implemented a kind of workaround by not dumping the NOT
VALID option, but it does not help for the first execution.
https://github.com/rails/rails/pull/53735

Thanks,
--
Yasuo Honda

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2025-01-07 10:56:38 Re: Adding OLD/NEW support to RETURNING
Previous Message Amit Kapila 2025-01-07 10:49:12 Re: Conflict detection for update_deleted in logical replication