xo / usql

Universal command-line interface for SQL databases
MIT License
8.82k stars 346 forks source link

.usql_history file appears corrupt, no newlines saved? #414

Open mmisiewicz opened 1 year ago

mmisiewicz commented 1 year ago

Using usql 0.14.6 for accessing a Postgres database, I'm finding that the history file is often corrupted on exiting, and I'm not able to search my history from previous sessions.

An example:

\d subreddits\d reddit_subredditsalter table reddit_subreddits add column json_errors json;\d reddit_threadselect * From reddit_subreddits limit 5\Gselect * from reddit_subreddits where url = '/r/all/;select * from reddit_subreddits where url = '/r/all/';select * from reddit_subreddits where url = '/r/popular';select * from reddit_subreddits where url ~* '/r/popular';select * from reddit_subreddits where url ~* '/r/all';insert into reddit_subreddits (url, title, num_subs, over18) values ('/r/all/', 'All', 1e6, true), ('/r/popular', 'Popular', 1e6, true);select * from reddit_subreddits where name = 'All';select * from reddit_subreddits where title'All';select * from reddit_subreddits where title ='All';select * from reddit_subreddits where title ='Popular';update reddit_subreddits set (last_seen_date, first_seen_date) = (now(), now()) where title ='Popular';update reddit_subreddits set (last_seen_date, first_seen_date) = (now(), now()) where title ='All';alter table reddit_subreddits add column threads_last_scraped timestamptz;select *

It looks like there are no newlines being saved in the history file.

I have a .usqlrc:

\set SYNTAX_HL_STYLE solarized-dark
\pset time '2006-01-02 15:04:05'
\pset numericlocale true
\timing

System: macOS 13.3, M1, hombre usql 0.14.6