Switch PGError to interface and implement SimplePGError
Add recover function that will report the PG reason.

Update Open() to use this so connection errors can be seen.
may be too harsh
Merge remote-tracking branch 'traviscline/expose_pg_errors' into tmp
Add result parsing benchmark

To see what's slow, try this:

        go test -c

        # Run for 5s
        go test -test.bench='BenchmarkResultParsing' \
           -test.cpuprofile=cpu.prof -test.benchtime 5

        pprof pq.test cpu.prof

In the pprof (sometimes called google-pprof) prompt:

        (pprof) web

Signed-off-by: Dan Farina <drfarina@acm.org>
reduce network reads/writes with bufio
fix #46 - ignore all notices
Ignore ParameterStatus responses to simpleQuery.

This allows running, e.g., "SET TIME ZONE 'US/Eastern'".
Change timeFormat to send full precision/TZ info.
Add more expansive timezone test.

Also includes a fix for the "30 minute offset" timezones referenced in
issue #51.
Add failing test for error checking on 64 bits int

Currently some error checking in buf.go is done by converting an uint32 to
int. For 32 bit int this works correctly, however when int is 64 bits,
0xffffffff != -1 and this error checking fails, leading to a slice out of
bounds panic.

Some editorialization has been done to use a VALUES literal as opposed
to temp table/inserts in the test.

Signed-off-by: Daniel Farina <daniel@fdr.io>
Add overdue credits for those assisting in recent maintenance

Signed-off-by: Daniel Farina <daniel@heroku.com>
Add clear-text authentication.
Credit Martin Olsen

Signed-off-by: Daniel Farina <daniel@heroku.com>
Confirm that Postgres does not allow bad cstrings for param values

Looks like it is checked in postgres.c:exec_bind_message if the format
of parameters is textual...which seems like all of them right now.

It also looks like for binary mode that Postgres may protect against
this, by ensuring that a type receive function eats the entire
parameter value buffer.  A poorly written Postgres recv (binary
decoding) function could open the user to nul byte injections, but I'm
not sure if there's much to be done about that.

Signed-off-by: Daniel Farina <daniel@heroku.com>
Add parameter type sensitivity to type encoding

This requires recording the response to parsing to know what types are
expected for parameters, and then passing that information to the type
encoder.

Signed-off-by: Daniel Farina <daniel@heroku.com>
Credit Kamil Kisiel

Signed-off-by: Daniel Farina <daniel@heroku.com>
Support timestamp without tz

This just lets Go's time package do what it is going to by default
when one is left without offset information.  Hope it's a behavior
people want.

The main change here is pushing down the column type into the parsing
function, as Go's time parsing can't deal with data that only has the
fractional-hour timezone offset when such a fraction exists
(e.g. "-07" for "-07:00", but "-7:30" necessarily retaining its
precision).  This old hack could not be applied unconditionally (it is
wrong when the timestamp has no time zone offset suffix), so this
information lets a correct decision be made.

Clearly, this approach also can't handle the Postgres datestyle
parameter, but that's a fight to pick some other time.

Signed-off-by: Daniel Farina <daniel@fdr.io>
Revert "Support timestamp without tz"

Seems to work on some older or younger go devel, but not on a release
version, it seems.

This reverts commit 7f1933fdbdec31350abc6a616463eb85653fee31.
Support timestamp without tz, redux

This time, some more effort has been paid to testing on an older Go
version, 1.0.2, and carefully preserving the old hacks to make time
parsing work with those older versions with a less useful time.Parse.
It has also been tested on Go 1.0.3.

This just lets the Go time package use its default behavior when one
is left without time offset information.  Hope it is a behavior people
want.

The main change here is pushing down the column type into the parsing
function, as Go's time parsing can't deal with data that only has the
fractional-hour timezone offset when such a fraction exists
(e.g. "-07" for "-07:00", but "-7:30" necessarily retaining its
precision).  This old hack could not be applied unconditionally (it is
wrong when the timestamp has no time zone offset suffix), so this
information lets a correct decision be made.

Clearly, this approach also can't handle the Postgres datestyle
parameter, but that's a fight to pick some other time.

As a target of opportunity, move the 'oid' type to 'types.go', since
for now all oids I know of handled by the program are type oids.  This
causes 'go fmt' to go a little nuts and rewrite the long but boring
file.

Signed-off-by: Daniel Farina <daniel@fdr.io>