Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Firebird/Interbase Database Indexes

Posted on 2006-11-02
4
435 Views
Last Modified: 2010-04-05
I have a firebird database which having a table well indexed, eg unique index transactionnumber.  However after some times, I find that I am able to save the record with the same transactionnumber twice.  Finally when I look into this database, I find this unique index is somehow inactive.

Do anyone know what may cause this happen whereas I do not do anything to inactivate this index ?
0
Comment
Question by:ivylnm
4 Comments
 

Author Comment

by:ivylnm
ID: 17863836
By the way, is there a quick way for me to list out all inactive indexes ?
0
 
LVL 17

Accepted Solution

by:
TheRealLoki earned 30 total points
ID: 17864127
Is this an index, or is it the primary key constraint?
sometimes a backup/restore can fail to reindex, but usually only if there has been a data corruption.
gfix should be able to tell you this

1 way I can think of to find all the duplicates is to use a stored procedure that does something like this (excuse typos)
create procedure finddupes
returns
( mykeyfield varcahr(32) )
as
declare variable lastkeyfield varchar(32);
begin
  :lastkeyfield = null;
  for select T.field1 from table1 t into :mykeyfield do
  begin
    if (:mykeyfield = :lastkeyfield) then suspend;
    :lastkeyfield = :mykeyfield;
  end
end;

something like that anyway...
0
 
LVL 9

Expert Comment

by:sun4sunday
ID: 17864227
>> unique index transactionnumber
In the table if you define the field as unique/primary key, then when you try to post it should through the error.
I think it is not the problem with the index. Check out your table structure and set the transactionnumber as unique.
Check in your code some where the index is deactivating. Any how it looks strange.

Also When the table is open don't do the backup for the interbase. it may get corrept.

http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_db_corr

sun4sunday
0
 
LVL 2

Assisted Solution

by:Ratje
Ratje earned 20 total points
ID: 17905929
Listing all inactive indexes...hmmm...maybe this'll work (from memory...works in interbase me thinks :) )

select * from rdb$Indices where rdb$index_inactive ='1'
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi : could not find program, '...exe' 2 191
Delphi IDE crash without error message ... 7 99
Base1 Encode/Decode 3 81
How to load 2 images in same column in Delphi 2 57
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question