Commit Graph

3382 Commits

Author SHA1 Message Date
Magnus Hagander 9f2e211386 Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
Tom Lane 9eef3318a2 Fix several broken $PostgreSQL$ keywords. Noted while experimenting
with Magnus's script to remove these.
2010-09-19 16:17:45 +00:00
Michael Meskes 81624db39a Cursor names in the backend are not case-sensitve. This change makes sure that
ecpg also does not regard cursor names as case-sensitive.

Thanks to Zoltan Boszormenyi for the patch.
2010-09-10 10:13:20 +00:00
Peter Eisentraut 3f11971916 Remove extra newlines at end and beginning of files, add missing newlines
at end of files.
2010-08-19 05:57:36 +00:00
Michael Meskes 9a8d15bd41 Applied Zoltan's patch to fix a few memleaks in ecpg's pgtypeslib. 2010-08-17 09:36:05 +00:00
Tom Lane 3f9479ef3f Minor #include cleanup.
I just noticed that libpq's pqsignal.h was violating our general inclusion
style guidelines by explicitly including postgres_fe.h.  Remove that, and
put it in pqsignal.c where it belongs.
2010-08-13 20:04:33 +00:00
Tom Lane fbcf2cfb53 Fix an ancient typo that prevented the detection of conflicting fields when
interval input "invalid" was specified together with other fields.  Spotted
by Neil Conway with the help of a clang warning.  Although this has been
wrong since the interval code was written more than 10 years ago, it doesn't
affect anything beyond which error message you get for a wrong input, so not
worth back-patching very far.
2010-08-02 01:24:54 +00:00
Robert Haas b25749cc64 Make ECPG regression tests independent of standard_conforming_strings.
Per buildfarm, again.
2010-07-20 01:57:19 +00:00
Peter Eisentraut 0b4a0868f9 Portability fixes for Solaris for requirepeer feature patch
per report from Dave Page
2010-07-19 18:53:25 +00:00
Tom Lane 1b51018afc Fix up poor handling of unsupported-platform case in requirepeer patch. 2010-07-18 17:08:11 +00:00
Tom Lane 25241aee60 Fix thinko in recent patch: 'sock' should be 'conn->sock'. 2010-07-18 16:42:20 +00:00
Bruce Momjian 9c5ea833a0 Add SO_PEERCRED check in new unix domain socket permission checking code. 2010-07-18 15:51:00 +00:00
Peter Eisentraut 040aee295e Add server authentication over Unix-domain sockets
This adds a libpq connection parameter requirepeer that specifies the user
name that the server process is expected to run under.

