Subject [ibo] INSERT RETURING statement does not return any rows
Author seanb_durkin
When my application executes an INSERT RETURNING statement via
TIB_Query, a 'synchronisation' error is raised, whereas according
to Firebird documentation it should return a single row which is the
inserted row.

I am not sure if this is a Firebird problem or an IBO problem.


Example:
INSERT INTO PERSONAL_NAME (SURNAME, GIVENNAMES) VALUES ( 'Durkin',
'Sean') returning PK_PERSONAL_NAME;

will fail, even though this is valid SQL in a database where the
following is defined. It should return the primary key of the newly
inserted record.

CREATE TABLE PERSONAL_NAME(
PK_PERSONAL_NAME Integer NOT NULL,
SURNAME Varchar(20) NOT NULL,
GIVENNAMES Varchar(20)
PRIMARY KEY (PK_PERSONAL_NAME)
);
CREATE GENERATOR GEN_PERSONAL_NAME_ID;
SET TERM ^ ;
CREATE TRIGGER PERSONAL_NAME_NEWID FOR PERSONAL_NAME ACTIVE
BEFORE INSERT POSITION 0 AS
BEGIN
NEW.PK_PERSONAL_NAME = GEN_ID(GEN_PERSONAL_NAME_ID,1);
END^
SET TERM ; ^


My environment is:
* Delphi 2007 for win32
* Database = Firebird 2.1 Release Candidate 2 (WI-V2.1.0.17755)
* IBO component suite, version 4.6B


How can I do an INSERT RETURNING statement? Please advise.


Faithfully,
Sean B. Durkin