[rtg] PostgreSQL with current CVS

Chris Caputo ccaputo at alt.net
Tue Aug 5 06:21:37 EDT 2008


Please consider the following patch against the current CVS tree:

  http://www.caputo.com/foss/rtg/rtg.postgresql_fixes.20080805.diff

  (apply with "patch -p0" in rtg directory)

Changes:

  src/librtgpgsql.c: Adds support for __db_commit(), __db_intSpeed() and 
  __db_populate().

  src/rtgplot.c: Re-enables PostgreSQL compatibility.

  targetmaker/etc/targetmaker: Adds support for PostgreSQL.

Before running targetmaker, create your rtg database and add the following 
to it:

--
  CREATE TABLE router (
    rid SERIAL NOT NULL,
    name char(120) NOT NULL default '',
    pop char(10) NOT NULL default '',
    popid smallint NOT NULL default '0'
  );
  CREATE INDEX router_idx ON router (rid);

  CREATE TABLE interface (
    id SERIAL NOT NULL,
    name char(255) NOT NULL default '',
    rid int NOT NULL default '0',
    speed bigint default NULL,
    description char(255) default NULL,
    status boolean default true
  );
  CREATE INDEX interface_idx ON interface (id);
--

Be sure to change DB_TYPE in targetmaker.cfg as follows:

  $DB_TYPE = "Postgres";

And adjust rtg.conf as follows:

  DB_Driver   librtgpgsql.so
  Threads 1

(I only tested single-threaded mode.)

Also, I've adapted a version of 95.pl for PostreSQL at:

  http://www.caputo.com/foss/rtg/rtg95pg.20080805

All of the above was tested with version 8.2 of PostgreSQL.

Feedback welcome!

Thanks,
Chris


More information about the RTG mailing list