SQLite Forum

ROWID in compound SELECT
Login
> was this change in alias behaviour of ROWID made deliberately?

Yes it was.  Item #3 on the [release notes for version 3.36.0][1] and/or
[check-in a2ddb89b206c1387][2].

Subqueries and views do not have ROWIDs.  Referencing the ROWID of a
subquery or view would sometimes work, and would at other times give
you a NULL or an arbitrary integer, depending on the chosen query plan.
This was a bug in that SQLite was not raising an error when it should
have.  The change to disallow ROWIDs for subqueries and views is considered a
bug fix.

I anticipated that there might be legacy applications that depend on the
old buggy behavior.  For that reason there is a compile-time option
`-DSQLITE_ALLOW_ROWID_IN_VIEW` that disables the bug fix and restores the
legacy behavior.  In as much as the legacy ROWIDs would sometimes work and
sometimes not, though, a better solution is to fix your application.

[1]: https://www.sqlite.org/releaselog/3_36_0.html
[2]: src:/timeline?c=a2ddb89b206c1387