Subject Re: [firebird-support] Ambiguous field
Author Helen Borrie
At 01:51 AM 29/05/2005 +0000, you wrote:
>I have had an large database in IB running for several years.
>
>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.

That's because IB wasn't fussy about ambiguous SQL. You may have had
problems in the past that you didn't know about. :-(


>My tables are foreign keyed but have the same field names for the
>foreign keys between tables. The tables also have a primary key.
>
>Is the similarity of names a problem?

No, not at all. Whether the field identifiers are the same or not,
"Flirtybird" will still throw ambiguity exceptions where IB doesn't.

>Should EVERY field in different
>tables be uniquely named? For example, instead of "ForeignKey1" in
>each of several tables, should I have "Table1ForeignKey1"
>and "Table2ForeignKey1".

In queries involving multiple tables (joins, correlated subqueries) you
have to *qualify* all of the field identifiers with the table names or,
preferably, with table name aliases.


>Do I need to write a new database?

No...but you will have to fix up all of your application code, PSQL
modules, views and CHECK constraints, wherever they use multi-table
statements without qualifiers.

./heLen