pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedcheck
4+ messages / 4 participants
[nested] [flat]
* check
@ 2002-06-14 18:47 Matt <matthew.berardi@weilpublishing.com>
2002-06-17 14:40 ` Re: check Christopher Kings-Lynne <chriskl@familyhealth.com.au>
2002-06-17 14:55 ` Re: check Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-06-17 16:35 ` Re: check Manfred Koizar <mkoi-pg@aon.at>
0 siblings, 3 replies; 4+ messages in thread
From: Matt @ 2002-06-14 18:47 UTC (permalink / raw)
To: pgsql-sql
how would you go about enforcing the default value:
I have a nextval('seq') as my default and on an insert I don't want any
other value to be allowed.
forget my last query about inheritance issues
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: check
2002-06-14 18:47 check Matt <matthew.berardi@weilpublishing.com>
@ 2002-06-17 14:40 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
2 siblings, 0 replies; 4+ messages in thread
From: Christopher Kings-Lynne @ 2002-06-17 14:40 UTC (permalink / raw)
To: Matt <matthew.berardi@weilpublishing.com>; pgsql-sql
Look at:
http://techdocs.postgresql.org/
Look at the introduction to RULES where they do a read-only column.
Chris
----- Original Message -----
From: "Matt" <matthew.berardi@weilpublishing.com>
To: <pgsql-sql@postgresql.org>
Sent: Saturday, June 15, 2002 2:47 AM
Subject: [SQL] check
> how would you go about enforcing the default value:
>
> I have a nextval('seq') as my default and on an insert I don't want any
> other value to be allowed.
>
> forget my last query about inheritance issues
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: check
2002-06-14 18:47 check Matt <matthew.berardi@weilpublishing.com>
@ 2002-06-17 14:55 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2 siblings, 0 replies; 4+ messages in thread
From: Stephan Szabo @ 2002-06-17 14:55 UTC (permalink / raw)
To: Matt <matthew.berardi@weilpublishing.com>; +Cc: pgsql-sql
On Fri, 14 Jun 2002, Matt wrote:
> how would you go about enforcing the default value:
>
> I have a nextval('seq') as my default and on an insert I don't want any
> other value to be allowed.
Don't do a default, do a before trigger that sets the value so that even
if a value is specified it uses the sequence anyway (or you could
potentially check that it's currently null and error I guess as well).
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: check
2002-06-14 18:47 check Matt <matthew.berardi@weilpublishing.com>
@ 2002-06-17 16:35 ` Manfred Koizar <mkoi-pg@aon.at>
2 siblings, 0 replies; 4+ messages in thread
From: Manfred Koizar @ 2002-06-17 16:35 UTC (permalink / raw)
To: Matt <matthew.berardi@weilpublishing.com>; +Cc: pgsql-sql
On Fri, 14 Jun 2002 14:47:32 -0400, Matt
<matthew.berardi@weilpublishing.com> wrote:
>how would you go about enforcing the default value:
>
>I have a nextval('seq') as my default and on an insert I don't want any
>other value to be allowed.
Matt,
CREATE TABLE tab (id INTEGER NOT NULL DEFAULT 0, ...
and add a before insert trigger that *unconditionally* puts
nextval('seq') into new.id. I guess, you don't want to allow your
users to change the id of an existing row, so you might also want to
add a before update trigger that sets new.id to old.id.
Servus
Manfred
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2002-06-17 16:35 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-06-14 18:47 check Matt <matthew.berardi@weilpublishing.com>
2002-06-17 14:40 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
2002-06-17 14:55 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-06-17 16:35 ` Manfred Koizar <mkoi-pg@aon.at>
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