pdns mysql backend fails with "Unknown MySQL error" on Alpine v3.12 and v3.13
Everything works on Alpine v3.11. After upgrading to v3.12 (which, note, has the same version of pdns in the repo), I get
pdns daemon.err pdns[412]: Exiting because communicator thread died with error: GSQLBackend unable
to retrieve list of master domains: Could not execute mysql statement: select d.id, d.name, d.notified_serial, r.co
ntent from records r join domains d on r.name=d.name where r.type='SOA' and r.disabled=0 and d.type='MASTER': Unkno
wn MySQL error
The same happens in Alpine v3.13.
The SQL server is mariadb-10.5.8 on a separate host (non-Alpine)
Any advice in debugging this further?
P.S. Connecting directly via mysql
and running the corresponding request works fine, so I'm guessing the issue is with libgmysqlbackend.so, but maybe the issue is with mariadb-connector-c -- which does update between Alpine v3.11 and v3.12.
P.P.S. After some experimentation, I've found that the following test code reproduces the issue: https://gist.github.com/lierdakil/66575a13b70684ab1e49fc7903e6005b (provided actual server/user/pass are provided to mysql_real_connect of course). What is somewhat curious, the original query fails, but a modified query
select d.id, d.name, d.notified_serial, r.content from records AS r join domains AS d
on r.name=d.name where r.type='SOA' and r.disabled=0 and d.type='MASTER'
works, with the only difference being AS
keywords between table names and aliases. I still don't know whether it's an issue with mariadb-connector-c or pdns.
P.P.P.S. Actually, any change to the original query (except for leading/trailing spaces, bug including a space somewhere in the middle) seems to "fix" it. I'm lost, I have no idea how is that happening.