[MDEV-32061] INTO OUTFILE should work with named pipes Created: 2023-08-31  Updated: 2023-12-01

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Minor
Reporter: Xan Charbonnet Assignee: Andrew Hutchings
Resolution: Unresolved Votes: 0
Labels: beginner-friendly


 Description   

It would be really great if MariaDB's "INTO OUTFILE" feature could write into a named pipe. That would allow me to compress its output on the fly when I do backups, rather than writing the enormous uncompressed file first and then compressing it. It would save a lot of disk space and time.



 Comments   
Comment by Xan Charbonnet [ 2023-08-31 ]

I have applied this solution:
https://bugs.gentoo.org/529574
to MariaDB 10.11.5 and it works very well! Essentially it just declines to fail if the existing file specified in the SQL command is a named pipe.

Comment by Daniel Black [ 2023-09-01 ]

Looking at SQL-2008 on SELECT INTO the target-specification doesn't include file based output so this is our extension.

To support the differing behaviour here I'd expect we'd want to see a FORCE or similar SQL that translates to O_TRUNC used in opening the file.

patching create_file in sql/sql_class.cc seems the right way to do it, but checking the existing filetype not at all. Not sure how the original bug expects to work with sockets, you don't write to them, you connect.

Comment by Xan Charbonnet [ 2023-12-01 ]

I'm not sure about sockets, but it seems like it would be very easy to implement the patch I linked to and at least have named pipes working. That doesn't require FORCE or O_TRUNC or anything.

Generated at Thu Feb 08 10:28:32 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.