Created attachment 389532 [details, diff]
mysql select ... into fifo
My patch is taken from . Only applied the FIFO part to keep the patch simple.
Surely, there must be an improvement wrt security concerns.
Just good enough for my use-case where mysql runs in a safe environment.
So I guess it is not better than a RFC and a record for others that need this feature and know about the consequences.
Why would Gentoo need to implement this when upstream does not?
well, my use-case is not resolved as-is. ;)
and I quite do not care about upstream. I am just a user that wants to get it done.
wrt my use-case: how can a process receive a notification about table updates? where updates may come multiple times in a second.
so, mysql offers triggers which one can install that executes commands for each row that changes. to get that information out of the scope of mysql, it has the command 'select ... into outfile' to send it into a file.
mysql only allows to write to non-existent non-timestamped files(yes, for a good reason - but only by default). i.e.: outfile = 'CONCAT('/path/to/file_', SYSDATE() + 0)' fails.
so, what to do if the trigger executes multiple times in a second? the process for whatever reason cannot react and delete the file before the next trigger executes. the whole update command fails - not just the trigger.
so, why not rip that superfluous harddisk access layer and use POSIX named pipes instead?
data is kept in memory and update commands cannot fail for such a ... reason.
well, again, this is just a recond for others that may have a need for this and I hope others find this when they search for it.
No, we're not going to add a new feature like this.
If you really need it:
a) go and test out the percona ebuilds in the mysql overlay
b) convince upstream oracle mysql and/or mariadb to accept this patch.
But I think the approach you're taking to the problem, you should probably be using some publish/subscribe mechanism outside of MySQL.
never said that you should. I use my patch successful. does what it should.
and yes, I use a publish/subscribe mechanism. though, with that trigger feature to have my processes do what they should and not entangle with too many tasks. being able to start and stop the processes as I please.