Re: drop a check - Mailing list pgsql-sql

From Andreas Kretschmer
Subject Re: drop a check
Date
Msg-id 20061113183401.GA31078@KanotixBox
Whole thread Raw
In response to drop a check  (ivan marchesini <marchesini@unipg.it>)
List pgsql-sql
ivan marchesini <marchesini@unipg.it> schrieb:

> Dear all...
> I have created a check constraint without giving it a name..
> now I have a check named "$25" in my table that I need to drop or
> modify!!!
> How can I do???

Can you see the name with \d <table> within psql?

An example:

test=# create table bla (id int check (id between 1 and 4));
CREATE TABLE
test=# \d bla     Table "public.bla"Column |  Type   | Modifiers
--------+---------+-----------id     | integer |
Check constraints:   "bla_id_check" CHECK (id >= 1 AND id <= 4)

test=# alter table bla drop CONSTRAINT bla_id_check;
ALTER TABLE
test=# \d bla     Table "public.bla"Column |  Type   | Modifiers
--------+---------+-----------id     | integer |



HTH, Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."    (unknow)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°


pgsql-sql by date:

Previous
From: Erik Jones
Date:
Subject: Re: COALESCE and GROUP BY and AGGREGATES
Next
From: ivan marchesini
Date:
Subject: Re: drop a check