reviewed by KaiGai Kohei
2010-07-18 11:37:26 +00:00
Tom Lane d494e685c5 Allow full SSL certificate verification (wherein libpq checks its host name
parameter against server cert's CN field) to succeed in the case where
both host and hostaddr are specified.  As with the existing precedents
for Kerberos, GSSAPI, SSPI, it is the calling application's responsibility
that host and hostaddr match up --- we just use the host name as given.
Per bug #5559 from Christopher Head.

In passing, make the error handling and messages for the no-host-name-given
failure more consistent among these four cases, and correct a lie in the
documentation: we don't attempt to reverse-lookup host from hostaddr
if host is missing.

Back-patch to 8.4 where SSL cert verification was introduced.
2010-07-14 17:09:45 +00:00
Bruce Momjian b1261bd562 Bump minor library version numbers, for 9.1 release. 2010-07-12 16:18:44 +00:00
Tom Lane b40466c337 Stamp HEAD as 9.1devel.
(And there was much rejoicing.)
2010-07-09 04:10:58 +00:00
Peter Eisentraut 0544c8cd57 Translation updates for 9.0beta3 2010-07-08 21:32:28 +00:00
Magnus Hagander a64bf0afb7 Make the Windows tcp keepalive support depend on the existance of the
SIO_KEEPALIVE_VALS define instead of just WIN32, since MingW doesn't
support this API (yet?).
2010-07-08 16:19:50 +00:00
Magnus Hagander 44b0d1671a Add support for TCP keepalives on Windows, both for backend and the new
libpq support.
2010-07-08 10:20:14 +00:00
Robert Haas 5acd417c8f Support setting the keepalive idle time on MacOS X.
MacOS X uses TCP_KEEPALIVE rather than TCP_KEEPIDLE for this purpose.

Thanks to Fujii Masao for the review.
2010-07-06 21:14:25 +00:00
Bruce Momjian 239d769e7e pgindent run for 9.0, second run 2010-07-06 19:19:02 +00:00
Tom Lane 291a957745 Split the LDFLAGS make variable into two parts: LDFLAGS is now used for
linking both executables and shared libraries, and we add on LDFLAGS_EX when
linking executables or LDFLAGS_SL when linking shared libraries.  This
provides a significantly cleaner way of dealing with link-time switches than
the former behavior.  Also, make sure that the various platform-specific
%.so: %.o rules incorporate LDFLAGS and LDFLAGS_SL; most of them missed that
before.  (I did not add these variables for the platforms that invoke $(LD)
directly, however.  It's not clear if we can do that safely, since for the
most part we assume these variables use CC command-line syntax.)

Per gripe from Aaron Swenson and subsequent investigation.
2010-07-05 18:54:38 +00:00
Robert Haas d8cd283a08 Add TCP keepalive support to libpq.
This adds four additional connection parameters to libpq: keepalives,
keepalives_idle, keepalives_count, and keepalives_interval.
keepalives default to on, per discussion, but can be turned off by
specifying keepalives=0.  The remaining parameters, where supported,
can be used to adjust how often keepalives are sent and how many
can be lost before the connection is broken.

The immediate motivation for this patch is to make sure that
walreceiver will eventually notice if the master reboots without
closing the connection cleanly, but it should be helpful in other
cases as well.

Tollef Fog Heen, Fujii Masao, and me.
2010-06-23 21:54:13 +00:00
Peter Eisentraut 418e1d82fd Refactor sprintf calls with computed format strings into multiple calls with
constant format strings, so that the compiler can more easily check the
formats for correctness.
2010-06-16 00:54:16 +00:00
Michael Meskes 98e4005efb Added variable handling for RETURNING clause to ecpg.
While the values were correctly returned they were not moved into C variables
as they should be.

Closes: #5489
2010-06-04 10:09:58 +00:00
Peter Eisentraut 1eca1b7a68 Translation updates for 9.0beta2 2010-06-03 21:12:05 +00:00
Tom Lane b12b7a9038 Change the notation for calling functions with named parameters from
"val AS name" to "name := val", as per recent discussion.

This patch catches everything in the original named-parameters patch,
but I'm not certain that no other dependencies snuck in later (grepping
the source tree for all uses of AS soon proved unworkable).

In passing I note that we've dropped the ball at least once on keeping
ecpg's lexer (as opposed to parser) in sync with the backend.  It would
be a good idea to go through all of pgc.l and see if it's in sync now.
I didn't attempt that at the moment.
2010-05-30 18:10:41 +00:00
Tom Lane 4ed4b6c54e Rearrange libpq's SSL initialization to simplify it and make it handle some
additional cases correctly.  The original coding failed to load additional
(chain) certificates from the client cert file, meaning that indirectly signed
client certificates didn't work unless one hacked the server's root.crt file
to include intermediate CAs (not the desired approach).  Another problem was
that everything got loaded into the shared SSL_context object, which meant
that concurrent connections trying to use different sslcert settings could
well fail due to conflicting over the single available slot for a keyed
certificate.

To fix, get rid of the use of SSL_CTX_set_client_cert_cb(), which is
deprecated anyway in the OpenSSL documentation, and instead just
unconditionally load the client cert and private key during connection
initialization.  This lets us use SSL_CTX_use_certificate_chain_file(),
which does the right thing with additional certs, and is lots simpler than
the previous hacking about with BIO-level access.  A small disadvantage is
that we have to load the primary client cert a second time with
SSL_use_certificate_file, so that that one ends up in the correct slot
within the connection's SSL object where it can get paired with the key.
Given the other overhead of making an SSL connection, that doesn't seem
worth worrying about.

