pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedhow to alter/drop check contraint?
2+ messages / 2 participants
[nested] [flat]
* how to alter/drop check contraint?
@ 2000-12-20 13:10 hubert depesz lubaczewski <depesz@depesz.pl>
0 siblings, 1 reply; 2+ messages in thread
From: hubert depesz lubaczewski @ 2000-12-20 13:10 UTC (permalink / raw)
To: pgsql-sql
the subject should be self-explanatory, but:
i have table:
create table a (b text check (length(b)<10));
and for some reason i want to drop this check or alter this to length(b)<20.
how can i do so?
or maybe using trigger in plpgsql will be better?
how to make trigger which will stop insert or update when something occurs?
depesz
--
hubert depesz lubaczewski
------------------------------------------------------------------------
najwspanialszą rzeczą jaką dało nam nowoczesne społeczeństwo,
jest niesamowita wręcz łatwość unikania kontaktów z nim ...
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: how to alter/drop check contraint?
@ 2000-12-20 18:59 Stephan Szabo <sszabo@megazone23.bigpanda.com>
parent: hubert depesz lubaczewski <depesz@depesz.pl>
0 siblings, 0 replies; 2+ messages in thread
From: Stephan Szabo @ 2000-12-20 18:59 UTC (permalink / raw)
To: hubert depesz lubaczewski <depesz@depesz.pl>; +Cc: pgsql-sql
There's no good way currently to drop the check constraint
really. You probably can do it by removing the row for the
constraint from pg_relcheck and changing the pg_class row
for the table to have the correct number in relchecks.
In 7.1, you'd probably be able to add the check constraint
using ALTER TABLE ADD CONSTRAINT, but before that adding
the constraint would probably be difficult.
You're probably best off dumping the table, changing the
constraint and then restoring it.
[If you don't have any important data and you like the idea
of potentially causing yourself great deals of pain and suffering,
it might be possible to change the 10 to 20 by directly editing
the pg_relcheck row. I have not attempted to do this though,
so I'm not sure it would work.]
Stephan Szabo
sszabo@bigpanda.com
On Wed, 20 Dec 2000, hubert depesz lubaczewski wrote:
> the subject should be self-explanatory, but:
> i have table:
> create table a (b text check (length(b)<10));
> and for some reason i want to drop this check or alter this to length(b)<20.
> how can i do so?
>
> or maybe using trigger in plpgsql will be better?
> how to make trigger which will stop insert or update when something occurs?
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-12-20 18:59 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-12-20 13:10 how to alter/drop check contraint? hubert depesz lubaczewski <depesz@depesz.pl>
2000-12-20 18:59 ` Stephan Szabo <sszabo@megazone23.bigpanda.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