summaryrefslogtreecommitdiff
path: root/src/bin/psql/common.c
AgeCommit message (Collapse)Author
2007-06-22In psql, when running a SELECT query using a cursor, flush the queryNeil Conway
output after each FETCH. This ensures that incremental results are available to clients that are executing long-running SELECT queries via the FETCH_COUNT feature.
2007-04-16Don't write timing output in quiet mode.Magnus Hagander
Merlin Moncure
2006-10-04pgindent run for 8.2.Bruce Momjian
2006-09-27Remove separate strdup.h header file; it's redundant with port.h.Tom Lane
2006-08-29Dept. of second thoughts: if query fails part way through, shut downTom Lane
the pager before reporting the error.
2006-08-29Create a FETCH_COUNT parameter that causes psql to execute SELECT-likeTom Lane
queries via a cursor, fetching a limited number of rows at a time and therefore not risking exhausting memory. A disadvantage of the scheme is that 'aligned' output mode will align each group of rows independently leading to odd-looking output, but all the other output formats work reasonably well. Chris Mair, with some additional hacking by moi.
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-25Add the ability to create indexes 'concurrently', that is, withoutTom Lane
blocking concurrent writes to the table. Greg Stark, with a little help from Tom Lane.
2006-08-13Cause psql to report both the returned data and the command status tagTom Lane
for INSERT/UPDATE/DELETE RETURNING. Per discussion.
2006-08-11Make the psql line counter 64-bit so it can handle files > 4gig lines.Bruce Momjian
David Fetter
2006-07-14Remove 576 references of include files that were not needed.Bruce Momjian
2006-06-30Fix memory leak introduced in the prior commit, detected by Tom Lane.Alvaro Herrera
2006-06-30Fix use-after-free error reported by Neil Conway.Alvaro Herrera
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-05-26Support binary COPY through psql. Also improve detection of write errorsTom Lane
during COPY OUT. Andreas Pflug, some editorialization by moi.
2006-05-11Code review for standard_conforming_strings patch. Fix it so it does notTom Lane
throw warnings for 100%-SQL-standard constructs, clean up some minor infelicities, try to un-break ecpg to the best of my ability. (It's not clear how ecpg is going to find out the setting of standard_conforming_strings, though.) I think pg_dump still needs work, too.
2006-03-14Improve parser so that we can show an error cursor position for errorsTom Lane
during parse analysis, not only errors detected in the flex/bison stages. This is per my earlier proposal. This commit includes all the basic infrastructure, but locations are only tracked and reported for errors involving column references, function calls, and operators. More could be done later but this seems like a good set to start with. I've also moved the ReportSyntaxErrorPosition logic out of psql and into libpq, which should make it available to more people --- even within psql this is an improvement because warnings weren't handled by ReportSyntaxErrorPosition.
2006-03-06Enable standard_conforming_strings to be turned on.Bruce Momjian
Kevin Grittner
2006-03-05Update copyright for 2006. Update scripts.Bruce Momjian
2006-03-03Improve pg_dump and psql to use libpq's newer COPY support routines,Tom Lane
instead of the old deprecated ones. Volkan Yazici, with some editorializing by moi.
2006-02-12Fix more fallout from line-wrap patch, to wit, arbitrarily changingTom Lane
the API of PQdsplen without bothering to fix its callers. Although ReportSyntaxErrorPosition could probably do with more smarts about handling control characters, for the moment I'll just get it back to handling tabs consistently.
2005-11-22Re-run pgindent, fixing a problem where comment lines after a blankBruce Momjian
comment line where output as too long, and update typedefs for /lib directory. Also fix case where identifiers were used as variable names in the backend, but as typedefs in ecpg (favor the backend for indenting). Backpatch to 8.1.X.
2005-11-04Ensure that we only create one ConsoleCtrlHandler per psql process,Tom Lane
so as to avoid performance issues and possible ultimate crash on long psql scripts. Per Merlin Moncure.
2005-10-27Disable expanded mode only for \d tablename, not for all backslashBruce Momjian
commands. Per complaint that \df+ is clearer in expanded mode.
2005-10-15Standard pgindent run for 8.1.Bruce Momjian
2005-10-13The patch updates the documentation to reflect the fact that higher valuesBruce Momjian
of client_min_messages (fatal + panic) are valid and also fixes a slight issue with how psql tried to display error messages that aren't sent to the client. We often tell people to ignore errors in response to requests for things like "drop if exists", but there's no good way to completely hide this without upping client_min_messages past ERROR. When running a file like SET client_min_messages TO 'FATAL'; DROP TABLE doesntexist; with "psql -f filename" you get an error prefix of "psql:/home/username/filename:3" even though there is no error message to prefix because it isn't sent to the client. Kris Jurka
2005-10-04Clean up some messages and fix missing translation support. Option --logPeter Eisentraut
renamed to --log-file for clarity.
2005-09-20Fix interaction between psql \set AUTOCOMMIT and "ON_ERROR_ROLLBACK"Bruce Momjian
by properly updating transaction state after AUTOCOMMIT.
2005-06-22Make REINDEX DATABASE do what one would expect, namely reindex all indexesTom Lane
in the database. The old behavior (reindex system catalogs only) is now available as REINDEX SYSTEM. I did not add the complementary REINDEX USER case since there did not seem to be consensus for this, but it would be trivial to add later. Per recent discussions.
2005-06-17Two-phase commit. Original patch by Heikki Linnakangas, with additionalTom Lane
hacking by Alvaro Herrera and Tom Lane.
2005-06-14Add -L option to psql to log sessions.Bruce Momjian
Lorne Sunley
2005-06-13Per discussion on -hackers, this patch changes psql's "expanded" outputNeil Conway
mode to only affect the presentation of normal query results, not the output of psql slash commands. Documentation updated. I also made some unrelated minor psql cleanup. Per suggestion from Stuart Cooper.
2005-06-10More Win32 tilde code comments.Bruce Momjian
2005-06-10Add comment on tilde expansion.Bruce Momjian
2005-05-30Support only octal for psql PROMPT values, rather than the confusingBruce Momjian
hex/decimal/octal. Documentation already updated. BACKWARD COMPATIBLE CHANGE
2005-04-28Add psql \set ON_ERROR_ROLLBACK to allow statements in a transaction toBruce Momjian
error without affecting the entire transaction. Valid values are "on|interactive|off".
2005-02-22Use _() macro consistently rather than gettext(). Add translationBruce Momjian
macros around strings that were missing them.
2005-01-01Update copyrights that were missed.Bruce Momjian
2004-11-01That's just the lovely way windows handles a "segfault". Gotta be reallyBruce Momjian
interesting for MS to catch all those dumps... Anyway. Oops. Seems I ran my regression tests with the old psql, and just managed to update the backend, when I tested that patch. Turns out there are codepaths where we'd access the Critical Section before it was initialized. Attached patch breaks the initializeation off to a separate part and adds that one to a much earlier position in the program. Magnus Hagander
2004-10-30Invent a new, more thread-safe version of PQrequestCancel, called PQcancel.Tom Lane
Use this new function in psql. Implement query cancellation in psql for Windows. Code by Magnus Hagander, documentation and minor editorialization by Tom Lane.
2004-10-10Cosmetic improvements/code cleanup:Neil Conway
- replace some function signatures of the form "some_type foo()" with "some_type foo(void)" - replace a few instances of a literal 0 being used as a NULL pointer; there are more instances of this in the code, but I just fixed a few - in src/backend/utils/mb/wstrncmp.c, replace K&R style function declarations with ANSI style, remove use of 'register' keyword - remove an "extern" modifier that was applied to a function definition (rather than a declaration)
2004-09-20Fix some shortcomings in psql's autocommit-off mode concerning detectionTom Lane
of commands for which a transaction block should not be forced. Recognize VACUUM and other PreventTransactionChain commands; handle nested /* .. */ comments correctly; handle multibyte encodings correctly. Michael Paesold with some kibitzing from Tom Lane.
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-05-23A few cosmetic fixes and code cleanup.Neil Conway
2004-05-07Solve the 'Turkish problem' with undesirable locale behavior for caseTom Lane
conversion of basic ASCII letters. Remove all uses of strcasecmp and strncasecmp in favor of new functions pg_strcasecmp and pg_strncasecmp; remove most but not all direct uses of toupper and tolower in favor of pg_toupper and pg_tolower. These functions use the same notions of case folding already developed for identifier case conversion. I left the straight locale-based folding in place for situations where we are just manipulating user data and not trying to match it to built-in strings --- for example, the SQL upper() function is still locale dependent. Perhaps this will prove not to be what's wanted, but at the moment we can initdb and pass regression tests in Turkish locale.
2004-03-21Revise syntax-error reporting behavior to give pleasant results forTom Lane
errors in internally-generated queries, such as those submitted by plpgsql functions. Per recent discussions with Fabien Coelho.
2004-03-15Add PQmbdsplen() which returns the "display length" of a character.Tatsuo Ishii
Still some works needed: - UTF-8, MULE_INTERNAL always returns 1
2004-03-14Teach psql to show the location of syntax errors visually, per recentTom Lane
discussions. Patch by Fabien Coelho and Tom Lane. Still needs to be taught about multi-screen-column kanji characters; Tatsuo has promised to provide the needed infrastructure for that.