OK, here comes a patch, DBD::Pg (and possibly other 3rd party clients)
can connect to unix sockets.
Patch is against current source tree.
Background:
libpq set some policy for client, which it should not
IMHO. It prevent some 3rd party clients to connect with
unix domain sockets etc.
Rename PG_DATESTYLE to PGDATESTYLE environment variable.
Move environment variable code to a different place so it now works!
Note that regression tests can now run with "setenv PGTZ PST8PDT"
at the frontend rather than requiring the backend to have TZ set.
Subject: [PATCHES] More psql and libpq patches
Well..these would be the last patches until the release (I hope)...
I ran the regression tests while watching psql under purify, and it did
not leak even one byte.
In this patch:
* Plugged a major leak when PSQL reads files for input (either through
\i options or through -f option)
* Fixed the one remaining leak in PSQL in not clearing PGresult *results
everywhere it is supposed to. (Thanks Tymm)
* Fixed A small leak in PSQL not clearing all the PGsettings correctly.
* A not-so-obvious (but small) leak in Libpq when PQsetdb fails for any
reason.
* Added \n to some Libpq error messages to make them easier to digest..
* Finally, added /* PURIFY */ comment to some of the code indicating
the reason for why it was added/changed...for future developers.
Subject: [PATCHES] memory leak patches in libpq and psql
A couple of small memory leak patches (detected with Purify) primarily
in libpq.
* Fixed (NULL) border problem in psql (run psql, do \m, then select
something from a table...row separators will be nulls)
* Fixed memory leak with the abovementioned border not being freed
properly.
* Fixed memory leak in freePGconn() not freeing conn->port
* Fixed up PQclear() to free parts of PGresult only if these
parts are not null.
* Fixed a decent memory leak that occured after executing every command
in psql. PGresult *results was not freed most of the time.
There is still a leak being detected (2 bytes) in readline functions, but
I think this is old readline library. I will install new one and test it.
Subject: [PATCHES] libpq patch
Hi,
here is a small patch which fixes two problems:
1. libpq/libpq-fe.h:
somehow disappeared the line
#define DefaultOption ""
now compilation stops with an error complainig an
unknown DefaultOption (970508).
2. Same patch as I sent already twice, but it never made it
into the source tree: there is no default value for
AuthType and Password. This way any libpq-application
(i.e. perl-scripts) which use the function PQconnectdb
will break with PostgreSQL-6.1. The patch simply uses
an empty string as default value.
Subject: [PATCHES] libpq SET var TO patch
One last, I hope. This one corrects a bogus format string, and
actually sends the contents of PG_DATESTYLE to the backend. That
means, you can do a setenv PG_DATESTYLE 'iso', and your libpq
will pick that up and tell the backend.
Subject: [PATCHES] 970417: some large object patches
Two patches here, made against 970417. Both have to do with large
objects:
1. lobjfuncs was not initialized in PQconnectdb. This causes
failure later if large objects are used. (Someone already
caught this error in PQsetdb.)
2. Postgres functions lo_import and lo_export sometimes
produce garbage for the file names because the filename
strings aren't always terminated by \0. (VARDATA isn't
necessarily null terminated.)
The first fixes a warning from gcc about the assignment within the condition.
The extra set of parens should not make a difference, but with -Werror, they
are necessary.
The second fixes an "ln -s" invocation that assumes the current directory is
implicitly the target if not specified. Not true in all cases, and again, it
should not make a difference except to those implementation that it does.
From: "Michael P. Snyder" <msnyder@hawkeye.huntersmoon.com>
nicer. Also, I grabbed my copy of the Informix manual, and
added a couple of variables that make sense (formats for
money, time, a language setting, a timezone).
- New functions SetPGVariable() and GetPGVariable() in tcop/*.
These don't actually do anything for the moment, but should
be enough to implement the SET var_name TO var_val in the
parser?
SetPGVariable() expects just two strings, the var_name and
the var_value from above, and is expected to do the right thing.
Returns TRUE if everything okay.
From: "Martin J. Laubach" <mjl@wwx.vip.at>
of common routines in pqcomprim.c (pq communication primitives).
Not all adapted to it yet, but it's a start.
- Rewritten some of those routines, to write/read bigger chunks of
data, precomputing stuff in buffers instead of sending out byte
by byte.
- As a consequence, I need to know the endianness of the machine.
Currently I rely on getting it from machine/endian.h, but this
may not be available everywhere? (Who the hell thought it was
a good idea to pass integers to the backend the other way around
than the normal network byte order? *argl*)
- Libpq looks in the environment for magic variables, and upon
establishing a connection to the backend, sends it queries
of the form "SET var_name TO 'var_value'". This needs a change
in the backend parser (Mr. Parser, are you there? :)
- Currently it looks for two Env-Vars, namely PG_DATEFORMAT
and PG_FLOATFORMAT. What else makes sense? PG_TIMEFORMAT?
PG_TIMEZONE?
From: "Martin J. Laubach" <mjl@wwx.vip.at>
Subject: [HACKERS] password authentication
This patch adds support for plaintext password authentication. To use
it, you add a line like
host all 0.0.0.0 0.0.0.0 password pg_pwd.conf
to your pg_hba.conf, where 'pg_pwd.conf' is the name of a file containing
the usernames and password hashes in the format of the first two fields
of a Unix /etc/passwd file. (Of course, you can use a specific database
name or IP instead.)
Then, to connect with a password through libpq, you use the PQconnectdb()
function, specifying the "password=" tag in the connect string and also
adding the tag "authtype=password".
I also added a command-line switch '-u' to psql that tells it to prompt
for a username and password and use password authentication.
In particular, no more compiled-in default for PGDATA or LIBDIR. Commands
that need them need either invocation options or environment variables.
PGPORT default is hardcoded as 5432, but overrideable with options or
environment variables.
following is the patch to libpq's large object interface that
removes the requirement to include fmgr.h into fe-lobj.c.
The large object interface now ask's the backend to tell the
OID's of all the required functions in pg_proc.
From: wieck@sapserv.debis.de (Jan Wieck)
When you connect to a database with PQsetdb, as with psql, depending on
how your uninitialized variables are set, you can get a failure with a
"There is no connection to the backend" message.
The fix is to move a call to PQexec() from inside connectDB() to
PQsetdb() after connectDB() returns to PQsetdb(). That way a connection
doesn't have to be already established in order to establish it!
From: bryanh@giraffe.netgate.net (Bryan Henderson)
Here are a few minor fixes to Postgres95. Mostly I have added const
to some of the char pointers. There was also a missing header file
and a place where it looks like "==" was used when "=" was meant.
I also changed some variables from Pfin and Pfout tp pfin and pfout
because the latter shadow global variables and that just seems like
an unsafe practice which I like to avoid.
Submitted by: "D'Arcy J.M. Cain" <darcy@druid.druid.com>
Most of the changes in here look to b epurely cosmetic, and don't
affect anything...
...and some stuff is completely questionable...in that I may have reversed
some of the stuf fwe already had :(