Subject Re: [firebird-support] Unable to create unique constraint
Author Thomas Beckmann
Hi André,

try disconnect, reconnect, does the problem persist?

Cheers, Thomas

Am 20.03.2014 17:09, schrieb André Knappstein:
> Hi Gang!
>
> While preparing the final steps to migrate from dBase/FB 1.5 to C#/FB
> 2.5 I need to create a unique constraint for the old databases, and
> need some help from someone still familiar with 1.5.
>
> Not using uniques too often, so it's probably something I am doing
> basically wrong, but I can't create the following unique constraint:
>
> alter table T
> add constraint UNQ1_T
> unique (F1, F2)
> using index UC_T
>
> I receive the following error:
>
> Invalid insert or update value(s): object columns are constrained - no 2 table rows can have duplicate column values.
> attempt to store duplicate value (visible to active transactions) in unique index "@1".
>
> I checked that at this moment the table should be "clean" from
> duplicates by using the following statement:
>
> select
> T.F1,
> T.F2,
> count(T.ID)
> from
> T
> group by
> 1, 2
> having
> count(T.ID) > 1
>
> The result after the first run was a bunch of rows which would have
> violated the unique. I cleared them off using a "For select..." in a
> stored proc and subsequent runs yield only empty rowsets.
> So the table should be ready for the unique shouldn't it?
>
> Can somebody help me to see the forest with all these trees around,
> please? What else could stop a unique like this? If I make a backup of
> the database and restore it to a FB 2.5 server, the unique is created
> just fine. The old server is Classic Engine, if that should matter.
>
> Thanks in advance!
>
>
>
>
> mit freundlichen Grüßen,
>
> André Knappstein
> EDV und Controlling
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> beta Eigenheim- und Grundstücksverwertungsgesellschaft mbH
> Hafenweg 4
> 59192 Bergkamen-Rünthe
>
> Telefon: +49 2389 9240 140
> Telefax: +49 2389 9240 150
> e-mail: knappstein@...
>
> Amtsgericht Hamm Nr. B 420
> Geschäftsführer: Achim Krähling, Dirk Salewski und Matthias Steinhaus
>
> USt-IDNr.: DE 125215402
>
>
>
> ------------------------------------
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Yahoo Groups Links
>
>
>

--
Mit freundlichen Grüßen,

Thomas Beckmann
Diplom-Informatiker


Wielandstraße 14c • 23558 Lübeck
Tel +49 (22 25) 91 34 - 545 • Fax +49 (22 25) 91 34 - 604
Mail thomas.beckmann@... <mailto:thomas.beckmann@...>

ASSFINET-Logo

*ASSFINET Dienstleistungs-GmbH*
Max-Planck-Straße 14 • 53501 Grafschaft bei Bonn
info@... <mailto:info@...> • www.assfinet.de
<http://www.assfinet.de/>

Geschäftsführer: Dipl. Wirtschaftsinformatiker Marc Rindermann
Registergericht Koblenz HRB 23331

Diese E-Mail enthält vertrauliche Informationen. Wenn Sie nicht der
richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist
nicht gestattet.