Thu Jul 21 04:30:59 PDT 2005
- Previous message: [Slony1-general] Bug in slon_watchdog.pl calling slonik_restart_node
- Next message: [Slony1-general] Master and Slave Data is not consistent
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello !
ALL!
at database test existing table schema :
create table T_MATCH_FIELD_INFO (
FIELD_ID INT4 not null,
PERSON_QTY INT4 not null,
constraint PK_T_MATCH_FIELD_INFO primary key (FIELD_ID)
);
want modify table schema change into :
create table T_MATCH_FIELD_INFO (
FIELD_ID INT4 not null,
PERSON_QTY INT4 not null,
f4 VARCHAR(8) not null ,
f8 smallint null default 0 ,
f9 VARCHAR(8) null default 'abc' ,
f11 TIMESTAMP null default 'NOW()' ,
constraint PK_T_MATCH_FIELD_INFO primary key (FIELD_ID)
);
so do :
vi alterTable.sql
ALTER TABLE t_match_field_info ADD COLUMN f4 VARCHAR(8) ;
ALTER TABLE t_match_field_info ALTER COLUMN f4 SET NOT NULL ;
ALTER TABLE t_match_field_info ADD COLUMN f8 smallint ;
ALTER TABLE t_match_field_info ALTER COLUMN f8 SET DEFAULT '0' ;
ALTER TABLE t_match_field_info ADD COLUMN f9 VARCHAR(8) ;
ALTER TABLE t_match_field_info ALTER COLUMN f9 SET DEFAULT 'abc' ;
ALTER TABLE t_match_field_info ADD COLUMN f11 TIMESTAMP ;
ALTER TABLE t_match_field_info ALTER COLUMN f11 SET DEFAULT 'NOW()'
vi exec.sh
#!/bin/sh
CLUSTERNAME=test1
MASTERDBNAME=test
MASTERPORT=8432
SLAVEDBNAME=test
SLAVEPORT=8432
MASTERHOST=10.10.10.67
SLAVEHOST=10.10.10.36
REPLICATIONUSER=master
PGBENCHUSER=master
export CLUSTERNAME MASTERDBNAME MASTERPORT SLAVEDBNAME SLAVEPORT MASTERHOST SLAVEHOST REPLICATIONUSER PGBENCHUSER
slonik <<_EOF_
cluster name = $CLUSTERNAME;
node 1 admin conninfo = 'dbname=$MASTERDBNAME host=$MASTERHOST user=$REPLICATIONUSER';
node 2 admin conninfo = 'dbname=$SLAVEDBNAME host=$SLAVEHOST user=$PGBENCHUSER';
EXECUTE SCRIPT (SET ID = 1 , FILENAME = '/u2/master/slonyI/test/alterTable.sql' , EVENT NODE = 1 );
_EOF_
exec successful . watch alter result:
test=# \d t_match_field_info
Table "public.t_match_field_info"
Column | Type | Modifiers
------------+-----------------------------+-----------
field_id | integer | not null
person_qty | integer | not null
f4 | character varying(8) | not null
f8 | smallint |
f9 | character varying(8) |
f11 | timestamp without time zone |
Indexes:
"pk_t_match_field_info" primary key, btree (field_id)
Why set default not become effective ? I try once more noce but still fail.
If anyone know , Please give me some tip! Thanks very much !
__________________________________________________
???????????????
http://cn.mail.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gborg.postgresql.org/pipermail/slony1-general/attachments/20050721/1c779296/attachment-0001.html
- Previous message: [Slony1-general] Bug in slon_watchdog.pl calling slonik_restart_node
- Next message: [Slony1-general] Master and Slave Data is not consistent
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-general mailing list