Mark Horrocks wrote:

I have just installed Firtebird and Delphi 2005.

When I connect a BDP I get a message saying there is an ambiguous field between contraints and relations tables. I have not had any problems in the past.

Ann W. Harrison answers:

I suspect that's going to be a serious problem. If I'm right, the query that's producing the error is generated by BDP and is targeted at the database system tables. If that's the case, then BDP and Firebird have irreconcilable differences.

Here's the long story.

Interbase allows joins to reference unqualified field names, even if the field name occurs in more than one table in the query. Firebird does not, and will reject a query like this:

select rdb$relation_name
       from rdb$relations r
          join rdb$view_relations v
              on v.rdb$relation_name = r.rdb$relation_name

In that case, the query is actually not ambiguous - but to recognize that it is not, you have to understand the relationship between the on clause and the select list. At the point where ambiguity is checked, that information isn't available. Here's an example where it actually makes a difference.

select price
     from products p
        join accessories a
           on a.price > p.price and a.product = p.id

Firebird tightened up the rules on ambiguity after a long discussion on the relative merits of allowing the first query for compatibility with old programs and Borland tools, vs. getting the wrong answer with carelessly coded queries like the second.

With luck, the ambiguous query is in your code and you'll be able to fix it. Otherwise, BDP is another Borland tool that doesn't work with Firebird.

Like this post? Share on: TwitterFacebookEmail


Related Articles


Author

Firebird Community

Published

Category

Gems from Firebird Support list

Tags