Subject | Strange FB 1.5 behaviour |
---|---|
Author | jvpgr |
Post date | 2009-08-04T00:16:02Z |
Hi all,
I have a working since 2 years database based on FB 1.5.5. Everything was working fine, when suddendly strange things begun to happen after a (succesfull) backup restore.
I am using updatable views to insert data in the database one of which is the following:
/******************************************************************************/
/* View: VW_EMPLOYEES */
CREATE VIEW VW_EMPLOYEES(
ENTITY_TYPE,
ENTITY_ID,
CODE,
ID_CODE,
TX_CODE,
NAME,
SURNAME,
SEX,
FATHER_NAME,
MOTHER_NAME,
BIRTHDATE,
BIRTHDAY,
BIRTHMONTH,
BIRTHYEAR,
SALUTATION,
PREFERED_METHOD,
SPOKEN_LANGUAGE,
WRITTEN_LANGUAGE,
LEGAL_FORM,
LEGAL_FRM,
PICTURE,
WEB_SITE,
MAIN_CONTACT,
RESOURCE,
ACTIVITY,
WPOSITION,
PROFESSION,
CURRENCY,
COMMENTS,
PARENT_ID,
COMPANY_ID,
ERP_KEY)
AS
select t.entity_type, t.id, t.code, t.id_code, t.tx_code, t.name, t.surname, t.sex, t.father_name,
t.mother_name, t.birthdate, extract(day from t.birthdate), extract(month from t.birthdate),
extract(year from t.birthdate), t.salutation, t.prefered_method, t.spoken_language,
t.written_language, t.legal_form,
(select legal_form from vw_legal_forms where prmtr = t.legal_form), t.picture,
t.web_site, t.main_contact, t.is_resource, t.activity, t.pstn, t.profession, t.currency,
t.comments, t.parent_id, t.company_id, t.erp_key
from entities t
where t.ENTITY_TYPE = 'ÕÐÁËËÇËÏÓ'
;
Triggers */
/******************************************************************************/
SET TERM ^ ;
/******************************************************************************/
/* Triggers for updatable views */
/******************************************************************************/
ALTER TRIGGER VW_EMPLOYEES_SET_ENTITY_BI
AS
begin
new.entity_type = 'ÕÐÁËËÇËÏÓ';
new.legal_form = 'ÉÄÉÙÔÇÓ';
end
^
ALTER TRIGGER VW_EMPLOYEES_SET_ENTITY_BU
AS
begin
new.entity_type = 'ÕÐÁËËÇËÏÓ';
new.legal_form = 'ÉÄÉÙÔÇÓ';
end
^
SET TERM ; ^
/******************************************************************************/
/* Privileges */
/******************************************************************************/
/* Privileges of users */
GRANT ALL ON VW_EMPLOYEES TO JP;
/* Privileges of views */
GRANT SELECT ON ENTITIES TO VIEW VW_EMPLOYEES;
GRANT SELECT ON VW_LEGAL_FORMS TO VIEW VW_EMPLOYEES;
/* Privileges of triggers */
GRANT UPDATE, REFERENCES ON VW_EMPLOYEES TO TRIGGER VW_EMPLOYEES_SET_ENTITY_BI;
GRANT UPDATE, REFERENCES ON VW_EMPLOYEES TO TRIGGER VW_EMPLOYEES_SET_ENTITY_BU;
untill now I have found the problems with the given above view and other three similar ones, I did not have yet checked the rest of the database.
The problem / strange behaviour is that now FB generates error messages when I am trying to insert data in the database, like FK validation errors on the base table (the entity_id field) or translation / overflow errors (the legal_frm field) like if I am trying to insert char value in an integer field.
I tryed repairing the db with gfix but it finds no problems, as well as backuping and restoring repetevelly w/ no success even though backup & restore are sucessfull.
What seemed to fix the problem to some (2) of the four views was dropping & recreating them, but after backuping & restoring again (in the attempt to fix the others) the situation retturned in it's previous condition.
Any suggestions will be extremelly appreciated, please HELP!
TIA
best regards,
Yannis
I have a working since 2 years database based on FB 1.5.5. Everything was working fine, when suddendly strange things begun to happen after a (succesfull) backup restore.
I am using updatable views to insert data in the database one of which is the following:
/******************************************************************************/
/* View: VW_EMPLOYEES */
CREATE VIEW VW_EMPLOYEES(
ENTITY_TYPE,
ENTITY_ID,
CODE,
ID_CODE,
TX_CODE,
NAME,
SURNAME,
SEX,
FATHER_NAME,
MOTHER_NAME,
BIRTHDATE,
BIRTHDAY,
BIRTHMONTH,
BIRTHYEAR,
SALUTATION,
PREFERED_METHOD,
SPOKEN_LANGUAGE,
WRITTEN_LANGUAGE,
LEGAL_FORM,
LEGAL_FRM,
PICTURE,
WEB_SITE,
MAIN_CONTACT,
RESOURCE,
ACTIVITY,
WPOSITION,
PROFESSION,
CURRENCY,
COMMENTS,
PARENT_ID,
COMPANY_ID,
ERP_KEY)
AS
select t.entity_type, t.id, t.code, t.id_code, t.tx_code, t.name, t.surname, t.sex, t.father_name,
t.mother_name, t.birthdate, extract(day from t.birthdate), extract(month from t.birthdate),
extract(year from t.birthdate), t.salutation, t.prefered_method, t.spoken_language,
t.written_language, t.legal_form,
(select legal_form from vw_legal_forms where prmtr = t.legal_form), t.picture,
t.web_site, t.main_contact, t.is_resource, t.activity, t.pstn, t.profession, t.currency,
t.comments, t.parent_id, t.company_id, t.erp_key
from entities t
where t.ENTITY_TYPE = 'ÕÐÁËËÇËÏÓ'
;
Triggers */
/******************************************************************************/
SET TERM ^ ;
/******************************************************************************/
/* Triggers for updatable views */
/******************************************************************************/
ALTER TRIGGER VW_EMPLOYEES_SET_ENTITY_BI
AS
begin
new.entity_type = 'ÕÐÁËËÇËÏÓ';
new.legal_form = 'ÉÄÉÙÔÇÓ';
end
^
ALTER TRIGGER VW_EMPLOYEES_SET_ENTITY_BU
AS
begin
new.entity_type = 'ÕÐÁËËÇËÏÓ';
new.legal_form = 'ÉÄÉÙÔÇÓ';
end
^
SET TERM ; ^
/******************************************************************************/
/* Privileges */
/******************************************************************************/
/* Privileges of users */
GRANT ALL ON VW_EMPLOYEES TO JP;
/* Privileges of views */
GRANT SELECT ON ENTITIES TO VIEW VW_EMPLOYEES;
GRANT SELECT ON VW_LEGAL_FORMS TO VIEW VW_EMPLOYEES;
/* Privileges of triggers */
GRANT UPDATE, REFERENCES ON VW_EMPLOYEES TO TRIGGER VW_EMPLOYEES_SET_ENTITY_BI;
GRANT UPDATE, REFERENCES ON VW_EMPLOYEES TO TRIGGER VW_EMPLOYEES_SET_ENTITY_BU;
untill now I have found the problems with the given above view and other three similar ones, I did not have yet checked the rest of the database.
The problem / strange behaviour is that now FB generates error messages when I am trying to insert data in the database, like FK validation errors on the base table (the entity_id field) or translation / overflow errors (the legal_frm field) like if I am trying to insert char value in an integer field.
I tryed repairing the db with gfix but it finds no problems, as well as backuping and restoring repetevelly w/ no success even though backup & restore are sucessfull.
What seemed to fix the problem to some (2) of the four views was dropping & recreating them, but after backuping & restoring again (in the attempt to fix the others) the situation retturned in it's previous condition.
Any suggestions will be extremelly appreciated, please HELP!
TIA
best regards,
Yannis