featurebase/sql3/planner
Travis Turner 87011e4294
CLI: make it more like psql (#2235)
* Refactor CLI to mimic psql's meta-commands

This PR adds support for meta-commands (also known as "backslash
commands") like those in psql, Postgres's CLI. Only a few meta-commands
are currently implemented, but this was meant to demonstrate how we
could use something like `\i file.csv` to insert local files into SQL
statements.

* Meta-commands: \file and \include

The initial implementation used `\i` as a streaming file handle.

This commit changes that to `\file`, and then implements `\i` (or
`\include`) as handling multiple sql commands.

* Add meta-command "help" (\?)

This is basically a copy of the psql help output, but includes only
those options we currently support.

* Add support for \o [file], and \timing

The \o meta-command writes query output to a file.

The \timing meta-command turns on/off the timing display sent to stdout.

* Add meta-commands: \l (show databases) and \dt (show tables)

* Add meta-command: \watch [period]

* Update meta-command \connect to take database name instead of ID

* Add support for \echo, \qecho, and \warn

This commit contains an known issue in that the `-n` option will exclude
the line feed, but if the output is the terminal, the readline package
clobbers any content on the current line (i.e. anything without a line
feed). That will need to be addressed at some point.

* Add support for \w [FILE] (write query buffer to file)

* Add SchemaAPI no-op implementation

* Refactor query handler to align with /sql and /databases endpoints

We want to standardize on:
/sql
/databases/{databaseID}/sql

* Add CLI support for expanded, border, tuples_only (and pset)

* Add help text for \pset and \t
2023-02-14 09:23:51 -06:00
..
types introduce performance counters and system table fanout, plus refactor metrics (#2363) 2023-01-19 21:35:02 +00:00
compilealterdatabase.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compilealtertable.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compilebulkinsert.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compilecreatedatabase.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compilecreatetable.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compilecreateview.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compiledelete.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compiledropdatabase.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compiledroptable.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compiledropview.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compileinsert.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compileselect.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
compileshow.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
executionplanner.go Get rid of *most* of the context.Background() references in sql3 package (#2238) 2023-02-10 13:40:46 -06:00
executionplannersystemtables.go Support for setting individual DatabaseOptions (#2231) 2023-02-06 08:50:28 -06:00
expression.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
expression_it_test.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
expressionagg.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
expressionanalyzer.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
expressionanalyzercall.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
expressionpql.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
expressiontypes.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
inbuiltfunctionsdate.go implemented extract ddl; tightened up type related stuff (#2329) 2022-12-12 09:01:20 -08:00
inbuiltfunctionsset.go cleaned up sync from private repo 2022-09-30 11:20:58 -07:00
inbuiltfunctionsstring.go Fb-1816 : CharIndex str func (#2216) 2023-01-30 16:08:46 -05:00
inbuiltfunctionstable.go added testify dependency 2022-09-30 11:31:37 -07:00
main_test.go added testify dependency 2022-09-30 11:31:37 -07:00
opalterdatabase.go CLI: make it more like psql (#2235) 2023-02-14 09:23:51 -06:00
opaltertable.go Sync from private repo to commit 12d608c80d 2022-12-12 09:01:20 -08:00
opalterview.go Get rid of *most* of the context.Background() references in sql3 package (#2238) 2023-02-10 13:40:46 -06:00
opbulkinsert.go handle empty strings as nulls for CSV (except for string types) (#2246) 2023-02-13 17:02:04 -06:00
opcreatedatabase.go Support for setting individual DatabaseOptions (#2231) 2023-02-06 08:50:28 -06:00
opcreatetable.go fix import paths and import cycles 2023-01-12 00:31:14 +00:00
opcreateview.go Get rid of *most* of the context.Background() references in sql3 package (#2238) 2023-02-10 13:40:46 -06:00
opdistinct.go Sup 294 pre sort command (#2209) 2023-01-23 12:26:38 -06:00
opdropdatabase.go Support for setting individual DatabaseOptions (#2231) 2023-02-06 08:50:28 -06:00
opdroptable.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
opdropview.go Get rid of *most* of the context.Background() references in sql3 package (#2238) 2023-02-10 13:40:46 -06:00
opfanout.go introduce performance counters and system table fanout, plus refactor metrics (#2363) 2023-01-19 21:35:02 +00:00
opfeaturebasecolumns.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
opfeaturebasedatabases.go Get rid of *most* of the context.Background() references in sql3 package (#2238) 2023-02-10 13:40:46 -06:00
opfeaturebasetables.go Database isolation: Balancer (#2407) 2023-01-19 22:10:08 +00:00
opfilter.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
opgroupby.go fix import paths and import cycles 2023-01-12 00:31:14 +00:00
ophaving.go fix import paths 2023-01-11 18:59:24 +00:00
opinsert.go Use the correct epoch when converting field.Options.Base to timestamp (#2241) 2023-02-10 17:13:09 -06:00
opnestedloops.go hand comma version of inner join (#2221) 2023-01-25 13:37:05 -06:00
opnulltable.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
oporderby.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
oppqlaggregate.go timestamp fixes (#2224) 2023-01-25 14:07:15 -06:00
oppqldelete.go fix import paths 2023-01-11 18:59:24 +00:00
oppqldistinctscan.go Get rid of *most* of the context.Background() references in sql3 package (#2238) 2023-02-10 13:40:46 -06:00
oppqlfiltereddelete.go fix import paths 2023-01-11 18:59:24 +00:00
oppqlgroupby.go fix import paths and import cycles 2023-01-12 00:31:14 +00:00
oppqlmultiaggregate.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
oppqlmultigroupby.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
oppqltablescan.go Get rid of *most* of the context.Background() references in sql3 package (#2238) 2023-02-10 13:40:46 -06:00
opprojection.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
opqltruncate.go fix import paths 2023-01-11 18:59:24 +00:00
opquery.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
oprelalias.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
opsubquery.go fix import paths and import cycles 2023-01-12 00:31:14 +00:00
opsystemtable.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
optablevaluedfunction.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
optop.go implemented DISTINCT (fb-1562) (#2388) 2023-01-10 23:28:00 +00:00
planoptimizer.go A bug fix roundup (#2242) 2023-02-13 12:28:34 -06:00
planwalker.go Implement DELETE (fb 1557) (#2382) 2023-01-10 23:25:08 +00:00
systemobjects.go Get rid of *most* of the context.Background() references in sql3 package (#2238) 2023-02-10 13:40:46 -06:00
wireprotocol.go introduce performance counters and system table fanout, plus refactor metrics (#2363) 2023-01-19 21:35:02 +00:00