-
-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support SELECT ... INTO OUTFILE/DUMPFILE ...
#2317
Conversation
…ql-server into james/select-into
sql/rowexec/rel.go
Outdated
if _, relErr := filepath.Rel(dir.(string), fileStr); relErr != nil { | ||
return sql.ErrSecureFilePriv.New() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a different check than we do on the load data infile parameter. In particular, the check we preform there has the following behavior differences:
- It doesn't allow creating files in subdirectories of
secure_file_priv
- It uses
os.Open
+Stat()
on thefilepath.Dir()
of the provided path, in addition to a Stat of thesecure_file_priv
directory, to assert that the files are in the same directory.
The end result is a difference in behavior when there are subdirectories, symlinks, etc. We should probably stick to the same behavior as the read paths?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be fixed now through the isUnderSecureFileDir()
function.
It checks that either the secure_file_privs
directory and the outfile directory are the same or that the absolute path of secure_file_privs
is a prefix to the absolute path of the outfile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking pretty good. Some follow ups before merging in, but they all seem pretty straightforward. Happy to take another look at anything before you merge if you want.
…ql-server into james/select-into
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This adds support for MySQL's
SELECT ... INTO OUTFILE/DUMPFILE ...
feature.It is the complement to
LOAD DATA
. There is noLOCAL
option, so files created using this feature are on the server.This PR adds a custom TestSuite for testing these files, as it needs to write, read, and delete files.
syntax: dolthub/vitess#311
fixes dolthub/dolt#7453