alter table..drop constraint pkey, left not null un-dropped

From: Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: alter table..drop constraint pkey, left not null un-dropped
Date: 2017-05-11 09:33:37
Message-ID: CAKcux6=hiP4aHVuvpcKc1onO43xRqWzA_iw_6Q+Q-P47HN=15g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi All,

I have created a table with primary key, and then dropped primary key from
table. But table still have not null constraint added by primary key.

Is there any other statement to delete primary key with not null?
or this is an expected behaviour of pg?

postgres=# create table tbl (c1 int primary key);
CREATE TABLE
postgres=# \d+ tbl
Table "public.tbl"
Column | Type | Collation | Nullable | Default | Storage | Stats target
| Description
--------+---------+-----------+----------+---------+--------
-+--------------+-------------
c1 | integer | | not null | | plain |
|
Indexes:
"tbl_pkey" PRIMARY KEY, btree (c1)

postgres=# alter table tbl drop constraint tbl_pkey;
ALTER TABLE
postgres=# \d+ tbl
Table "public.tbl"
Column | Type | Collation | Nullable | Default | Storage | Stats target
| Description
--------+---------+-----------+----------+---------+--------
-+--------------+-------------
c1 | integer | | not null | | plain |
|

Thanks & Regards,
Rajkumar Raghuwanshi
QMG, EnterpriseDB Corporation

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc Mamin 2017-05-11 09:57:36 feature wish: filter log_min_duration_statement according to the context (parse|bind|execute|...)
Previous Message Petr Jelinek 2017-05-11 09:16:17 Re: Get stuck when dropping a subscription during synchronizing table