From 49c2beec79e78c543c5d216cf7b4c438c160c497 Mon Sep 17 00:00:00 2001 From: BigUstad Date: Wed, 22 Apr 2020 18:28:30 -0700 Subject: [PATCH] check object stat first before continuing with sql select call. (#3188) --- cmd/sql-main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/sql-main.go b/cmd/sql-main.go index e06aaef6..7d5f2c75 100644 --- a/cmd/sql-main.go +++ b/cmd/sql-main.go @@ -446,7 +446,10 @@ func mainSQL(ctx *cli.Context) error { URLs := ctx.Args() writeHdr := true for _, url := range URLs { - if !isAliasURLDir(url, encKeyDB) { + if _, targetContent, err := url2Stat(url, false, encKeyDB); err != nil { + errorIf(err.Trace(url), "Unable to run sql for "+url+".") + continue + } else if !targetContent.Type.IsDir() { if writeHdr { query, csvHdrs, selOpts = getAndValidateArgs(ctx, encKeyDB, url) }