From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | CREATE TABLE NOT VALID for check and foreign key |
Date: | 2024-12-05 08:57:14 |
Message-ID: | CACJufxEQcHNhN6M18JY1mQcgQq9Gn9ofMeop47SdFDE5B8wbug@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
hi.
I found for foreign keys, check constraints,
you specify it as NOT VALID, it will not be marked as NOT VALID in the
CREATE TABLE statement.
CREATE TABLE s6(id bigint , CONSTRAINT con1 check(id > 1) not valid);
src2=# \d s6
Table "public.s6"
Column | Type | Collation | Nullable | Default
--------+--------+-----------+----------+---------
id | bigint | | |
Check constraints:
"con1" CHECK (id > 1)
create table pk (a int, primary key(a));
create table fk (a int, b int, foreign key(a) references pk( a) not valid);
Table "public.fk"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | |
b | integer | | |
Foreign-key constraints:
"fk_a_fkey" FOREIGN KEY (a) REFERENCES pk(a)
reading transformCheckConstraints, transformFKConstraints comments
appearingly this is intentional?
If so, do we need to document the keywords "NOT VALID"
in create_table.sgml synopsis section?
From | Date | Subject | |
---|---|---|---|
Next Message | Bertrand Drouvot | 2024-12-05 09:13:53 | Re: Make pg_stat_io view count IOs as bytes instead of blocks |
Previous Message | Masahiro Ikeda | 2024-12-05 08:51:11 | Re: Track the amount of time waiting due to cost_delay |