Support for simulating Firebird's RelaxedAliasChecking

24 views
Skip to first unread message

Joe Spandrusyszyn

unread,
Apr 7, 2020, 1:16:04 PM4/7/20
to H2 Database
I'm a developer on a large, old project that has a lot of old, poorly structured SQL where table aliases are specified but not consistently used (ex. "SELECT MY_TABLE.COLUMN1 FROM MY_TABLE MT WHERE MT.COLUMN2='value';"). This works fine in Production because we're using Firebird with RelaxedAliasChecking enabled (https://firebirdsql.org/rlsnotesh/rnfb210-fbconf-relax.html).

For our unit tests, however, we are using an H2 Database instead (because it's a whole lot faster to spin up new H2 databases than Firebird databases).
Since H2 (correctly) requires proper alias usage, this means we need to either...
1. Not have unit test coverage for a large portion of our codebase
2. Spend a lot of time fixing our old SQL that works perfectly fine outside of unit tests
3. Drastically slow down unit tests by using Firebird instead of H2 for tests

#2 is definitely our long-term goal, but not going to happen any time soon.

Any chance H2 could gain support for a RelaxedAliasChecking (or is there one already that I'm overlooking, or any thoughts on an alternative)?

Noel Grandin

unread,
Apr 7, 2020, 1:42:03 PM4/7/20
to H2 Database
We don't have such a thing. You're welcome to attempt to implement it, but I think we'd be unlikely to accept such a patch because it would mean carrying ugly code in an important part of H2.

Joe Spandrusyszyn

unread,
Apr 7, 2020, 5:16:04 PM4/7/20
to H2 Database
That's fully understandable, and I don't blame you at all for not wanting to add support for it. I'll consider trying to implement it myself if time permits (though if I get enough time to add it, I'd probably rather spend that time working towards removing the need for RelaxedAliasChecking in the first place).

Noel Grandin

unread,
Apr 8, 2020, 2:44:52 AM4/8/20
to h2-da...@googlegroups.com
Yeah, sorry about that. If you want to work on this, the relevant code path is probably the ColumnResolver stuff.

Reply all
Reply to author
Forward
0 new messages