Solved

Firebird/Interbase Database Indexes

Posted on 2006-11-02
4
441 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
[X]
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
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month5 days, 21 hours left to enroll

627 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