473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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
2 1763
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Mike N. | last post by:
Hello: I am new to T-SQL programing, and relativly new to SQL statements in general, although I have a good understanding of database theory. I'm a little confused as to the fundamental...
5
by: Bruce | last post by:
I have several user defined functions which are referenced in triggers and views. For software upgrades, I need to be able to drop the triggers and views which reference these user defined...
1
by: Manish Bafna | last post by:
speaking of me, I'm not very new to Access, but I haven't worked on it as a professional. I know that you can fire queries in Access, but I don't think you can create views. i want to know that...
224
by: VB6 User | last post by:
Hi all devies! Many (.NUT, .NOT or whatever), APIs, VB6, Views & Questions Your can not call APIs directly in .NET, only via P/Invoke. There are some things that cannot be done in...
1
by: SVGK, Raju | last post by:
Hi, I have a table where in lot of triggers were included in that as shown below. How to view/access triggers and procedures from postgresql. I am using postgresql 7.4.1 on solaris. regds...
5
by: Mike Mascari | last post by:
I'd like to ensure that the creation of a department also implies the creation of two to eight projects; no more, no less: CREATE TABLE departments ( department text primary key not null ); ...
11
by: Anthony Paul | last post by:
Hello everyone, I am involved in a scenario where there is a huge (SQL Server 2005) production database containing tables that are updated multiple times per second. End-user reports need to be...
0
debasisdas
by: debasisdas | last post by:
trigger sample code Ex#10 ======================= INSTEAD OF TRIGGER ---------------------------------------- create or replace trigger mytrig instead of delete or insert or update on eview...
4
by: --CELKO-- | last post by:
I need to convert a bunch of DB2 triggers to Oracle. Is there any kind of tools for this?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.