bugzilla-daemon at main.slony.info bugzilla-daemon at main.slony.info
Thu Aug 26 08:36:17 PDT 2010
http://www.slony.info/bugzilla/show_bug.cgi?id=151

--- Comment #1 from Christopher Browne <cbbrowne at ca.afilias.info> 2010-08-26 08:36:17 PDT ---
The challenge of this is that it introduces an extra layer of quoting to the
Slonik language which we have heretofore avoided.

We had to write a parser that understands PostgreSQL quoting and commenting
that is used by slon+slonik:

http://git.postgresql.org/gitweb?p=slony1-engine.git;a=blob;f=src/parsestatements/scanner.c

Your idea of adding the "meta command," file *possibly* evades that; I'm not
sure.

It would certainly be possible to take this the other way, and layer the slonik
inside a shell script, as in the example below.

-----------------------------------------------------------------
#!/bin/sh

PREAMBLEFILE=/tmp/slonik.preamble
SLONIKFILE=/tmp/myslonikfile.slonik
DDLFILE=/tmp/myddlfile.sql

cat > ${PREAMBLEFILE} <<EOP 
cluster name = myfavecluster;
node 1 admin conninfo='db=foo host=host1 port=5432';
node 2 admin conninfo='db=foo host=host2 port=5432';
node 3 admin conninfo='db=foo host=host3 port=5432';
EOP

cat > ${SLONIKFILE}  <<EOS
include <${PREAMBLEFILE}>;

execute script (set id=1, filename='${DDLFILE}', event node = 1);
EOS

cat > ${DDLFILE} <<DDL
alter table foo add column bar integer;
DDL

slonik ${SLONIKFILE}

-- 
Configure bugmail: http://www.slony.info/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Slony1-bugs mailing list