| From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> | 
|---|---|
| To: | Justin Pryzby <pryzby(at)telsasoft(dot)com> | 
| Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Alexander Lakhin <exclusion(at)gmail(dot)com>, Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru> | 
| Subject: | Re: pg17 issues with not-null contraints | 
| Date: | 2024-05-04 09:20:32 | 
| Message-ID: | 202405040920.2rg4mmjgv3ch@alvherre.pgsql | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On 2024-May-03, Justin Pryzby wrote:
> But if it's created with LIKE:
> postgres=# CREATE TABLE t1 (LIKE t);
> postgres=# ALTER TABLE t ATTACH PARTITION t1 DEFAULT ;
> 
> ..one also sees:
> 
> Not-null constraints:
>     "t1_i_not_null" NOT NULL "i"
Hmm, I think the problem here is not ATTACH; the not-null constraint is
there immediately after CREATE.  I think this is all right actually,
because we derive a not-null constraint from the primary key and this is
definitely intentional.  But I also think that if you do CREATE TABLE t1
(LIKE t INCLUDING CONSTRAINTS) then you should get only the primary key
and no separate not-null constraint.  That will make the table more
similar to the one being copied.
Does that make sense to you?
-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"Estoy de acuerdo contigo en que la verdad absoluta no existe...
El problema es que la mentira sí existe y tu estás mintiendo" (G. Lama)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2024-05-04 09:45:32 | Re: pg_sequence_last_value() for unlogged sequences on standbys | 
| Previous Message | Daniel Gustafsson | 2024-05-04 08:08:48 | Re: Cutting support for OpenSSL 1.0.1 and 1.0.2 in 17~? |