Per discussion ensuing from bug #5468.
2010-05-26 21:39:27 +00:00
Tom Lane 20d629320b Add missing newlines to some SSL-related error messages. Noted while testing. 2010-05-25 22:03:27 +00:00
Michael Meskes 29259531c7 Replace self written 'long long int' configure test by standard 'AC_TYPE_LONG_LONG_INT' macro call. 2010-05-25 17:28:20 +00:00
Michael Meskes 555a02f910 Added a configure test for "long long" datatypes. So far this is only used in ecpg and replaces the old test that was kind of hackish. 2010-05-25 14:32:55 +00:00
Michael Meskes 15ab0e9a60 Ecpg now accepts "long long" datatypes even if "long" is 64bit wide. This used to cover the equally long "long long" type. This patch closes bug #5464. 2010-05-20 22:10:46 +00:00
Peter Eisentraut f1ac08daee Translation update 2010-05-13 15:56:43 +00:00
Bruce Momjian 395d1259ad Add PGFILEDESC description to Makefiles for all /contrib executables.
Add PGAPPICON to all executable makefiles.
2010-05-12 11:33:10 +00:00
Tom Lane ed437e2b27 Adjust comments about avoiding use of printf's %.*s.
My initial impression that glibc was measuring the precision in characters
(which is what the Linux man page says it does) was incorrect.  It does take
the precision to be in bytes, but it also tries to truncate the string at a
character boundary.  The bottom line remains the same: it will mess up
if the string is not in the encoding it expects, so we need to avoid %.*s
anytime there's a significant risk of that.  Previous code changes are still
good, but adjust the comments to reflect this knowledge.  Per research by
Hernan Gonzalez.
2010-05-09 02:16:00 +00:00
Tom Lane 54cd4f0457 Work around a subtle portability problem in use of printf %s format.
Depending on which spec you read, field widths and precisions in %s may be
counted either in bytes or characters.  Our code was assuming bytes, which
is wrong at least for glibc's implementation, and in any case libc might
have a different idea of the prevailing encoding than we do.  Hence, for
portable results we must avoid using anything more complex than just "%s"
unless the string to be printed is known to be all-ASCII.

This patch fixes the cases I could find, including the psql formatting
failure reported by Hernan Gonzalez.  In HEAD only, I also added comments
to some places where it appears safe to continue using "%.*s".
2010-05-08 16:39:53 +00:00
Michael Meskes 71a185a24d ECPG connect routine only checked for NULL to find empty parameters, but user and password can also be "". 2010-05-07 19:35:03 +00:00
Tom Lane 0954358047 Fix a couple of places where the result of fgets() wasn't checked.
This is mostly to suppress compiler warnings, although in principle
the cases could result in undesirable behavior.

Martin Pitt
2010-04-30 17:09:13 +00:00
Magnus Hagander 81fb51732e Fix typo that had the code check the same thing twice.
Fujii Masao
2010-04-28 13:46:23 +00:00
Michael Meskes 5f5ba92334 Make ecpg in line with other compilers in that it deletes its output if there was an error processing the input file.
Work done by Zoltan.
2010-04-03 19:30:49 +00:00
Peter Eisentraut a404a12fb4 Message quoting style tuning 2010-04-03 07:53:29 +00:00
Michael Meskes 001b1ad6a3 FATAL errors are meant to stop ecpg immediately, e.g. because the syntax is
corrupted. This error, however, does is not a compilation problem but a runtime
one, so we can keep compiling but still have to declare ERROR.
2010-04-02 10:27:45 +00:00
Michael Meskes 1fbb06d204 Zoltan beautified his hidden-variable-patch for ecpg. This also makes sure we get an error message instead of a warning if the variable have different types. 2010-04-01 10:30:53 +00:00
Michael Meskes b2bddc2ff2 Applied Zoltan's patch to make ecpg spit out warnings if a local variable hides a global one with the same name. 2010-04-01 08:41:01 +00:00
Michael Meskes e01c6ce712 Give a more precise error message if a variable is re-used as cursor name in ecpg. 2010-03-31 08:45:18 +00:00
Peter Eisentraut 8a367d441b Remove useless double assignment
GCC 4.5 complained about it.
2010-03-23 22:12:06 +00:00
Michael Meskes ecac5e6bfc Fixed ECPG regression test to make sure it uses absolute paths for include
files instead of relative ones which break vpath builds.
2010-03-22 07:41:20 +00:00
Michael Meskes b4d298ac23 ECPG's parser now accepts and handles variables as arguments for the FREE command.
Informix allows variables as argument to the embedded SQL command FREE. Given
that we only allow freeing cursors via FREE for compatibility reasons only we
should do the same.
2010-03-21 11:56:45 +00:00
Michael Meskes 654fff2311 Adjusted regression test results to the change I made in debug output for ecpglib. 2010-03-21 11:38:16 +00:00
Michael Meskes a9dd217861 Correctly name functions in debug output in ecpglib. When the functions were
refactored the debug output wasn't adjusted.
2010-03-21 11:33:44 +00:00