summaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-exec.c
AgeCommit message (Collapse)Author
2006-10-04pgindent run for 8.2.Bruce Momjian
2006-08-18Add PQdescribePrepared, PQdescribePortal, and related functions to libpqTom Lane
to allow obtaining information about previously prepared statements and open cursors. Volkan Yazici
2006-08-04Add some blank lines for formatting.Bruce Momjian
2006-07-04Remove libpq's PQescapeIdentifier(), not safe from injection attacks.Bruce Momjian
2006-06-27Add PQescapeIdentifier() to libpqBruce Momjian
Christopher Kings-Lynne
2006-05-28Fix up pg_dump to do string escaping fully correctly for client encodingTom Lane
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.
2006-05-28Don't call PQclear until the struct is really no longer going to be used.Alvaro Herrera
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.
2006-05-23Add PQisthreadsafe() to libpq, to allow library applications to queryBruce Momjian
the thread-safety status of the library.
2006-05-21Modify libpq's string-escaping routines to be aware of encoding considerationsTom Lane
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.
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-05Update copyright for 2006. Update scripts.Bruce Momjian
2006-03-03Teach PQcmdTuples() that a COPY command tag might contain a row count,Tom Lane
and tighten up its sanity checking of the tag as a safety measure. Volkan Yazici.
2006-01-25Remove unnecessary PQconsumeInput call from PQputCopyData; it's redundantTom Lane
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
2006-01-11Cosmetic code cleanup: fix a bunch of places that used "return (expr);"Neil Conway
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.
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-10-15Standard pgindent run for 8.1.Bruce Momjian
2005-09-24Suppress signed-vs-unsigned-char warnings.Tom Lane
2005-08-23The attached patch updates the thread test program to run stand-alone onBruce Momjian
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
2005-08-23Back out incorrect commit.Bruce Momjian
2005-08-23Fix function name.Bruce Momjian
2005-08-13Disable strtoul() ERANGE check on Win32, because it isn't thread safe,Bruce Momjian
and it isn't really required.
2005-07-02Add E'' to internally created SQL strings that contain backslashes.Bruce Momjian
Improve code clarity by using macros for E'' processing.
2005-06-12libpq was not consistently checking for memory allocation failures. ThisNeil Conway
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.
2005-06-09Defend against omitted paramLengths[] array in PQsendQueryParams.Tom Lane
Per Volkan Yazici.
2005-04-29Backpatch BCC compile changes to 8.0.X for psql.Bruce Momjian
2004-12-31Tag appropriate files for rc3PostgreSQL Daemon
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 ...
2004-10-21Standardize on using the Min, Max, and Abs macros that are in our c.h file,Tom Lane
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.
2004-10-18Add PQprepare/PQsendPrepared functions to libpq to support preparingTom Lane
statements without necessarily specifying the datatypes of their parameters. Abhijit Menon-Sen with some help from Tom Lane.
2004-10-16Remove dllist.c from libpq. It's overkill for what libpq needs; we canTom Lane
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.
2004-08-30Another pgindent run with lib typedefs added.Bruce Momjian
2004-08-29Pgindent run for 8.0.Bruce Momjian
2004-08-29Update copyright to 2004.Bruce Momjian
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-14Fix error in termination of COPY IN mode when using V2 protocol.Tom Lane
Report and fix per ljb, 8-Mar-04.
2004-03-05libpq's query to get the OIDs of large-object support functions was notTom Lane
schema-safe. Make it so, and improve the internal support for knowledge of server version.
2003-12-28Avoid infinite loop if connection is lost during PQexecStart() orTom Lane
PQexecFinish(). Per report from Andreas Pflug.
2003-11-30Make PQescapeBytea and byteaout consistent with each other, andJoe Conway
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
2003-11-29$Header: -> $PostgreSQL Changes ...PostgreSQL Daemon
2003-10-31Minor cleanup of PQunescapeBytea(). Avoid unportable assumptions aboutTom Lane
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.
2003-10-19Adjust libpq to avoid deadlock when both client and server want to sendTom Lane
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
2003-10-04Document the always-true-but-previously-undocumented fact that PQfnumber()Tom Lane
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.
2003-10-03Cause PQescapeString to stop processing at a null character, ratherTom Lane
than generating an invalid output string. Per observation and patch from Igor Shevchenko. Further code cleanup and documentation by Tom Lane.
2003-10-02Don't use 0 as a spelling of NULL.Tom Lane
2003-09-22Message wording improvementsPeter Eisentraut
2003-09-05Enable Win32 to compile libpq again, and enable SSL compiles on thatBruce Momjian
platform. Andreas Pflug
2003-08-27Share PG_DIAG_* macros between client and server and use them internally.Peter Eisentraut
2003-08-13libpq failed to cope with COPY FROM STDIN if the command was issuedTom Lane
via extended query protocol, because it sends Sync right after Execute without realizing that the command to be executed is COPY. There seems to be no reasonable way for it to realize that, either, so the best fix seems to be to make the backend ignore Sync during copy-in mode. Bit of a wart on the protocol, but little alternative. Also, libpq must send another Sync after terminating the COPY, if the command was issued via Execute.
2003-08-13Add PQexecPrepared() and PQsendQueryPrepared() functions, to allowTom Lane
libpq users to perform Bind/Execute of previously prepared statements. Per yesterday's discussion, this offers enough performance improvement to justify bending the 'no new features during beta' rule.
2003-08-04Update copyrights to 2003.Bruce Momjian
2003-08-04pgindent run.Bruce Momjian