Skip to content

Conversion Error with old.field in UPDATE OR INSERT #8508

@sund1

Description

@sund1

fb 5.0.2.
When using aliases for old.field in UPDATE OR INSERT, we encounter the error: conversion error from string “999”. This error only occurs when the value is longer than 1 character and the value already exists in the table via MATCHING (i.e., old.value is not null).

The issue occurs specifically with old.t_key as o, while new works correctly. Using CAST helps resolve the issue.
(returning cast(old.t_key as int) as o, new.t_key as n)

This issue was not present in Firebird version 3.10.

CREATE DOMAIN PKEY_test AS INTEGER NOT NULL;


CREATE TABLE test_pkey (
    t_key PKEY_test,
    CONSTRAINT pk PRIMARY KEY (t_key)	
);

UPDATE OR INSERT INTO test_pkey (t_key)
VALUES (999)
MATCHING (t_key)
RETURNING old.t_key as o, new.t_key as n

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions