aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-exec.c
Commit message (Collapse)AuthorAge
* Add libpq comment about how to determine the format used for passingBruce Momjian2008-06-23
| | | | | | binary values. Add comments to libpq C function for parameter passing.
* Tweak libpq to avoid crashing due to incorrect buffer size calculation whenTom Lane2008-05-29
| | | | | | | | | | | | | | we are on a 64-bit machine (ie, size_t is wider than int) and someone passes in a query string that approaches or exceeds INT_MAX bytes. Also, just for paranoia's sake, guard against similar overflows in sizing the input buffer. The backend will not in the foreseeable future be prepared to send or receive strings exceeding 1GB, so I didn't take the more invasive step of switching all the buffer index variables from int to size_t; though someday we might want to do that. I have a suspicion that this is not the only such bug in libpq, but this fix is enough to take care of the crash reported by Francisco Reyes.
* Update copyrights in source tree to 2008.Bruce Momjian2008-01-01
|
* Fix the inadvertent libpq ABI breakage discovered by Martin Pitt: theTom Lane2007-10-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | renumbering of encoding IDs done between 8.2 and 8.3 turns out to break 8.2 initdb and psql if they are run with an 8.3beta1 libpq.so. For the moment we can rearrange the order of enum pg_enc to keep the same number for everything except PG_JOHAB, which isn't a problem since there are no direct references to it in the 8.2 programs anyway. (This does force initdb unfortunately.) Going forward, we want to fix things so that encoding IDs can be changed without an ABI break, and this commit includes the changes needed to allow libpq's encoding IDs to be treated as fully independent of the backend's. The main issue is that libpq clients should not include pg_wchar.h or otherwise assume they know the specific values of libpq's encoding IDs, since they might encounter version skew between pg_wchar.h and the libpq.so they are using. To fix, have libpq officially export functions needed for encoding name<=>ID conversion and validity checking; it was doing this anyway unofficially. It's still the case that we can't renumber backend encoding IDs until the next bump in libpq's major version number, since doing so will break the 8.2-era client programs. However the code is now prepared to avoid this type of problem in future. Note that initdb is no longer a libpq client: we just pull in the two source files we need directly. The patch also fixes a few places that were being sloppy about checking for an unrecognized encoding name.
* Update CVS HEAD for 2007 copyright. Back branches are typically notBruce Momjian2007-01-05
| | | | back-stamped for this.
* pgindent run for 8.2.Bruce Momjian2006-10-04
|
* Add PQdescribePrepared, PQdescribePortal, and related functions to libpqTom Lane2006-08-18
| | | | | to allow obtaining information about previously prepared statements and open cursors. Volkan Yazici
* Add some blank lines for formatting.Bruce Momjian2006-08-04
|
* Remove libpq's PQescapeIdentifier(), not safe from injection attacks.Bruce Momjian2006-07-04
|
* Add PQescapeIdentifier() to libpqBruce Momjian2006-06-27
| | | | Christopher Kings-Lynne
* Fix up pg_dump to do string escaping fully correctly for client encodingTom Lane2006-05-28
| | | | | | | | | and standard_conforming_strings; likewise for the other client programs that need it. As per previous discussion, a pg_dump dump now conforms to the standard_conforming_strings setting of the source database. We don't use E'' syntax in the dump, thereby improving portability of the SQL. I added a SET escape_strings_warning = off command to keep the dumps from getting a lot of back-chatter from that.
* Don't call PQclear until the struct is really no longer going to be used.Alvaro Herrera2006-05-28
| | | | | | | Per Coverity bug #304. Thanks to Martijn van Oosterhout for reporting it. Zero out the pointer fields of PGresult so that these mistakes are more easily catched, per discussion.
* Add PQisthreadsafe() to libpq, to allow library applications to queryBruce Momjian2006-05-23
| | | | the thread-safety status of the library.
* Modify libpq's string-escaping routines to be aware of encoding considerationsTom Lane2006-05-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and standard_conforming_strings. The encoding changes are needed for proper escaping in multibyte encodings, as per the SQL-injection vulnerabilities noted in CVE-2006-2313 and CVE-2006-2314. Concurrent fixes are being applied to the server to ensure that it rejects queries that may have been corrupted by attempted SQL injection, but this merely guarantees that unpatched clients will fail rather than allow injection. An actual fix requires changing the client-side code. While at it we have also fixed these routines to understand about standard_conforming_strings, so that the upcoming changeover to SQL-spec string syntax can be somewhat transparent to client code. Since the existing API of PQescapeString and PQescapeBytea provides no way to inform them which settings are in use, these functions are now deprecated in favor of new functions PQescapeStringConn and PQescapeByteaConn. The new functions take the PGconn to which the string will be sent as an additional parameter, and look inside the connection structure to determine what to do. So as to provide some functionality for clients using the old functions, libpq stores the latest encoding and standard_conforming_strings values received from the backend in static variables, and the old functions consult these variables. This will work reliably in clients using only one Postgres connection at a time, or even multiple connections if they all use the same encoding and string syntax settings; which should cover many practical scenarios. Clients that use homebrew escaping methods, such as PHP's addslashes() function or even hardwired regexp substitution, will require extra effort to fix :-(. It is strongly recommended that such code be replaced by use of PQescapeStringConn/PQescapeByteaConn if at all feasible.
* Improve parser so that we can show an error cursor position for errorsTom Lane2006-03-14
| | | | | | | | | | | 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.
* Update copyright for 2006. Update scripts.Bruce Momjian2006-03-05
|
* Teach PQcmdTuples() that a COPY command tag might contain a row count,Tom Lane2006-03-03
| | | | | and tighten up its sanity checking of the tag as a safety measure. Volkan Yazici.
* Remove unnecessary PQconsumeInput call from PQputCopyData; it's redundantTom Lane2006-01-25
| | | | | | | because pqSendSome will absorb input data anytime it'd be forced to block. Avoiding a kernel call per PQputCopyData call helps COPY speed materially. Alon Goldshuv
* Cosmetic code cleanup: fix a bunch of places that used "return (expr);"Neil Conway2006-01-11
| | | | | | rather than "return expr;" -- the latter style is used in most of the tree. I kept the parentheses when they were necessary or useful because the return expression was complex.
* Re-run pgindent, fixing a problem where comment lines after a blankBruce Momjian2005-11-22
| | | | | | | | | 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.
* Standard pgindent run for 8.1.Bruce Momjian2005-10-15
|
* Suppress signed-vs-unsigned-char warnings.Tom Lane2005-09-24
|
* The attached patch updates the thread test program to run stand-alone onBruce Momjian2005-08-23
| | | | | | | | Windows. The test itself is bypassed in configure as discussed, and libpq has been updated appropriately to allow it to build in thread-safe mode. Dave Page
* Back out incorrect commit.Bruce Momjian2005-08-23
|
* Fix function name.Bruce Momjian2005-08-23
|
* Disable strtoul() ERANGE check on Win32, because it isn't thread safe,Bruce Momjian2005-08-13
| | | | and it isn't really required.
* Add E'' to internally created SQL strings that contain backslashes.Bruce Momjian2005-07-02
| | | | Improve code clarity by using macros for E'' processing.
* libpq was not consistently checking for memory allocation failures. ThisNeil Conway2005-06-12
| | | | | | | patch adds missing checks to the call sites of malloc(), strdup(), PQmakeEmptyPGresult(), pqResultAlloc(), and pqResultStrdup(), and updates the documentation. Per original report from Volkan Yazici about PQmakeEmptyPGresult() not checking for malloc() failure.
* Defend against omitted paramLengths[] array in PQsendQueryParams.Tom Lane2005-06-09
| | | | Per Volkan Yazici.
* Backpatch BCC compile changes to 8.0.X for psql.Bruce Momjian2005-04-29
|
* Tag appropriate files for rc3PostgreSQL Daemon2004-12-31
| | | | | | | | Also performed an initial run through of upgrading our Copyright date to extend to 2005 ... first run here was very simple ... change everything where: grep 1996-2004 && the word 'Copyright' ... scanned through the generated list with 'less' first, and after, to make sure that I only picked up the right entries ...
* Standardize on using the Min, Max, and Abs macros that are in our c.h file,Tom Lane2004-10-21
| | | | | | getting rid of numerous ad-hoc versions that have popped up in various places. Shortens code and avoids conflict with Windows min() and max() macros.
* Add PQprepare/PQsendPrepared functions to libpq to support preparingTom Lane2004-10-18
| | | | | statements without necessarily specifying the datatypes of their parameters. Abhijit Menon-Sen with some help from Tom Lane.
* Remove dllist.c from libpq. It's overkill for what libpq needs; we canTom Lane2004-10-16
| | | | | | | just stick a list-link into struct PGnotify instead. Result is a smaller faster and more robust library (mainly because we reduce the number of malloc's and free's involved in notify processing), plus less pollution of application link-symbol namespace.
* Another pgindent run with lib typedefs added.Bruce Momjian2004-08-30
|
* Pgindent run for 8.0.Bruce Momjian2004-08-29
|
* Update copyright to 2004.Bruce Momjian2004-08-29
|
* 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.
* Fix error in termination of COPY IN mode when using V2 protocol.Tom Lane2004-03-14
| | | | Report and fix per ljb, 8-Mar-04.
* libpq's query to get the OIDs of large-object support functions was notTom Lane2004-03-05
| | | | | schema-safe. Make it so, and improve the internal support for knowledge of server version.
* Avoid infinite loop if connection is lost during PQexecStart() orTom Lane2003-12-28
| | | | PQexecFinish(). Per report from Andreas Pflug.
* Make PQescapeBytea and byteaout consistent with each other, andJoe Conway2003-11-30
| | | | | | octal escape all octets outside the range 0x20 to 0x7e. This fixes the problem pointed out by Sergey Yatskevich here: http://archives.postgresql.org/pgsql-bugs/2003-11/msg00140.php
* $Header: -> $PostgreSQL Changes ...PostgreSQL Daemon2003-11-29
|
* Minor cleanup of PQunescapeBytea(). Avoid unportable assumptions aboutTom Lane2003-10-31
| | | | | | behavior of malloc and realloc when request size is 0. Fix escape sequence recognizer so that only valid 3-digit octal sequences are treated as escape sequences ... isdigit() is not a correct test.
* Adjust libpq to avoid deadlock when both client and server want to sendTom Lane2003-10-19
| | | | | | data, and both have filled the transmission buffers. One scenario where this can happen was illustrated here: http://archives.postgresql.org/pgsql-hackers/2003-04/msg00979.php
* Document the always-true-but-previously-undocumented fact that PQfnumber()Tom Lane2003-10-04
| | | | | | | will downcase the supplied field name unless it is double-quoted. Also, upgrade the routine's handling of double quotes to match the backend, in particular support doubled double quotes within quoted identifiers. Per pgsql-interfaces discussion a couple weeks ago.
* Cause PQescapeString to stop processing at a null character, ratherTom Lane2003-10-03
| | | | | | than generating an invalid output string. Per observation and patch from Igor Shevchenko. Further code cleanup and documentation by Tom Lane.
* Don't use 0 as a spelling of NULL.Tom Lane2003-10-02
|
* Message wording improvementsPeter Eisentraut2003-09-22
|
* Enable Win32 to compile libpq again, and enable SSL compiles on thatBruce Momjian2003-09-05
| | | | | | platform. Andreas Pflug