[dev.icinga.com #622] postgresql implementation based on libpq #313
Comments
Updated by mfriedrich on 2010-07-28 06:59:13 +00:00 the SERIAL for primary keys must be dropped as it initially creates sequences. I want to control that just like oracle does - create our own sequences. when running queries, seq_name.nextval should be used for the primary key then. using libpq and stored procedures, we should take the query like this: upsert_timedevents($value1, $value2, ...) and asprintf everything into a string, handing that over to PGExec. The way of handing over a parameter list won't match, since the datatypes differ (text, timestamp, integer). the unix timestamp conversion stuff needs to be handled directly within the queries, not before asprintf'ing the strings. |
Updated by mfriedrich on 2010-07-28 07:02:43 +00:00 http://www.mail-archive.com/pgsql-performance@postgresql.org/msg21277.html upsert examples:
ordering of the different datatypes - integer, text (timestamps will be integer) |
Updated by mfriedrich on 2010-12-13 08:25:29 +00:00
some more ideas, especially on sequence handling and stuff. |
Updated by mfriedrich on 2011-05-23 16:23:36 +00:00
i'm stopping this for now as i don't have time for that. the current implementation first tries to update, then to insert if not any rows affected. this is a rather good solution based on the fact that most of the status date gets updated a lot. the historical checks might be replaced in the order somehow by adding stored procedures or similar. but replacing libdbi-pgsql with libpq isn't sufficient currently. re-open if someone feels to implement that / provide a patch. |
Updated by mfriedrich on 2011-12-19 21:34:03 +00:00
|
Updated by mfriedrich on 2012-08-23 10:14:54 +00:00
will consider for rewrite. |
Updated by mfriedrich on 2014-12-08 14:34:37 +00:00
|
This issue has been migrated from Redmine: https://dev.icinga.com/issues/622
Created by mfriedrich on 2010-07-19 15:24:08 +00:00
Assignee: (none)
Status: Rejected (closed on 2012-08-23 10:14:54 +00:00)
Target Version: (none)
Last Update: 2014-12-08 14:34:37 +00:00 (in Redmine)
making this optional next to libdbi support will fit best into the current setup.
$ sudo yum install postgresql-devel postgresql-libs
./configure --enable-idoutils --enable-pgsql
--with-pgsql-inc=/usr/include
--with-pgsql-lib=/usr/lib
should set the compiler flags correctly, including libpq-fe.h
header file will be included in ido2db.h for further usage.
next to that:
1/ use #ifdef USE_PGSQL, same as USE_ORACLE
2/ reorganize connection functions in db.c
3/ take care of sequences fetching in dbhandler.c
4/ create stored procedures for all queries, and adapt them slightly to fit for Oracle too
5/ create dynmaic delete queries in stored procedures as they are in oracle available
http://developer.postgresql.org/pgdocs/postgres/libpq.html
some dev hints for splitting and copying.
Attachments
Changesets
2010-07-19 19:21:27 +00:00 by mfriedrich f839aeea155a687d4c5be193e03bfde744a7e83e
2010-07-20 12:10:47 +00:00 by mfriedrich dee775e15b8bc823df8da34a5b7c29dbb5cb6f59
2010-07-27 13:03:56 +00:00 by mfriedrich 4b1d162
2010-07-28 19:02:16 +00:00 by mfriedrich dfb5fb5
2010-07-30 12:28:33 +00:00 by mfriedrich 34cee48
2010-11-24 12:30:06 +00:00 by mfriedrich a1768b0
2011-01-13 14:19:19 +00:00 by mfriedrich 9ad3454
Relations:
The text was updated successfully, but these errors were encountered: