[odb-users] ODB 2.1 on PostgreSQL

Boris Kolpackov boris at codesynthesis.com
Thu Sep 20 07:50:44 EDT 2012


Hi Simon,

Simon Riggs <simon at 2ndquadrant.com> writes:

> I wanted to pass on a few comments on the PostgreSQL limitations
> section to allow some further understanding on those areas.

Thanks, I appreciate this. Please see my commens/questions below.


> PostgreSQL 9.2 now supports streaming...
> http://www.postgresql.org/docs/9.2/static/libpq-single-row-mode.html

Interesting. Do you know if this requires both 9.2 libqp and the
server or just libpq? I.e., will this work if I connect using
9.2 libpq to 8.4 server?

Also, I am wondering if, when we do need cached result, using
PQsendQueryPrepared() and then calling PQgetResult() multiple
times will be significantly slower than a single call to 
PQexecPrepared()?


> ERROR:  duplicate key value violates unique constraint "test2_pkey"
> DETAIL:  Key (id)=(1) already exists.
> ERROR:  duplicate key value violates unique constraint "test2_id2_key"
> DETAIL:  Key (id2)=(1) already exists.
> 
> The error message itself doesn't differentiate between primary keys
> and unique constraints, but the object naming convention shows that
> PKs have the "_pkey" suffix by default. Changing that isn't
> recommended, so you could probably rely on it.

Relying on a naming convention is probably a bad idea. There are,
however, column names in the error message so we can use that (we
know the name of the column which is the primary key). Things get
complicated though if we have a composite primary key...

It would have been much easier if Postgres just had a separate
error code for a primary key violation, like MySQL ;-).

Boris



More information about the odb-users mailing list