By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,852 Members | 2,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,852 IT Pros & Developers. It's quick & easy.

Triggers for FK on Views - can they be made deferrable?

P: n/a
I've got the case of a table which has unusual FK constraints. I'm
implementing them as triggers against a view. It all works, BUT I don't see
a way to make the triggers executed only on Commit -- i.e., I'd like the
same "deferrable" behavior that true FKs provide. Does anyone know how to
do this?

Thanks,

Ezra E.
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
There is a way to create them as CONSTRAINT triggers. It's totally
non-standard, not guaranteed to exist in future releases, yadda, yadda.
But it get's you where you want to be now().
Jan

ezra epstein wrote:
I've got the case of a table which has unusual FK constraints. I'm
implementing them as triggers against a view. It all works, BUT I don't see
a way to make the triggers executed only on Commit -- i.e., I'd like the
same "deferrable" behavior that true FKs provide. Does anyone know how to
do this?

Thanks,

Ezra E.

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

--
#================================================= =====================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================= = Ja******@Yahoo.com #
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #2

P: n/a
Hi Jan,

Thanks for the reply. I did come across the CREATE CONSTRAINT TRIGGER
doc page after my posting. It's not too well documented and seems to want
various parameters yet it's not clear what they'd be, so any pointers are
appreciated. My other two approaches were:

(a) Update the pg_trigger table, setting tgdeferrable and
tginitdeferred
accordingly (--hey, if you're gonna live on the wild side....)

(b) Force users to make changes via a stored proc/function that
sort-of does what I want. (Not ideal, but stays on the "safe" side of
everything.)

EE

"Jan Wieck" <Ja******@Yahoo.com> wrote in message
news:3F**************@Yahoo.com...
There is a way to create them as CONSTRAINT triggers. It's totally
non-standard, not guaranteed to exist in future releases, yadda, yadda.
But it get's you where you want to be now().
Jan

ezra epstein wrote:
I've got the case of a table which has unusual FK constraints. I'm
implementing them as triggers against a view. It all works, BUT I don't see a way to make the triggers executed only on Commit -- i.e., I'd like the
same "deferrable" behavior that true FKs provide. Does anyone know how to do this?

Thanks,

Ezra E.

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

--
#================================================= =====================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================= = Ja******@Yahoo.com #
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.