summaryrefslogtreecommitdiff
path: root/src/bin/psql/input.c
AgeCommit message (Collapse)Author
2006-12-24Make HISTCONTROL=ignoredups work again (broken by misordering ofTom Lane
operations during recent code refactoring). Per bug #2840 from Ned Crigler.
2006-10-04pgindent run for 8.2.Bruce Momjian
2006-08-29Invent an assign-hook mechanism for psql variables similar to the oneTom Lane
existing for backend GUC variables, and use this to eliminate repeated fetching/parsing of psql variables in psql's inner loops. In a trivial test with lots of 'select 1;' commands, psql's CPU time went down almost 10%, although of course the effect on total elapsed time was much less. Per discussion about how to ensure the upcoming FETCH_COUNT patch doesn't cost any performance when not being used.
2006-08-27Make saveHistory work properly on OS X when HISTFILE is set to /dev/null.Tom Lane
Per discussion with Martin Atukunda.
2006-07-14Remove 576 references of include files that were not needed.Bruce Momjian
2006-06-18Fix saveHistory() to not emit bogus complaint during psql exit when usingTom Lane
Darwin's libedit; per my proposal last August. Also, suppress cast-away- const warnings.
2006-06-14Clean up psql's control-C handling to avoid longjmp'ing out of randomTom Lane
places --- that risks corrupting data structures, losing sync with the backend, etc. We now longjmp only from calls to readline, fgets, and fread, which we assume are coded to protect themselves against interrupts at undesirable times. This requires adding explicit tests for cancel_pressed in long-running loops, but on the whole it's far cleaner. Martijn van Oosterhout and Tom Lane.
2006-06-11Code review for psql multiline history patch(es). Fix memory leak,Tom Lane
failure to enter commands in history if canceled by control-C, other infelicities.
2006-03-21Fix psql history handling:Bruce Momjian
> 1) Fix the problems with the \s command. > When the saveHistory is executed by the \s command we must not do the > conversion \n -> \x01 (per > http://archives.postgresql.org/pgsql-hackers/2006-03/msg00317.php ) > > 2) Fix the handling of Ctrl+C > > Now when you do > wsdb=# select 'your long query here ' > wsdb-# > and press afterwards the CtrlC the line "select 'your long query here '" > will be in the history > > (partly per > http://archives.postgresql.org/pgsql-hackers/2006-03/msg00297.php ) > > 3) Fix the handling of commands with not closed brackets, quotes, double > quotes. (now those commands are not splitted in parts...) > > 4) Fix the behaviour when SINGLELINE mode is used. (before it was almost > broken ;( Sergey E. Koposov
2006-03-06In psql, save history of backslash commands used in multi-lineBruce Momjian
statements before the multi-line statement, rather than inside the multi-line statement.
2006-03-05Update copyright for 2006. Update scripts.Bruce Momjian
2006-02-13Place function names in first column for consistency.Bruce Momjian
2006-02-13Fix build failure when not USE_READLINE. Sergey E. KoposovTom Lane
2006-02-12Use 0x01 for newlines in saved history. It was determined to be notBruce Momjian
used by multi-byte sequences, but futher invesetigation might prove this to be false.
2006-02-11o Improve psql's handling of multi-line statementsBruce Momjian
Currently, while \e saves a single statement as one entry, interactive statements are saved one line at a time. Ideally all statements would be saved like \e does. Sergey E. Koposov
2005-10-15Standard pgindent run for 8.1.Bruce Momjian
2005-06-10Use saveHistory so we get a nice error message on failure.Bruce Momjian
Andreas Seltenreich
2005-06-10the following patch makes the filename used to store the readlineBruce Momjian
history customizable through a variable named HISTFILE, analogous to psql's already implemented HISTCONTROL and HISTSIZE variables, and bash's HISTFILE-Variable. The motivation was to be able to get psql to maintain separate histories for separate databases. This is now easily achievable through a line like the following in ~/.psqlrc: \set HISTFILE ~/.psql_history-:DBNAME Andreas Seltenreich
2005-01-06Adjust lookup of client-side profile files (.pgpass and so on) as perTom Lane
discussion on pgsql-hackers-win32 list. Documentation still needs to be tweaked --- I'm not sure how to refer to the APPDATA folder in user documentation.
2005-01-01Update copyrights that were missed.Bruce Momjian
2004-10-12Message style revisionsPeter Eisentraut
2004-10-06Say "history is not supported" and remove "on this platform" for lack ofBruce Momjian
readline.
2004-10-06Suppress psql \s help display for platforms like Win32 that don'tBruce Momjian
typically install witn readline, and throw an error if they try to access it.
2004-09-27Remove inclusion of windows.h now that it is included in c.h, per ideaBruce Momjian
from Peter.
2004-08-29Pgindent run for 8.0.Bruce Momjian
2004-08-29Update copyright to 2004.Bruce Momjian
2004-08-18Add get_home_path() to use USERPROFILE on Win32 and HOME on Unix.Bruce Momjian
2004-01-25More fallout from the recent psql patch: rename xmalloc and friends toNeil Conway
pg_malloc, to avoid linker failures on same platforms.
2004-01-24This patch makes some of the memory manipulation performed by psql aNeil Conway
little more sane. Some parts of the code was using a static function xmalloc() that did safe memory allocation (where "safe" means "bail out on OOM"), but most of it was just invoking calloc() or malloc() directly. Now almost everything invokes xmalloc() or xcalloc().
2003-11-29$Header: -> $PostgreSQL Changes ...PostgreSQL Daemon
2003-09-12Remove WIN32_CONSOLE support, at the request of the author.Bruce Momjian
2003-09-05Clean up WIN32_CONSOLE code.Bruce Momjian
2003-08-26psql's HISTSIZE from .psqlrc do not want to be set so I did it for psqlBruce Momjian
that HISTSIZE might take effect from my .psqlrc Andriy Tkachuk
2003-08-04Fix some copyright notices that weren't updated. Improve copyright toolTom Lane
so it won't miss 'em again.
2003-08-04pgindent run.Bruce Momjian
2003-07-27here are the patches for psql on Win32:Bruce Momjian
psql4win32.patch - changes in the psql source code psql-ref.patch - changes in the documentation psql-ref.sgml (for new builtin variable WIN32_CONSOLE) To apply them use "patch -p 1" in the root directory of the postgres source directory. These patches fix the following problems of psql on Win32 (all changes only have effect #ifdef WIN32): a) Problem: Static library libpq.a did not work Solution: Added WSAStartup() in fe-connect.c b) Problem: Secret Password was echoed by psql Solution: Password echoing disabled in sprompt.c c) Problem: 8bit characters were displayed/interpreted wrong in psql This is due to the fact that the Win32 "console" uses a different encoding than the rest of the Windows system Solution: Introduced a new psql variable WIN32_CONSOLE When set with "\set WIN32_console", the function OemToChar() is applied after reading input and CharToOem() before displaying Output Christoph Dalitz
2003-07-25> Rod Taylor <rbt@rbt.ca> writes:Bruce Momjian
> > It seems that readline() on my system (FreeBSD 4.8) isn't declared to > > take the prompt as a const. Thus, remove const from gets_interactive() > > to remove the warning. > > I think it would be a lot cleaner to just put a cast to char * into the > readline call (with a note about why). Ok.. that works. I must say it's a little strange being able to take a constant and say its no longer constant anymore -- but I suppose it's no different than defining then undefining pre-processor constants. Rod Taylor <rbt@rbt.ca>
2003-07-23Apply message style guide to frontend programs.Peter Eisentraut
2003-03-20I'm continuing to work on cleaning up code in psql. As things appearBruce Momjian
now, my changes seem to work. Some possible minor bugs got squished on the way but I can't be sure without more feedback from people who really put the code to the test. The new patch mostly simplifies variable handling and reduces code duplication. Changes in the command parser eliminate some redundant variables (boolean state + depth counter), replaces some "else if" constructs with switches, and so on. It is meant to be applied together with my previous patch, although I hope they don't conflict; I went back to the CVS version for this one. One more thing I thought should perhaps be changed: an IGNOREEOF value of n will ignore only n-1 EOFs. I didn't want to touch this for fear of breaking existing applications, but it does seem a tad illogical. Jeroen T. Vermeulen
2003-03-20Here's some changes I made last night to psql's common.c (as found inBruce Momjian
7.3.2). It removes some code duplication and #ifdeffing, and some unstructured ugliness such as tacky breaks and an unneeded continue. Breaks up a large function into smaller functions and reduces required nesting levels, and kills a variable or two. Jeroen T. Vermeulen
2002-09-06Fix printf() quote handling and improper exit(), per Tom.Bruce Momjian
2002-09-05Remove PGPASSWORDFILE and default to always trying $HOME/.pgpass.Bruce Momjian
Cleanup up memory allocation for $HOME in related psql places. Update mention of $HOME/.pgpass in the docs; add mention in pg_dumpall.
2002-04-10Readline and Zlib now required by default. Add options --without-readlinePeter Eisentraut
and --without-zlib to turn them off.
2001-10-25pgindent run on all C files. Java run to follow. initdb/regressionBruce Momjian
tests pass.
2001-09-11Invoke on_exit() with correct number and type of arguments.Peter Eisentraut
2001-02-27Massive commits for SunOS4 port.Tatsuo Ishii
2001-02-10Restructure the key include files per recent pghackers discussion: thereTom Lane
are now separate files "postgres.h" and "postgres_fe.h", which are meant to be the primary include files for backend .c files and frontend .c files respectively. By default, only include files meant for frontend use are installed into the installation include directory. There is a new make target 'make install-all-headers' that adds the whole content of the src/include tree to the installed fileset, for use by people who want to develop server-side code without keeping the complete source tree on hand. Cleaned up a whole lot of crufty and inconsistent header inclusions.
2000-11-27Pay attention to failure returns from fgets() in all cases.Tom Lane
Avoid infinite loop prompting for password at stdin EOF.
2000-04-12Ye-old pgindent run. Same 4-space tabs.Bruce Momjian
2000-02-20Moved psql \eset and \eshow to \encodingPeter Eisentraut
Improved psql's Ctrl-C handling Fixed configure test for sigsetjmp that now even recognizes it if it's a macro