SQLite Forum

Timeline
Login

2 forum posts by user juanluispaz

2021-10-11
09:50 Reply: Update with table alias (artifact: e70ea1b15f user: juanluispaz)

Yes, I can omit the table alias or use the table name that I'm updating; but, I cannot use another table alias

2021-10-10
18:25 Post: Update with table alias (artifact: 2d49770b89 user: juanluispaz)

I'm trying to execute the following query (it is valid in PostgreSQL) with the new returning syntax:

update demo as _new_ set name = 'Name 2' 
from (select * from demo as _old_ where _old_.id = 3) as _old_ 
where _new_.id = _old_.id 
returning _old_.name as oldName, _new_.name as newName

And I got the following error message:

no such column: _old_.name

Table creation:

create table demo(id number, name text)

It is like no table alias is valid in the returning clause. As far there is a table alias, there will be an error.

Tested on sqlite 3.36.0