![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
| ... nextval('zone_id_seq'::text) contractid | integer | not null |
|
| ... nextval('qmail_account_id_seq'::text) contractid | integer | not null |
#2
| |||
| |||
|
|
I have problem with foreign keys on postgresql-7.3.2-1PGDG. I have two tables, sorry for the lenght, but I want to give you complete information. Table qmail_account has FK on zone(name). On some occasions when I want to insert data to qmail_account I get the RI error that the value of qmail_account.domain was not found in zone.name. I'm sure it is there. Maybe there is some problem with index zone_name_key. Originaly I had this problem with zone.name and qmail_account.domain defined as varchar(100), so I changed it to char(100), but it didn't help. This problem occurs on some domains only - but on these domains it gives the error every time. I realized that when I insert the data with the "on-insert-working" domain and then update it to the "on-insert-not-working" domain, the update works. As I have a trigger on qmail_account which checks some values and sets them if they are empty. "home" is filled different ways for public and private domains, so I use select query to the "zone". When I specify "home" at insert, it works even with domains it failed with empty and then auto-filled "home". The trigger is run before insert/update on qmail_account. The trigger doesn't change the value of NEW.domain in any way. So I'd like to know if there is something I can do to make the insert working with the trigger. |
#3
| |||
| |||
|
|
If possible, can you give a complete example script that shows the problem? |
#4
| |||
| |||
|
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 If possible, can you give a complete example script that shows the problem? Here it is. |
#5
| |||
| |||
|
|
Unfortunately the trigger depends on some other functions that I dind't have so I replaced those with string constants. I couldn't get it to fail with a little bit of playing around on my 7.3.4 box, however. |
|
If you set up a new database with the tables and triggers involved, can you get it to fail with some test data, and if so, can you send a dump of the new database along with the command you ran to get it to fail? |
|
If you don't get it to fail, it might be worth trying to reindex the index on zone(name). |
![]() |
| Thread Tools | |
| Display Modes | |
| |