Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RETURNING sometimes delivers incorrect value with updatable views [DOC85] #95

Closed
firebird-automations opened this issue Feb 4, 2013 · 6 comments

Comments

@firebird-automations
Copy link

Submitted by: @paulvink

RETURNING sometimes delivers an incorrect value in the case of updatable views with generated, default or computed fields, unless the value is explicitly assigned to the NEW variable. This should be documented.

For details, see firebird-support thread "INSERT ... RETURNING and updatable view" starting 2 Feb 2013.

@mrotteveel
Copy link
Member

Thread is: http://fb-list-archive.s3-website-eu-west-1.amazonaws.com/firebird-support/2013/2/120653.html

This is still reproducible in Firebird 4.0, but I would think this is a bug that needs to be fixed in Firebird.

@mrotteveel
Copy link
Member

Thinking some more about this: it works correctly without the trigger (as the view is already updatable). If the view is defined, then the definer of the view takes responsibility for redirecting it (as the trigger could also affect multiple tables, etc).

@the-Arioch
Copy link

So i nthe end, is it a bug in the core or in the docs? Cause i wonder if core devs would look here a lot...

...and even Denis

@mrotteveel
Copy link
Member

This issue tracker is only about documentation. It is still open because I haven't yet decided on where or how to document it.

As to whether this is something that needs to change in Firebird, Dmitry said back in 2013:

FWIW, you have to live with that. It's unlikely to change in the foreseeable future.

One of the reasons is that this is complex. A trigger defining an updatable view could result in actions that leaves no row to return values from, or multiple rows, or a row with a different RDB$DB_KEY than the original, etc. That is why having the writer of the trigger perform the necessary mapping to the NEW context is preferable (or at least: simpler).

@mrotteveel
Copy link
Member

mrotteveel commented Jul 20, 2021

The associated issue for Firebird itself is FirebirdSQL/firebird/issues/5529 (and maybe FirebirdSQL/firebird/issues/1453)

@mrotteveel
Copy link
Member

Added information in fblangref50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants