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

Allow field values in UPDATE OR INSERT in "Values" clause [CORE3456] #3817

Closed
firebird-automations opened this issue Apr 29, 2011 · 5 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @livius2

normally update statement allow somethink like this

update table1 set field1 = coalesce(field1, 0) + 1 where id=5

but
UPDATE OR INSERT INTO table1(id, field1) VALUES(5, coalesce(field1, 0) + 1) MATCHING (ID)
is not possible

now only solution is
UPDATE OR INSERT INTO table1(id, field1) VALUES(5, coalesce(
(SELECT field1 FROM table1 where id=5)
, 0) + 1) MATCHING (ID)

and the same select for other fields

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

IMO this is very confusion, since fields don't have pre-existent values in insert.

This is like wanting fields to be allowed in INSERT.

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

I also againts it as there is no way to run such INSERT statement.
Use MERGE instead.

@firebird-automations
Copy link
Collaborator Author

Commented by: @livius2

in insert all field values are null..

about merge y
its not natural to one record statements
you must do some trick e.g with select from RDB$DATABASE
and then you have more reads then needed (not optimal)

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

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

1 participant