Re: [GENERAL] Trigger function is not called

2008-08-25 Thread Klint Gore
Bill wrote: The thing that has me confused is that the following table, trigger and trigger function work perfectly and the primary key for this table is also bigint not null. I added a bigint not null domain to this schema and changed the data type of the key to the domain and then I get the

Re: [GENERAL] Trigger function is not called

2008-08-25 Thread Bill
Tom Lane wrote: Bill <[EMAIL PROTECTED]> writes: The thing that has me confused is that the following table, trigger and trigger function work perfectly and the primary key for this table is also bigint not null. Actually, after looking closer, I think the problem with your previous e

Re: [GENERAL] Trigger function is not called

2008-08-25 Thread Tom Lane
Klint Gore <[EMAIL PROTECTED]> writes: > ... With the not null definition in the domain, this > blows up before anything else has a chance. Right. Forming the proposed row-to-insert involves coercing the data to the correct data types, and for domain types enforcing the domain constraints is se

Re: [GENERAL] Trigger function is not called

2008-08-25 Thread Tom Lane
Bill <[EMAIL PROTECTED]> writes: > The thing that has me confused is that the following table, trigger and > trigger function work perfectly and the primary key for this table is > also bigint not null. Actually, after looking closer, I think the problem with your previous example is that you cr

Re: [GENERAL] Trigger function is not called

2008-08-25 Thread Bill
Tom Lane wrote: Bill <[EMAIL PROTECTED]> writes: I removed the domain from the category_id and version columns leaving the following table, trigger function and trigger. The trigger function is still not called when I insert a new row. Any other ideas? You're still expecting the trigg

Re: [GENERAL] Trigger function is not called

2008-08-25 Thread Tom Lane
Bill <[EMAIL PROTECTED]> writes: > I removed the domain from the category_id and version columns leaving > the following table, trigger function and trigger. The trigger function > is still not called when I insert a new row. Any other ideas? You're still expecting the trigger to get invoked bef

Re: [GENERAL] Trigger function is not called

2008-08-25 Thread Bill
Tom Lane wrote: Bill <[EMAIL PROTECTED]> writes: Is it possible to create a type and use that instead of the domain or will I have the same problem with a type? You'd have the same problem. By the time the trigger sees it, the row has already been converted to the table's column datat

Re: [GENERAL] Trigger function is not called

2008-08-25 Thread Bill
You'd have the same problem. By the time the trigger sees it, the row has already been converted to the table's column datatype(s), so any exception associated with a datatype or domain would be thrown already. A lot of people seem to have trouble with this concept; I dunno what data representat

Re: [GENERAL] Trigger function is not called

2008-08-25 Thread Tom Lane
Bill <[EMAIL PROTECTED]> writes: > Is it possible to create a type and use that instead of the domain or > will I have the same problem with a type? You'd have the same problem. By the time the trigger sees it, the row has already been converted to the table's column datatype(s), so any exceptio

Re: [GENERAL] Trigger function is not called

2008-08-25 Thread Bill
Tom Lane wrote: Bill <[EMAIL PROTECTED]> writes: In a newsgroup posting someone suggested that constraint checks on domains occur before the before insert trigger. Yeah, that is the case, but if a domain check was failing then the row wouldn't get inserted, so I'm not clear on how this

Re: [GENERAL] Trigger function is not called

2008-08-25 Thread Tom Lane
Bill <[EMAIL PROTECTED]> writes: > In a newsgroup posting someone suggested that constraint checks on > domains occur before the before insert trigger. Yeah, that is the case, but if a domain check was failing then the row wouldn't get inserted, so I'm not clear on how this matches up with your r

Re: [GENERAL] Trigger function is not called

2008-08-25 Thread Bill
Tom Lane wrote: Bill <[EMAIL PROTECTED]> writes: PostgreSQL 8.3 on Windows. I have the table below which has a before insert trigger. The CREATE TRIGGER statement and the trigger function are also shown below. The script you show attempts to create the trigger before creating the func

Re: [GENERAL] Trigger function is not called

2008-08-25 Thread Tom Lane
Bill <[EMAIL PROTECTED]> writes: > PostgreSQL 8.3 on Windows. I have the table below which has a before > insert trigger. The CREATE TRIGGER statement and the trigger function > are also shown below. The script you show attempts to create the trigger before creating the function, which of course

[GENERAL] Trigger function is not called

2008-08-25 Thread Bill
PostgreSQL 8.3 on Windows. I have the table below which has a before insert trigger. The CREATE TRIGGER statement and the trigger function are also shown below. When I insert a row into this table using pgAdmin III and the INSERT statement insert into note.category (category_id, category) valu