Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong report of unique property in connection#indexes #32

Closed
vizcay opened this issue May 16, 2014 · 1 comment
Closed

wrong report of unique property in connection#indexes #32

vizcay opened this issue May 16, 2014 · 1 comment

Comments

@vizcay
Copy link

vizcay commented May 16, 2014

The schema reversal of a rails production database started giving problems, all indexes thata were not unique started being reported as unique. But the development db worked fine.. after some research I was able to track the bug to connection#indexes:

  1. RDB$INDICES.RDB$UNIQUE holds the interesting property
  2. when FB first creates a not unique index, it fills the value with null, and everything works fine (it get's reported as not unique)
  3. but for some reason, after a backup-restore cycle, this value gets changed to '0'
  4. this has been reported here: [http://tracker.firebirdsql.org/browse/CORE-933;jsessionid=EBB3F797BE85B7CF5A6E6199ED6BB064?actionOrder=desc] but it's not a bug, just an inconsistency: "in system tables null and '0' it's the same".

fb.c line 2904

unique = RTEST(unique) ? Qtrue : Qfalse;
descending = RTEST(descending) ? Qtrue : Qfalse;

So if according to what I've read online RTEST is the same that "if" for ruby, the problem is that 0 is being evaluated to true: it should test for null or 0.

Maybe this is affecting descending also and other system table tests..

Sorry easy fix but I'm not confident touching c ruby

@rowland
Copy link
Owner

rowland commented May 17, 2014

Yes, the fix was easy, but only because you had completed the analysis already. Thanks for the report.

@rowland rowland closed this as completed May 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants