dbTalk Databases Forums  

Re: [BUGS] referential integrity violation - key referenced from

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss Re: [BUGS] referential integrity violation - key referenced from in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] referential integrity violation - key referenced from - 08-02-2006 , 11:16 AM






On Wed, 2 Aug 2006, Luiz Henrique wrote:

Quote:
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?

Quote:
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


Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] referential integrity violation - key referenced from - 08-04-2006 , 09:32 AM






------=_Part_69661_3818596.1154701804817
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi, could you tell me how postgresql look for a referenced key? It looks in
table index? Maybe only the index is corrupted?

Thanks!

On 8/2/06, Stephan Szabo <sszabo (AT) megazone (DOT) bigpanda.com> wrote:
Quote:
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

------=_Part_69661_3818596.1154701804817
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi, could you tell me how postgresql look for a referenced key? It looks in table index? Maybe only the index is corrupted?<br><br>Thanks!<br><br><div><span class="gmail_quote">On 8/2/06, <b class="gmail_sendername">Stephan Szabo
</b> &lt;<a href="mailto:sszabo (AT) megazone (DOT) bigpanda.com">sszabo (AT) megazone (DOT) bigpanda.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Wed, 2 Aug 2006, Luiz Henrique wrote:<br><br>&gt; Hi,<br>&gt;<br>&gt; I'm running Postgresql 7.3 in Debian Woody OS.<br>&gt;<br>&gt; After some time working properly, insert's statements related this error:<br>&gt;<br>
Quote:
----<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.&nbsp;&nbsp;Can you make a standalone
<br>test case?<br><br>&gt; Removing the fk constraint would resolve the problem?<br><br>Well, it'd stop the message, but if there is corruption, it wouldn't fix<br>that.<br><br>---------------------------(end of broadcast)---------------------------
<br>TIP 5: don't forget to increase your free space map settings<br></blockquote></div><br>

------=_Part_69661_3818596.1154701804817--


Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] referential integrity violation - key referenced from - 08-04-2006 , 11:21 AM




On Fri, 4 Aug 2006, Luiz Henrique wrote:

Quote:
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).

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


Reply With Quote
  #4  
Old   
Luiz Henrique
 
Posts: n/a

Default Re: [BUGS] referential integrity violation - key referenced from - 08-15-2006 , 08:53 AM



------=_Part_66406_2036689.1155649829699
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

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.
I used the fallowing commands to recreate index:

/etc/init.d/postgresql stop
su postgres
/usr/lib/postgresql/bin/postgres -D /var/lib/postgres/data -O -P db
reindex database db;
/etc/init.d/postgresql start

Thanks!

On 8/4/06, Stephan Szabo <sszabo (AT) megazone (DOT) bigpanda.com> wrote:
Quote:

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).

------=_Part_66406_2036689.1155649829699
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi, <br><br>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.<br>I used the fallowing commands to recreate index:
<br><br>/etc/init.d/postgresql stop
<br>su postgres
<br>/usr/lib/postgresql/bin/postgres -D /var/lib/postgres/data -O -P db
<br>reindex database db;
<br>/etc/init.d/postgresql start
<br><br>Thanks!<br><br><div><span class="gmail_quote">On 8/4/06, <b class="gmail_sendername">Stephan Szabo</b> &lt;<a href="mailto:sszabo (AT) megazone (DOT) bigpanda.com">sszabo (AT) megazone (DOT) bigpanda.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>On Fri, 4 Aug 2006, Luiz Henrique wrote:<br><br>&gt; Hi, could you tell me how postgresql look for a referenced key? It looks in<br>&gt; table index? Maybe only the index is corrupted?<br><br>It basically runs a query like:
<br> SELECT * FROM parenttable WHERE keycol1 = ? [AND keycol2 = ? ...] FOR<br>SHARE<br><br>It should act like a prepared statement would (which might be different<br>than it would with the ?s replaced by the actual values).
<br></blockquote></div><br>

------=_Part_66406_2036689.1155649829699--


Reply With Quote
  #5  
Old   
Jim Nasby
 
Posts: n/a

Default Re: [BUGS] referential integrity violation - key referenced from - 08-22-2006 , 04:26 AM



On Aug 15, 2006, at 8:50 AM, Luiz Henrique wrote:
Quote:
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



---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


Reply With Quote
  #6  
Old   
Luiz Henrique
 
Posts: n/a

Default Re: [BUGS] referential integrity violation - key referenced from - 08-22-2006 , 01:38 PM



------=_Part_45796_23507524.1156245688851
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

It's Postgresql 7.2.1, installed with stable version of Debian Woody, at the
time.


On 8/21/06, Jim Nasby <jnasby (AT) pervasive (DOT) com> wrote:
Quote:
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



------=_Part_45796_23507524.1156245688851
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

It's Postgresql 7.2.1, installed with stable version of Debian Woody, at the time.<br><br><br><div><span class="gmail_quote">On 8/21/06, <b class="gmail_sendername">Jim Nasby</b> &lt;<a href="mailto:jnasby (AT) pervasive (DOT) com">jnasby (AT) pervasive (DOT) com
</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On Aug 15, 2006, at 8:50 AM, Luiz Henrique wrote:<br>&gt; my problem was problably corrupted index files. I recreated the
<br>&gt; index and it's ok now. The hardware was being unpluged from power<br>&gt; source without shuthing down, I guess that's the cause.<br><br>What version are you using? In recent versions, indexes are supposed<br>to be safe from corruption, even through crashes.
<br>--<br>Jim C. Nasby, Sr. Engineering Consultant&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="mailto:jnasby (AT) pervasive (DOT) com">jnasby (AT) pervasive (DOT) com</a><br>Pervasive Software&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://pervasive.com">http://pervasive.com</a>&nbsp;&nbsp;&nbsp;&nbsp;work: 512-231-6117
<br>vcard: <a href="http://jim.nasby.net/pervasive.vcf">http://jim.nasby.net/pervasive.vcf</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cell: 512-569-9461<br><br><br></blockquote></div><br>

------=_Part_45796_23507524.1156245688851--


Reply With Quote
  #7  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] referential integrity violation - key referenced from - 08-22-2006 , 04:23 PM



"Luiz Henrique" <luizhwk (AT) gmail (DOT) com> writes:
Quote:
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.
7.2.1 is ancient and has a very long list of known bugs. We officially
abandoned support for the 7.2.* branch more than a year ago, upon
finding some bugs that were simply not practical to fix in that branch.

If you must keep using 7.2.*, at least get yourself onto 7.2.8, the last
of that series. But you'd be doing yourself a real favor by expending
a little more effort and moving to a current release series ---
preferably 8.1.*.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.