aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/copy.c
Commit message (Collapse)AuthorAge
...
* pgindent run for release 9.3Bruce Momjian2013-05-29
| | | | | This is the first run of the Perl-based pgindent script. Also update pgindent instructions.
* Move pqsignal() to libpgport.Tom Lane2013-03-17
| | | | | | | | | We had two copies of this function in the backend and libpq, which was already pretty bogus, but it turns out that we need it in some other programs that don't use libpq (such as pg_test_fsync). So put it where it probably should have been all along. The signal-mask-initialization support in src/backend/libpq/pqsignal.c stays where it is, though, since we only need that in the backend.
* Add support for piping COPY to/from an external program.Heikki Linnakangas2013-02-27
| | | | | | | | | | | | | | | | | | This includes backend "COPY TO/FROM PROGRAM '...'" syntax, and corresponding psql \copy syntax. Like with reading/writing files, the backend version is superuser-only, and in the psql version, the program is run in the client. In the passing, the psql \copy STDIN/STDOUT syntax is subtly changed: if you the stdin/stdout is quoted, it's now interpreted as a filename. For example, "\copy foo from 'stdin'" now reads from a file called 'stdin', not from standard input. Before this, there was no way to specify a filename called stdin, stdout, pstdin or pstdout. This creates a new function in pgport, wait_result_to_str(), which can be used to convert the exit status of a process, as returned by wait(3), to a human-readable string. Etsuro Fujita, reviewed by Amit Kapila.
* Update copyrights for 2013Bruce Momjian2013-01-01
| | | | | Fully update git head, and update back branches in ./COPYRIGHT and legal.sgml files.
* Standardize naming of malloc/realloc/strdup wrapper functions.Tom Lane2012-10-02
| | | | | | | | | | | | We had a number of variants on the theme of "malloc or die", with the majority named like "pg_malloc", but by no means all. Standardize on the names pg_malloc, pg_malloc0, pg_realloc, pg_strdup. Get rid of pg_calloc entirely in favor of using pg_malloc0. This is an essentially cosmetic change, so no back-patch. (I did find a couple of places where psql and pg_dump were using plain malloc or strdup instead of the pg_ versions, but they don't look significant enough to bother back-patching.)
* Run pgindent on 9.2 source tree in preparation for first 9.3Bruce Momjian2012-06-10
| | | | commit-fest.
* Have \copy go through SendQueryAlvaro Herrera2012-01-25
| | | | | | | | | | | | | | | | This enables a bunch of features, notably ON_ERROR_ROLLBACK. It also makes COPY failure (either in the server or psql) as a whole behave more sanely in psql. Additionally, having more commands in the same command line as COPY works better (though since psql splits lines at semicolons, this doesn't matter much unless you're using -c). Also tighten a couple of switches on PQresultStatus() to add PGRES_COPY_BOTH support and stop assuming that unknown statuses received are errors; have those print diagnostics where warranted. Author: Noah Misch
* Update copyright notices for year 2012.Bruce Momjian2012-01-01
|
* Fix psql's counting of script file line numbers during COPY.Tom Lane2011-07-05
| | | | | | | | handleCopyIn incremented pset.lineno for each line of COPY data read from a file. This is correct when reading from the current script file (i.e., we are doing COPY FROM STDIN followed by in-line data), but it's wrong if the data is coming from some other file. Per bug #6083 from Steve Haslam. Back-patch to all supported versions.
* Stamp copyrights for year 2011.Bruce Momjian2011-01-01
|
* Remove cvs keywords from all files.Magnus Hagander2010-09-20
|
* Update copyright for the year 2010.Bruce Momjian2010-01-02
|
* Remove a couple hundred lines of ugly and tedious-to-maintain code by notTom Lane2009-09-19
| | | | | | | trying to parse COPY options exactly in psql's \copy support. Instead, just send the options as-is and let the backend sort it out. Emmanuel Cecchet
* Try to defend against the possibility that libpq is still in COPY_IN stateTom Lane2009-08-07
| | | | | | | | | | when we reach the post-COPY "pump it dry" error recovery code that was added 2006-11-24. Per a report from Neil Best, there is at least one code path in which this occurs, leading to an infinite loop in code that's supposed to be making it more robust not less so. A reasonable response seems to be to call PQputCopyEnd() again, so let's try that. Back-patch to all versions that contain the cleanup loop.
* Code review for FORCE QUOTE * patch: fix error checking to consider FORCETom Lane2009-07-25
| | | | | QUOTE * as a variety of FORCE QUOTE, and update psql documentation to include the option. (The actual psql code doesn't seem to need any changes.)
* Remove Windows-specific definition of S_ISDIR(). This should not be here;Tom Lane2009-04-26
| | | | | if there are any Windows configurations where port/win32.h fails to provide the macro, it should be fixed in the latter file not here.
* Update copyright for 2009.Bruce Momjian2009-01-01
|
* Prevent psql \copy from accepting multiple string parameters, e.g.Bruce Momjian2008-03-11
| | | | | | | | test=> \copy billing_data from ../BillingSamplePricerFile.csv with csv header quote as '"' null as 'abc' null as '123' \copy: parse error at "null" Per report from Stephen Frost
* Update copyrights in source tree to 2008.Bruce Momjian2008-01-01
|
* pgindent run for 8.3.Bruce Momjian2007-11-15
|
* Remove undocumented support for copy syntax from before 7.3. Update comments toAndrew Dunstan2007-03-16
| | | | reflect syntax actually supported, e.g. by including CSV params.
* Normalize fgets() calls to use sizeof() for calculating the buffer sizePeter Eisentraut2007-02-08
| | | | | | | where possible, and fix some sites that apparently thought that fgets() will overwrite the buffer by one byte. Also add some strlcpy() to eliminate some weird memory handling.
* Pass modern COPY syntax to backend, since copy (query) does not accept old ↵Andrew Dunstan2007-02-05
| | | | syntax. Per complaint from Michael Fuhr.
* Update CVS HEAD for 2007 copyright. Back branches are typically notBruce Momjian2007-01-05
| | | | back-stamped for this.
* Fix psql's \copy command to ensure that it cycles libpq back to the idle stateTom Lane2006-11-24
| | | | | | | | | (in particular, causing the ReadyForQuery message to be eaten) before returning from do_copy. The only known consequence of failing to do so is that get_prompt might show a wrong result for the %x transaction status escape, as reported by Bernd Helmle; but it's possible there are other issues. Back-patch as far as 7.4, the oldest version supporting %x.
* Message style improvementsPeter Eisentraut2006-10-06
|
* pgindent run for 8.2.Bruce Momjian2006-10-04
|
* Extend COPY to support COPY (SELECT ...) TO ...Tom Lane2006-08-30
| | | | Bernd Helmle
* Invent an assign-hook mechanism for psql variables similar to the oneTom Lane2006-08-29
| | | | | | | | | 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.
* Clean up psql's control-C handling to avoid longjmp'ing out of randomTom Lane2006-06-14
| | | | | | | | | 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.
* Prepare code to be built by MSVC:Bruce Momjian2006-06-07
| | | | | | | | | | o remove many WIN32_CLIENT_ONLY defines o add WIN32_ONLY_COMPILER define o add 3rd argument to open() for portability o add include/port/win32_msvc directory for system includes Magnus Hagander
* Respond to Jeremy Drake's original gripe that \copy needs to recognizeTom Lane2006-06-01
| | | | E'...' syntax for strings in order to track the backend.
* Fix up hack to suppress escape_string_warning so that it actually worksTom Lane2006-06-01
| | | | | | and there's only one place that's a kluge, ie, appendStringLiteralConn. Note that pg_dump itself doesn't use appendStringLiteralConn, so its behavior is not affected; only the other utility programs care.
* Escape processing patch:Bruce Momjian2006-05-31
| | | | | | | | | | o turns off escape_string_warning in pg_dumpall.c o optionally use E'' for \password (undocumented option?) o honor standard_conforming-strings for \copy (but not support literal E'' strings) o optionally use E'' for \d commands o turn off escape_string_warning for createdb, createuser, droplang
* Support binary COPY through psql. Also improve detection of write errorsTom Lane2006-05-26
| | | | during COPY OUT. Andreas Pflug, some editorialization by moi.
* Update copyright for 2006. Update scripts.Bruce Momjian2006-03-05
|
* Improve pg_dump and psql to use libpq's newer COPY support routines,Tom Lane2006-03-03
| | | | | instead of the old deprecated ones. Volkan Yazici, with some editorializing by moi.
* Standard pgindent run for 8.1.Bruce Momjian2005-10-15
|
* Add COPY WITH CVS HEADER to allow a heading line as the first line inBruce Momjian2005-05-07
| | | | | | COPY. Andrew Dunstan
* Use _() macro consistently rather than gettext(). Add translationBruce Momjian2005-02-22
| | | | macros around strings that were missing them.
* Update copyrights that were missed.Bruce Momjian2005-01-01
|
* Pgindent run for 8.0.Bruce Momjian2004-08-29
|
* Update copyright to 2004.Bruce Momjian2004-08-29
|
* Fix psql's COPY support to deal with \r\n line endings.Tom Lane2004-08-13
| | | | Andrew Dunstan, some further hacking by Tom Lane.
* Fix core dumps, inability to count, etc associated with canonicalize_pathTom Lane2004-08-13
| | | | patches.
* Use canonicalize_path for -D, GUC paths, and paths coming in fromBruce Momjian2004-07-11
| | | | environment variables.
* Use standard macro for psql binary file open. Add comment explainingBruce Momjian2004-07-11
| | | | control-z requirement.
* Open files in binary mode on Win32 so control-z isn't seen as EOF.Bruce Momjian2004-07-11
|
* Solve the 'Turkish problem' with undesirable locale behavior for caseTom Lane2004-05-07
| | | | | | | | | | | | | 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.
* Change COPY CSV keyword to be:Bruce Momjian2004-04-21
| | | | | FORCE QUOTE to force quotes FORCE NOT NULL to quote null input values