Firedac Error: "[Firedac][DatS]-15. Duplicate row found on unique index."

Hello,

I am using Firedac 8 with Firebird 2.5 on Delphi 2007.

I have a table with an primary index on SIndex (integer),
and an index defined as:
CREATE UNIQUE DESC INDEX idx_Plans_Prj_Id ON Plans (SIndex)

When I open a TADTable without IndexName (so, primary index is used), 
everything works.

When I open the same TADTable with IndexName = 'idx_Plans_Prj_Id'
I get the error message:
"[Firedac][DatS]-15. Duplicate row found on unique index.
Constraint [RDB$PRIMARY11]"
(rdb$primary11 is the primary index of Plans table).

The SIndex is unique by construction, as the idx_Plans_Prj_Id index is 
just a DESCending index on primary key.

There is also no SortOptions.SortLocale or (wide)string sorting problems 
as the index key is just an integer...

So, is that a bug in TADTable component ?
or did I miss something ?

Thanks,
Mel
0
M
4/3/2014 10:51:33 AM
embarcadero.delphi.database 1294 articles. 0 followers. Follow

5 Replies
3741 Views

Similar Articles

[PageSpeed] 32

Try using a TFDQuery instead. TFDTable is not a good design for client 
server applications.

M. E.L. wrote:
> Hello,
>
> I am using Firedac 8 with Firebird 2.5 on Delphi 2007.
>
> I have a table with an primary index on SIndex (integer),
> and an index defined as:
> CREATE UNIQUE DESC INDEX idx_Plans_Prj_Id ON Plans (SIndex)
>
> When I open a TADTable without IndexName (so, primary index is used),
> everything works.
>
> When I open the same TADTable with IndexName = 'idx_Plans_Prj_Id'
> I get the error message:
> "[Firedac][DatS]-15. Duplicate row found on unique index.
> Constraint [RDB$PRIMARY11]"
> (rdb$primary11 is the primary index of Plans table).
>
> The SIndex is unique by construction, as the idx_Plans_Prj_Id index is
> just a DESCending index on primary key.
>
> There is also no SortOptions.SortLocale or (wide)string sorting problems
> as the index key is just an integer...
>
> So, is that a bug in TADTable component ?
> or did I miss something ?
>
> Thanks,
> Mel
>
0
quinn
4/3/2014 7:58:42 PM
> So, is that a bug in TADTable component ?
> or did I miss something ?

http://docwiki.embarcadero.com/RADStudio/XE5/en/Browsing_Tables_(FireDAC)#Avoiding_.22Unique_Key_Violation.22_Error_in_LDW_Mode

-- 
With best regards,
Dmitry Arefiev / FireDAC Architect
0
Dmitry
4/3/2014 10:11:50 PM
On 04.04.2014 00:11, Dmitry Arefiev wrote:
>> So, is that a bug in TADTable component ?
>> or did I miss something ?
>
> http://docwiki.embarcadero.com/RADStudio/XE5/en/Browsing_Tables_(FireDAC)#Avoiding_.22Unique_Key_Violation.22_Error_in_LDW_Mode
>

Well I already read that...
But, as I mentioned, my descending index is on an INTEGER key.
What can do FormatOptions.SortLocale / SortOptions, collation and all 
that stuff for indexing an integer ?

Mel
0
M
4/4/2014 6:19:30 AM
On 03.04.2014 21:58, quinn wildman wrote:
> Try using a TFDQuery instead. TFDTable is not a good design for client
> server applications.

Yes, I know that.
But, in the process to update my application, using TFDTable is a good 
step to start with.

Thanks,
Mel
0
M
4/4/2014 6:24:46 AM
> {quote:title=M. E.L. wrote:}{quote}
> On 04.04.2014 00:11, Dmitry Arefiev wrote:
> >> So, is that a bug in TADTable component ?
> >> or did I miss something ?
> >
> > http://docwiki.embarcadero.com/RADStudio/XE5/en/Browsing_Tables_(FireDAC)#Avoiding_.22Unique_Key_Violation.22_Error_in_LDW_Mode
> >
> 
> Well I already read that...
> But, as I mentioned, my descending index is on an INTEGER key.
> What can do FormatOptions.SortLocale / SortOptions, collation and all 
> that stuff for indexing an integer ?
> 
> Mel


Hi I had a similar situation I am not sure it will work for you  
Format options I made SortLocale to 0 which was by default 1024 and 
sort options made StrsTrim made it to false which was true before it worked for some tables but It did not work for all not sure why this strange behaviour or something I am missing while repeating this settings for other tables
0
Ranjita
4/22/2014 11:44:09 AM
Reply: