Solved

Firebird/Interbase Database Indexes

Posted on 2006-11-02
4
429 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
calling procedure inside activexForm from secondform 1 232
FMX enumerated colours 2 84
Delphi Firemonkey Need Sample for Online Shopping Example. 2 120
Magic Software info 18 126
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now