![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Hi, I'm running Postgresql 7.3 in Debian Woody OS. After some time working properly, insert's statements related this error: ---- referential integrity violation - key referenced from xxx not found in yyy ---- This error would be normal, if the key really doesn't exist, but the key exist. The insert's work some times, and some times don't. Is there any file corrupted? |
|
Removing the fk constraint would resolve the problem? |
#2
| |||
| |||
|
|
On Wed, 2 Aug 2006, Luiz Henrique wrote: Hi, I'm running Postgresql 7.3 in Debian Woody OS. After some time working properly, insert's statements related this error: ---- referential integrity violation - key referenced from xxx not found in yyy ---- This error would be normal, if the key really doesn't exist, but the key exist. The insert's work some times, and some times don't. Is there any file corrupted? It's hard to say. I'd have expected that a select * from parent where key=value would fail for both the fk check and for a check to see if the key exists assuming they used the same plan. Can you make a standalone test case? Removing the fk constraint would resolve the problem? Well, it'd stop the message, but if there is corruption, it wouldn't fix that. ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings |
|
----<br>> referential integrity violation - key referenced from xxx not found in yyy<br>> ----<br>><br>> This error would be normal, if the key really doesn't exist, but the key<br>> exist.<br>> The insert's work some times, and some times don't. br>><br>><br>> Is there any file corrupted?<br><br>It's hard to say. I'd have expected that a select * from parent where<br>key=value would fail for both the fk check and for a check to see if the<br>key exists assuming they used the same plan. Can you make a standalone |
#3
| |||
| |||
|
|
Hi, could you tell me how postgresql look for a referenced key? It looks in table index? Maybe only the index is corrupted? |
#4
| |||
| |||
|
| On Fri, 4 Aug 2006, Luiz Henrique wrote: Hi, could you tell me how postgresql look for a referenced key? It looks in table index? Maybe only the index is corrupted? It basically runs a query like: SELECT * FROM parenttable WHERE keycol1 = ? [AND keycol2 = ? ...] FOR SHARE It should act like a prepared statement would (which might be different than it would with the ?s replaced by the actual values). |
#5
| |||
| |||
|
|
my problem was problably corrupted index files. I recreated the index and it's ok now. The hardware was being unpluged from power source without shuthing down, I guess that's the cause. |
#6
| |||
| |||
|
|
On Aug 15, 2006, at 8:50 AM, Luiz Henrique wrote: my problem was problably corrupted index files. I recreated the index and it's ok now. The hardware was being unpluged from power source without shuthing down, I guess that's the cause. What version are you using? In recent versions, indexes are supposed to be safe from corruption, even through crashes. -- Jim C. Nasby, Sr. Engineering Consultant jnasby (AT) pervasive (DOT) com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 |
#7
| |||
| |||
|
|
On 8/21/06, Jim Nasby <jnasby (AT) pervasive (DOT) com> wrote: What version are you using? In recent versions, indexes are supposed to be safe from corruption, even through crashes. It's Postgresql 7.2.1, installed with stable version of Debian Woody, at the time. |
![]() |
| Thread Tools | |
| Display Modes | |
| |