psql Week 2 - Mailing list pgsql-hackers
From | Peter Eisentraut |
---|---|
Subject | psql Week 2 |
Date | |
Msg-id | Pine.LNX.4.10.9910112123420.832-100000@peter-e.yi.org Whole thread Raw |
Responses |
Re: [HACKERS] psql Week 2
Re: [HACKERS] psql Week 2 |
List | pgsql-hackers |
Here's the long-awaited next edition. For those who must get their hands on some code I have a tarball at http://www.pathwaynet.com/~peter/psql.tar.bz2 It includes a file RELEASENOTES which should help you get started. CHANGELOG * Sorted out -e and -E: -e toggles query echoing in non-interactive mode (why would you want to echo queries in interactivemode?). -E enables showing of queries sent behind your back and is independent of -e. * Sorted out usernames and passwords: Switch -U specifies username or "?" for "prompt me". Switch -P is "prompt for password".Old -u is equivalent to -U ? -P. Equivalent changes to \connect (e.g., \c - ? = connect to current database andask for new username (and prompting for password iff -u or -P mode)). * Command history is saved and loaded automatically. Also, history and readline are separately enabled in the code. (likeanyone needs that) * Allow versioned startup files (like .psqlrc-6.6.0), at least during development. * psql now has internal variables. Use \set and \unset to set/unset/display them. The amount of internal state got out ofhand, so this should help. Most of the settings will be moved to some variable. (The implementation is currently quitenaive, but encapsulated well to change it later on.) * -q switch is now equivalent to setting variable quiet. Audited what messages should be quieted, what are errors, what isnormal output, what is query output. * Copy-in now has customizable prompt as well. * Wrote a better strtok, with quoting capabilities, which is now used to parse the options of the slash commands. (This willbreak backward compatibility if you use filenames with spaces and quotes since they will now be interpreted differently.Too bad.) * Cleaned up various \d<x> commands. The queries are now human-readable in -E mode. (Also they now show up in -E mode, andnot in -e mode!) * -E mode is now the variable echo_secret. If you set the variable to 'noexec' then the "backdoor" queries will only be displayed,not executed. (Nice if you just want to study the queries.) * If a connection goes bad during query execution, PQreset is attempted. If it still is bad, then an _interactive_ sessionwill be in unconnected mode. (Changed prompt to reflect that.) * Ctrl-C only sends cancel request if query in progress (otherwise default action = terminate program). This removes a majorannoyance (I hope). * Refined \c[onnect]'ion failures: Non-interactive scripts will terminate, even recursively. However, if the underlying sessionwas an interactive one, it does not terminate. The database connection will be lost, however. * Password prompts are automatic (both startup and \connect). Can still use -P switch, but that might prove unnecessary.[ Cheers to Roland R.! ] * Implemented \lo_import, \lo_export, \lo_unlink, \lo_list. (Still needs some refinement, though.) * Can now use \copy with oids and delimiters. No binary, yet. TODO LIST * generalized backslash command handling (struct, no ..else if...) * new printing routines * rewrite mainloop parser, strip comments * single line mode doesn't take slash commands * make scripts bomb out (optionally) on query error * remove Rollback warnings in lo_ ops * \default(s?) command * allow several \ cmds on a line (add '\' to strtokx delims?, windows?) SIDE NOTES 1. Since the new animal is now probably going to be 7.0, let's provide a psql that's worthy of that name, er, number. Ihope I can lay a framework with this, but there are still a few months I think, so ideas are welcome. 1.a) On a related note, since the core developers have more important issues to worry about, I wouldn't mind maintaining/accompanying/taking care of/keeping an eye on/whatever psql until release (and possibly thereafter). 2. What about including an snprintf() into the source tree similar what is done with strdup()? (No, don't look at me, ittotally escapes me how to do that and I don't want to cheat and look at the GNU sources for obvious reasons.) -- Peter Eisentraut Sernanders vaeg 10:115 peter_e@gmx.net 75262 Uppsala http://yi.org/peter-e/ Sweden
pgsql-hackers by date: