Subject Column does not belong to referenced table - Bug report
Author localnet12002
I use IBO4.5hi and when upgraded firebird to 2.0 I had some trobles.
I downloaded IBO 4.7 beta 15 and new problems found:

The errors messages:
============================================
ISC ERROR MESSAGE:
Dynamic SQL Error
SQL error code = -206
Column unknown
FOLHA.PK_FOLHA
At line 2, column 13

STATEMENT:
TIB_BindingCursor: "<TApplication>.F_WKF_VS.F_Atu_Fun.IBOQueryFolha.I
BOqrIBOQueryFolha.<TIB_BindingCursor>."
=============================================

When I run a iboquery.refresh, after a storedproc call.

The sql sentence:
=============================================
select f.*
from folha f
where f.pk_funcionarios = :pk_funcionarios and
f.mes_referencia = :mes_referencia and
exists(select pk_tb_fpg_cod
from tb_fpg_cod
where vencim_desc in (4,7) and
pk_tb_fpg_cod = f.pk_tb_fpg_cod)
=============================================

In IBO Query Editor if I try to create the updateSQL estatements:
============================================
EditSQL:
----------------------------
UPD TE SET
WHERE
RDB$DB_KEY = :DB_KEY

insertSQL:
---------------------------
INSER) INTO (
VALUES )

DeleteSQL:
---------------------------
DELETE FROM
WHERE
RDB$DB_KEY = :DB_KEY
---------------------------

If I change the SQL statement to:
===================================
select *
from folha
where pk_funcionarios = :pk_funcionarios and
mes_referencia = :mes_referencia and
exists(select pk_tb_fpg_cod
from tb_fpg_cod
where vencim_desc in (4,7) and
pk_tb_fpg_cod = folha.pk_tb_fpg_cod)
--------------------------------------------
I did: Removed "f" alias from sql sentence and putted "folha." in
where clause of sql sentence inside "exists")

Then, I try to create the updateSQL again, and everything is OK!
=====================================
EditSQL:
--------------------
UPDATE FOLHA SET
PK_FOLHA = :PK_FOLHA, /*PK*/
PK_FUNCIONARIOS = :PK_FUNCIONARIOS,
MES_REFERENCIA = :MES_REFERENCIA,
PK_HISTORICOS = :PK_HISTORICOS,
PK_TB_FPG_COD = :PK_TB_FPG_COD,
QUANTIDADE = :QUANTIDADE,
VALOR = :VALOR,
HORAS = :HORAS,
AT_DATA = :AT_DATA,
DIA = :DIA,
PK_FPG_FOLHA = :PK_FPG_FOLHA,
WBASE = :WBASE,
WQTD = :WQTD,
WCOEF = :WCOEF,
WVALOR = :WVALOR
WHERE
PK_FOLHA = :OLD_PK_FOLHA

InsertSQL:
--------------------------------
INSERT INTO FOLHA(
PK_FOLHA, /*PK*/
PK_FUNCIONARIOS,
MES_REFERENCIA,
PK_HISTORICOS,
PK_TB_FPG_COD,
QUANTIDADE,
VALOR,
HORAS,
AT_DATA,
DIA,
PK_FPG_FOLHA,
WBASE,
WQTD,
WCOEF,
WVALOR)
VALUES (
:PK_FOLHA,
:PK_FUNCIONARIOS,
:MES_REFERENCIA,
:PK_HISTORICOS,
:PK_TB_FPG_COD,
:QUANTIDADE,
:VALOR,
:HORAS,
:AT_DATA,
:DIA,
:PK_FPG_FOLHA,
:WBASE,
:WQTD,
:WCOEF,
:WVALOR)

DeleteSQL:
--------------------------------
DELETE FROM FOLHA
WHERE
PK_FOLHA = :OLD_PK_FOLHA

==================================================

End report.!!!!!!!!