firebird icon indicating copy to clipboard operation
firebird copied to clipboard

Backward compatibility: Some procedures containing LIST aggregate function are not restored in Firebird 6.0 if backup was made in 5.0

Open sim1984 opened this issue 3 weeks ago • 0 comments

Let's create the following stored procedure in a Firebird 5.0 database.

SET TERM ^;

CREATE OR ALTER PROCEDURE SOME_PROC (
  PRIVATE_FLAG SMALLINT)
RETURNS (
  PACKAGE_NAME VARCHAR(63),
  TEXT         BLOB SUB_TYPE TEXT)
AS
BEGIN
  FOR
    WITH
      T AS (
        SELECT
          P.RDB$PACKAGE_NAME || '' AS PACKAGE_NAME,
          LIST(DISTINCT P.RDB$PROCEDURE_NAME, '; ') AS PROCEDURE_NAME
        FROM RDB$PROCEDURES P
        WHERE RDB$PRIVATE_FLAG = :PRIVATE_FLAG
        GROUP BY 1
        ORDER BY 1
      )
    SELECT
      COALESCE(PACKAGE_NAME, '') AS PACKAGE_NAME,
      PROCEDURE_NAME
    FROM T
    INTO PACKAGE_NAME, TEXT
  DO
    SUSPEND;
END^

SET TERM ;^

Now let's perform a backup of the database.

gbak -b -g test.fdb test.fbk

Next, we will try to restore it in Firebird 6.0.

gbak -c test.fbk test.fdb

During the database restore process we receive the following error.

gbak: ERROR:Error while parsing procedure "PUBLIC"."SOME_PROC"'s BLR
gbak: ERROR:    bad BLR -- invalid stream
gbak: ERROR:    Exiting before completion due to errors
gbak:Exiting before completion due to errors

sim1984 avatar Dec 11 '25 13:12 sim1984