summaryrefslogtreecommitdiff
path: root/src/bin/psql/input.c
AgeCommit message (Collapse)Author
2013-10-22Replace pg_asprintf() with psprintf().Tom Lane
This eliminates an awkward coding pattern that's also unnecessarily inconsistent with backend coding. psprintf() is now the thing to use everywhere.
2013-10-13Add use of asprintf()Peter Eisentraut
Add asprintf(), pg_asprintf(), and psprintf() to simplify string allocation and composition. Replacement implementations taken from NetBSD. Reviewed-by: Álvaro Herrera <[email protected]> Reviewed-by: Asif Naeem <[email protected]>
2013-01-01Update copyrights for 2013Bruce Momjian
Fully update git head, and update back branches in ./COPYRIGHT and legal.sgml files.
2012-06-10Run pgindent on 9.2 source tree in preparation for first 9.3Bruce Momjian
commit-fest.
2012-03-03Provide environment overrides for psql file locations.Andrew Dunstan
PSQL_HISTORY provides an alternative for the command history file, and PSQLRC provides an alternative location for the .psqlrc file.
2012-01-01Update copyright notices for year 2012.Bruce Momjian
2011-12-27Remove support for on_exit()Peter Eisentraut
All supported platforms support the C89 standard function atexit() (SunOS 4 probably being the last one not to), and supporting both makes the code clumsy.
2011-11-16Don't elide blank lines when accumulating psql command history.Robert Haas
This can change the meaning of queries, if the blank line happens to occur in the middle of a quoted literal, as per complaint from Tomas Vondra. Back-patch to all supported branches.
2011-01-01Stamp copyrights for year 2011.Bruce Momjian
2010-09-20Remove cvs keywords from all files.Magnus Hagander
2010-02-26pgindent run for 9.0Bruce Momjian
2010-01-02Update copyright for the year 2010.Bruce Momjian
2009-09-13Write psql's ~/.psql_history file using history_truncate_file() andTom Lane
append_history(), if libreadline is new enough to have those functions (they seem to be present at least since 4.2; but libedit may not have them). This gives significantly saner behavior when two or more sessions overlap in their use of the history file; although having two sessions exit at just the same time is still perilous to your history. The behavior of \s remains unchanged, ie, overwrite whatever was there. Per bug #5052 from Marek Wójtowicz.
2009-01-01Update copyright for 2009.Bruce Momjian
2008-11-26Adjust the behavior of the PQExpBuffer code to make it have well-definedTom Lane
results (ie, an empty "broken" buffer) if memory overrun occurs anywhere along the way to filling the buffer. The previous coding would just silently discard portions of the intended buffer contents, as exhibited in trouble report from Sam Mason. Also, tweak psql's main loop to correctly detect and report such overruns. There's probably much more that should be done in this line, but this is a start.
2008-01-01Update copyrights in source tree to 2008.Bruce Momjian
2007-11-28Properly recognize and announce input errors.Peter Eisentraut
2007-01-05Update CVS HEAD for 2007 copyright. Back branches are typically notBruce Momjian
back-stamped for this.
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