script and code for postgres-xc