[odb-users] ODB 2.1 on PostgreSQL

Simon Riggs simon at 2ndQuadrant.com
Thu Sep 20 16:46:49 EDT 2012


On 20 September 2012 12:50, Boris Kolpackov <boris at codesynthesis.com> wrote:

>> 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?

Yes, just libpq

> I.e., will this work if I connect using
> 9.2 libpq to 8.4 server?

Yes

> 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()?

Feedback on it is interesting. View is there is some overhead, but its
OK for general use.

>> 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...

OK

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

How important is that? The patch for that is simple, but the
management of the change would require us to have a config parameter
to provide backwards compatibility. So it wouldn't be an easy sell....

-- 
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services



More information about the odb-users mailing list