summaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-exec.c
AgeCommit message (Collapse)Author
2002-04-08Fix PQescapeBytea/PQunescapeBytea so that they handle bytes > 0x7f.Tatsuo Ishii
This is necessary for mulibyte character sequences. See "[HACKERS] PQescapeBytea is not multibyte aware" thread posted around 2002/04/05 for more details.
2002-03-06Change made to elog:Bruce Momjian
o Change all current CVS messages of NOTICE to WARNING. We were going to do this just before 7.3 beta but it has to be done now, as you will see below. o Change current INFO messages that should be controlled by client_min_messages to NOTICE. o Force remaining INFO messages, like from EXPLAIN, VACUUM VERBOSE, etc. to always go to the client. o Remove INFO from the client_min_messages options and add NOTICE. Seems we do need three non-ERROR elog levels to handle the various behaviors we need for these messages. Regression passed.
2002-03-05Back out old version and update with newer patch of:Bruce Momjian
Fix for non-blocking connections in libpq Bernhard Herzog
2002-03-05Here's a patch against 7.1.3 that fixes a problem with sending largerBruce Momjian
queries over non-blocking connections with libpq. "Larger" here basically means that it doesn't fit into the output buffer. The basic strategy is to fix pqFlush and pqPutBytes. The problem with pqFlush as it stands now is that it returns EOF when an error occurs or when not all data could be sent. The latter case is clearly not an error for a non-blocking connection but the caller can't distringuish it from an error very well. The first part of the fix is therefore to fix pqFlush. This is done by to renaming it to pqSendSome which only differs from pqFlush in its return values to allow the caller to make the above distinction and a new pqFlush which is implemented in terms of pqSendSome and behaves exactly like the old pqFlush. The second part of the fix modifies pqPutBytes to use pqSendSome instead of pqFlush and to either send all the data or if not all data can be sent on a non-blocking connection to at least put all data into the output buffer, enlarging it if necessary. The callers of pqPutBytes don't have to be changed because from their point of view pqPutBytes behaves like before. It either succeeds in queueing all output data or fails with an error. I've also added a new API function PQsendSome which analogously to PQflush just calls pqSendSome. Programs using non-blocking queries should use this new function. The main difference is that this function will have to be called repeatedly (calling select() properly in between) until all data has been written. AFAICT, the code in CVS HEAD hasn't changed with respect to non-blocking queries and this fix should work there, too, but I haven't tested that yet. Bernhard Herzog
2002-03-04Add PQunescapeBytea libpq function.Bruce Momjian
Everyone using libpq and bytea is probably having to invent this wheel.. Patrick Welche
2001-10-25pgindent run on all C files. Java run to follow. initdb/regressionBruce Momjian
tests pass.
2001-09-14> Here's a revised patch. Changes:Bruce Momjian
> > 1. Now outputs '\\' instead of '\134' when using encode(bytea, 'escape') > Note that I ended up leaving \0 as \000 so that there are no ambiguities > when decoding something like, for example, \0123. > > 2. Fixed bug in byteain which allowed input values which were not valid > octals (e.g. \789), to be parsed as if they were octals. > > Joe > Here's rev 2 of the bytea string support patch. Changes: 1. Added missing declaration for MatchBytea function 2. Added PQescapeBytea to fe-exec.c 3. Applies cleanly on cvs tip from this afternoon I'm hoping that someone can review/approve/apply this before beta starts, so I guess I'd vote (not that it counts for much) to delay beta a few days :-) Joe Conway
2001-09-13> I found a problem with PQescapeString (I think). Since it escapesBruce Momjian
> null bytes to be literally '\0', the following can happen: > 1. User inputs string value as "<null byte>##" where ## are digits in the > range of 0 to 7. > 2. PQescapeString converts this to "\0##" > 3. Escaped string is used in a context that causes "\0##" to be evaluated as > an octal escape sequence. I agree that this is a problem, though it is not possible to do anything harmful with it. In addition, it only occurs if there are any NUL characters in its input, which is very unlikely if you are using C strings. The patch below addresses the issue by removing escaping of \0 characters entirely. > If the goal is to "safely" encode null bytes, and preserve the rest of the > string as it was entered, I think the null bytes should be escaped as \\000 > (note that if you simply use \000 the same string truncation problem > occurs). We can't do that, this would require 4n + 1 bytes of storage for the result, breaking the interface. Florian Weimer
2001-09-07I've attached the fixed version of the patch below. After theBruce Momjian
discussion on pgsql-hackers (especially the frightening memory dump in <12273.999562219@sss.pgh.pa.us>), we decided that it is best not to use identifiers from an untrusted source at all. Therefore, all claims of the suitability of PQescapeString() for identifiers have been removed. Florian Weimer
2001-09-06Below is the patch against current cvs for libpgtcl andBruce Momjian
two additional files win32.mak and libpgtcl.def. This patch allows to compile libpgtcl.dll on Windows with tcl > 8.0. I've tested it on WinNT (VC6.0), SUSE Linux (7.0) and Solaris 2.6 with tcl 8.3.3. Mikhail Terekhov
2001-08-21> Ok, where's a "system dependent hack" :)Bruce Momjian
> It seems that win9x doesn't have the "netmsg.dll" so it defaults to "normal" > FormatMessage. > I wonder if one could load wsock32.dll or winsock.dll on those systems > instead of netmsg.dll. > > Mikhail, could you please test this code on your nt4 system? > Could someone else test this code on a win98/95 system? > > It works on win2k over here. It works on win2k here too but not on win98/95 or winNT. Anyway, attached is the patch which uses Magnus's my_sock_strerror function (renamed to winsock_strerror). The only difference is that I put the code to load and unload netmsg.dll in the libpqdll.c (is this OK Magnus?). Mikhail Terekhov
2001-08-17Remove some unneeded dashes from libpq comments.Bruce Momjian
2001-08-15Use MD5 for wire protocol encryption for >= 7.2 client/server.Bruce Momjian
Allow pg_shadow to be MD5 encrypted. Add ENCRYPTED/UNENCRYPTED option to CREATE/ALTER user. Add password_encryption postgresql.conf option. Update wire protocol version to 2.1.
2001-08-03Fix residual breakage from Windows socket-errno patch: the routinesTom Lane
that should use regular errno, not WSAGetLastError(), now do so again.
2001-07-20i've spotted a following problem using DBD::Pg under win32. winsockBruce Momjian
functions do not set errno, so some normal conditions are treated as fatal errors. e.g. fetching large tuples fails, as at some point recv() returns EWOULDBLOCK. here's a patch, which replaces errno with WSAGetLastError(). i've tried to to affect non-win32 code. Dmitry Yurtaev
2001-07-15NLS for libpq. Clean up the message formats and change the documentationPeter Eisentraut
accordingly.
2001-07-06Repair libpq to follow protocol by not sending Terminate messages beforePeter Eisentraut
the startup exchange is complete. Also make sure that packets defined as single bytes aren't sent with a trailing '\0'.
2001-02-10Restructure the key include files per recent pghackers discussion: thereTom Lane
are now separate files "postgres.h" and "postgres_fe.h", which are meant to be the primary include files for backend .c files and frontend .c files respectively. By default, only include files meant for frontend use are installed into the installation include directory. There is a new make target 'make install-all-headers' that adds the whole content of the src/include tree to the installed fileset, for use by people who want to develop server-side code without keeping the complete source tree on hand. Cleaned up a whole lot of crufty and inconsistent header inclusions.
2001-02-06Now that I look at it, PQoidValue() ain't quite right either.Tom Lane
2001-02-06Repair PQoidStatus() bug reported by darcy@druid.net.Tom Lane
2001-01-24Change Copyright from PostgreSQL, Inc to PostgreSQL Global Development Group.Bruce Momjian
2000-12-03Ensure that all uses of <ctype.h> functions are applied to unsigned-charTom Lane
values, whether the local char type is signed or not. This is necessary for portability. Per discussion on pghackers around 9/16/00.
2000-06-14Big warnings cleanup for Solaris/GCC. Down to about 40 now, butPeter Eisentraut
we'll get there one day. Use `cat' to create aclocal.m4, not `aclocal'. Some people don't have automake installed. Only run the autoconf rule in the top-level GNUmakefile if the invoker specified `make configure', don't run it automatically because of CVS timestamp skew.
2000-05-25! * Users doing non-blocking connections need to handle the resetBruce Momjian
! * themselves, they'll need to check the connection status if we ! * return an error. Alfred Perlstein
2000-04-12Ye-old pgindent run. Same 4-space tabs.Bruce Momjian
2000-03-14Repair unintentional damage to MULTIBYTE code.Tom Lane
2000-03-11Change PQconndefaults() to return a malloc'd array, instead of a staticTom Lane
array. This allows processing of conninfo strings to be made thread-safe, at the cost of a small memory leak in applications that use PQconndefaults() and are not updated to free the returned array via the new PQconninfoFree() function. But PQconndefaults() is probably not used very much, so this seems like a good compromise.
2000-02-24Tweak libpq so that if a backend ERROR message arrives while libpqTom Lane
thinks the connection is idle, the error message is displayed as if it were a NOTICE. This seems better than dropping the message on the floor ... particularly if the message is the backend telling us why it's about to close the connection. The previous behavior was Backend message type 0x45 arrived while idle pqReadData() -- backend closed the channel unexpectedly. which is not real helpful.
2000-02-07Fixed psql double quoting of SQL idsPeter Eisentraut
Fixed libpq printing functions
2000-01-26Add:Bruce Momjian
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc to all files copyright Regents of Berkeley. Man, that's a lot of files.
2000-01-24Remove Ops parameter from STATRELID cache lookup, for Tom Lane andBruce Momjian
optimizer.
2000-01-18Libpq non-blocking mode, from Alfred PerlsteinBruce Momjian
1999-11-11In the spirit of TODO itemBruce Momjian
* Add use of 'const' for varibles in source tree (which is misspelled, btw.) I went through the front-end libpq code and did so. This affects in particular the various accessor functions (such as PQdb() and PQgetvalue()) as well as, by necessity, the internal helpers they use. I have been really thorough in that regard, perhaps some people will find it annoying that things like char * foo = PQgetvalue(res, 0, 0) will generate a warning. On the other hand it _should_ generate one. This is no real compatibility break, although a few clients will have to be fixed to suppress warnings. (Which again would be in the spirit of the above TODO.) In addition I replaced some int's by size_t's and removed some warnings (and generated some new ones -- grmpf!). Also I rewrote PQoidStatus (so it actually honors the const!) and supplied a new function PQoidValue that returns a proper Oid type. This is only front-end stuff, none of the communicaton stuff was touched. The psql patch also adds some new consts to honor the new libpq situation, as well as fixes a fatal condition that resulted when using the -V (--version) option and there is no database listening. So, to summarize, the psql you should definitely put in (with or without the libpq). If you think I went too far with the const-mania in libpq, let me know and I'll make adjustments. If you approve it, I will also update the docs. -Peter -- Peter Eisentraut Sernanders vaeg 10:115
1999-08-31Update frontend libpq to remove limits on query lengths,Tom Lane
error/notice message lengths, and number of fields per tuple. Add pqexpbuffer.c/.h, a frontend version of backend's stringinfo module. This is first step in applying Mike Ansley's long-query patches, even though he didn't do any of these particular changes...
1999-07-19Enable WIN32 compilation of libpq.Bruce Momjian
1999-07-19Re-add getopt.h check, remove NT-specific tests for it.Bruce Momjian
1999-07-17 Move some system includes into c.h, and remove duplicates.Bruce Momjian
1999-05-28When closure of the backend connection is detected during pqFlush,Tom Lane
do the right thing: look for a NOTICE message from the backend before we close our side of the socket. 6.4 libpq did not reliably print the backend's hara-kiri message, 'The Postmaster has informed me ...', because it only did the right thing if connection closure was detected during a read attempt instead of a write attempt.
1999-05-25pgindent run over code.Bruce Momjian
1999-05-12Fix bogus assumption that MAXALIGN is at least sizeof(pointer).Tom Lane
1999-04-04Use MAXALIGN value found by configure instead of aTom Lane
hardwired assumption.
1999-03-14Reversed out libpq protocol patch for Tom Lane.Bruce Momjian
1999-03-14This is another example of why not allowing utility functions in SPIBruce Momjian
would be a Bad Thing. For what it's worth, I found another case in libpq where you can get a T message without a D that my utility patch needs to handle. I have attached the updated patch against the 6.4.2 version of src/interfaces/libpq/fe-exec.c Jerry Gay
1999-03-14Hi,Bruce Momjian
Just in case you'd like to see what I was talking about, I am attaching my patch to src/interfaces/libpq/fe-exec.c to prevent utility functions called from SPI from locking up the client. Jerry Gay
1999-02-13Change my-function-name-- to my_function_name, and optimizer renames.Bruce Momjian
1999-02-07Add PQresStatus() function to avoid direct access to pgresStatus[] array,Tom Lane
making life easier for Windoids...
1999-02-03The libpq function PQfnumber does not handle case-insensitiveBruce Momjian
comparisons correctly. The psql monitor converts all table and field names to lower case. If the PQfnumber function is called with a mixed case name, it will always return -1. Bahman Rafatjoo
1998-11-29Portability fix for old SunOS releases: realloc(NULL, ...)Tom Lane
doesn't work there.
1998-11-18Performance improvement for libpq: avoid calling malloc separatelyTom Lane
for each field of each tuple. Makes more difference than you'd think...
1998-10-01Update libpq to store an error message in PGresult, per pgsq-interfaces ↵Tom Lane
discussion of 21-Sep.