Here is is some stuff that can help you to manage your (eventually replicated :-) databases.
Table restructure utility.
Permits to quick and easily drop and move table fields, optionally changing its data types.
Sometimes is useful drop some field from a table or change a field data type. Since not all ALTER TABLE variants are supported, you will find useful editschema utility.
Using editschema you can edit the schema of a table obtained by pg_dump, automatically importing old data into the new table.
1. Change directory to pgreplica/bin/utilities
2. Launch ./editchema <dbname> <tablename>
3. Edit your original table structure using vi (you can
use any other editor instead). Here you can:
4. Exiting from vi all your changes will be committed. If you want to skip your changes refresh the original file from disk (using :e!)
editschema need getdata.tcl script to work, so you have to copy both files if you want to use this utility elsewhere.
Sequences for distributed tables
How to store data coming from sequences in distributed / replicated tables without overlaps
Developing applications on distributed tables requires
sequences that don't overlap among sites.
Using it is simple, as you can see:
Form host id 2:
All you need is create a nextval8 function like this:
CREATE FUNCTION "nextval8" (varchar ) RETURNS
int8 AS '
Since nextval8 is written in Pl/Tcl you have
to correctly install pgreplicator prior to use it.