sarlav kumar sarlavk
Wed Jan 5 19:33:38 PST 2005
Hi,
 
I tried using execute script to add a column to a table. But it doesn't work.
I read in articles that it is possible to execute a set of alter table commands using execute script.
 
Here is what I tried: (I am pasting only the relevant stuff)
 
        #--
        execute script ( SET ID = 1, FILENAME = 'DDL.sql', EVENT NODE = 1);
        echo 'DDL executed';
        #--

DDL.sql file contains:
alter table newt ADD column newcol int;
 
I also have other files DDL1.sql, DDL2.sql which contain the following respectively
alter table newt alter column newcol set default 0;
 
update newt SET newcol = 0 where newcol is null;
 
When I execute DDL.sql, I get the following error:
<stdin>:16: PGRES_FATAL_ERROR select "_test".ddlScript(1, 'alter table newt ADD column newcol int;
');  - ERROR:  column "newcol" of relation "newt" already exists
CONTEXT:  PL/pgSQL function "ddlscript_int" line 45 at execute statement
PL/pgSQL function "ddlscript" line 30 at perform

But in the subscriber node, the column does not exist. What am I doing wrong here?
When I add the column manually in the subscriber node and execute DDL1 and DDL2, I dont have any problem.
 
Thanks,
Saranya
 
 
 

		
---------------------------------
Do you Yahoo!?
 Read only the mail you want - Yahoo! Mail SpamGuard.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gborg.postgresql.org/pipermail/slony1-general/attachments/20050105/1f05911b/attachment.html


More information about the Slony1-general mailing list