pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedIs Dropping a column "CHECK" constraint possible?
4+ messages / 2 participants
[nested] [flat]
* Is Dropping a column "CHECK" constraint possible?
@ 2002-07-05 11:59 Rajesh Kumar Mallah. <mallah@trade-india.com>
2002-07-06 04:35 ` Re: Is Dropping a column "CHECK" constraint possible? Christopher Kings-Lynne <chriskl@familyhealth.com.au>
0 siblings, 1 reply; 4+ messages in thread
From: Rajesh Kumar Mallah. @ 2002-07-05 11:59 UTC (permalink / raw)
To: pgsql-sql
Hi Folks ,
can anyone please help?
i have a to drop a check contstraint from a column. eg
tradein_clients=# \d t_a
Table "t_a"
Column | Type | Modifiers
------------+---------+-----------
company_id | integer |
exp | text |
imp | text |
Check constraints: "$1" (length(imp) > 1)
"aaaaaq" (length(imp) > 1)
Can i remove to contraints thru ALTER TABLE or similar commands.
I have read the docs for ALTER TABLE but the command described is
not working for me.
=======================================================
ALTER TABLE [ ONLY ] table
DROP CONSTRAINT constraint { RESTRICT | CASCADE }
========================================================
Regards
Mallah.
--
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)
Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Is Dropping a column "CHECK" constraint possible?
2002-07-05 11:59 Is Dropping a column "CHECK" constraint possible? Rajesh Kumar Mallah. <mallah@trade-india.com>
@ 2002-07-06 04:35 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
2002-07-06 05:03 ` Re: Is Dropping a column "CHECK" constraint possible? Rajesh Kumar Mallah. <mallah@trade-india.com>
2002-07-07 13:45 ` Re: Is Dropping a column "CHECK" constraint possible? Rajesh Kumar Mallah. <mallah@trade-india.com>
0 siblings, 2 replies; 4+ messages in thread
From: Christopher Kings-Lynne @ 2002-07-06 04:35 UTC (permalink / raw)
To: Rajesh Kumar Mallah. <mallah@trade-india.com>; pgsql-sql
> can anyone please help?
> i have a to drop a check contstraint from a column. eg
>
> tradein_clients=# \d t_a
> Table "t_a"
> Column | Type | Modifiers
> ------------+---------+-----------
> company_id | integer |
> exp | text |
> imp | text |
> Check constraints: "$1" (length(imp) > 1)
> "aaaaaq" (length(imp) > 1)
>
> Can i remove to contraints thru ALTER TABLE or similar commands.
> I have read the docs for ALTER TABLE but the command described is
> not working for me.
This should work, so long as you're using postgres 7.2+
ALTER TABLE "t_a" DROP CONSTRAINT "aaaaaq" RESTRICT;
Chris
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Is Dropping a column "CHECK" constraint possible?
2002-07-05 11:59 Is Dropping a column "CHECK" constraint possible? Rajesh Kumar Mallah. <mallah@trade-india.com>
2002-07-06 04:35 ` Re: Is Dropping a column "CHECK" constraint possible? Christopher Kings-Lynne <chriskl@familyhealth.com.au>
@ 2002-07-06 05:03 ` Rajesh Kumar Mallah. <mallah@trade-india.com>
1 sibling, 0 replies; 4+ messages in thread
From: Rajesh Kumar Mallah. @ 2002-07-06 05:03 UTC (permalink / raw)
To: Christopher Kings-Lynne <chriskl@familyhealth.com.au>; pgsql-sql
Yup it did!.
Thanks a ton,
it was there in the ALTER TABLE documentation
i overlooked :-(
regds
mallah.
On Saturday 06 July 2002 10:05, Christopher Kings-Lynne wrote:
> > can anyone please help?
> > i have a to drop a check contstraint from a column. eg
> >
> > tradein_clients=# \d t_a
> > Table "t_a"
> > Column | Type | Modifiers
> > ------------+---------+-----------
> > company_id | integer |
> > exp | text |
> > imp | text |
> > Check constraints: "$1" (length(imp) > 1)
> > "aaaaaq" (length(imp) > 1)
> >
> > Can i remove to contraints thru ALTER TABLE or similar commands.
> > I have read the docs for ALTER TABLE but the command described is
> > not working for me.
>
> This should work, so long as you're using postgres 7.2+
>
> ALTER TABLE "t_a" DROP CONSTRAINT "aaaaaq" RESTRICT;
>
> Chris
--
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)
Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Is Dropping a column "CHECK" constraint possible?
2002-07-05 11:59 Is Dropping a column "CHECK" constraint possible? Rajesh Kumar Mallah. <mallah@trade-india.com>
2002-07-06 04:35 ` Re: Is Dropping a column "CHECK" constraint possible? Christopher Kings-Lynne <chriskl@familyhealth.com.au>
@ 2002-07-07 13:45 ` Rajesh Kumar Mallah. <mallah@trade-india.com>
1 sibling, 0 replies; 4+ messages in thread
From: Rajesh Kumar Mallah. @ 2002-07-07 13:45 UTC (permalink / raw)
To: Christopher Kings-Lynne <chriskl@familyhealth.com.au>; pgsql-sql
Hi ,
i want to enforce that a coulumn 'imp'
shud either contain valid data or no data at all.
by valid data i mean data having at least one non whitespace character.
will this constraint be approprote for accomplishing it?
tradein_client=> ALTER TABLE t_a ADD CHECK ( length( btrim(imp) ) > 1 or imp is NULL );
regards
mallah.
On Saturday 06 July 2002 10:05, Christopher Kings-Lynne wrote:
> > can anyone please help?
> > i have a to drop a check contstraint from a column. eg
> >
> > tradein_clients=# \d t_a
> > Table "t_a"
> > Column | Type | Modifiers
> > ------------+---------+-----------
> > company_id | integer |
> > exp | text |
> > imp | text |
> > Check constraints: "$1" (length(imp) > 1)
> > "aaaaaq" (length(imp) > 1)
> >
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2002-07-07 13:45 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-07-05 11:59 Is Dropping a column "CHECK" constraint possible? Rajesh Kumar Mallah. <mallah@trade-india.com>
2002-07-06 04:35 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
2002-07-06 05:03 ` Rajesh Kumar Mallah. <mallah@trade-india.com>
2002-07-07 13:45 ` Rajesh Kumar Mallah. <mallah@trade-india.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox