[ic] Sequences and postgres bug found

Mike Heins interchange-users@icdevgroup.org
Fri Jul 19 10:02:00 2002


Quoting Joachim Leidinger (jojo@blackpoint.de):
> René Hertell wrote:
> > I found now what causes the sequence problem i wrote earlier today..
> > 
> > When specifying a serial column in postgres, ic creates a table called
> > ic_test_create. Postgres makes from it sequence called
> > ic_test_create_code_seq. This should also be deleted when the test-table
> > creation process is sucessful (in the DBI.pm module there is no "drop
> > sequence" part at all).
> > 
> > I tried to add this to the DBI.pm (row 289 and 299)
> > 
> >     $db->do("drop sequence ic_test_create_code_seq")
> > 
> > to that part that deletes the test-table, but it IC somehow fails to execute
> > it.
> > 
> > Could someone help me with insering the "drop sequence" to the DBI.pm so
> > that this issue could be fixed.
> > 
> > REgards, René
> 
> I think, this is not a good idea, because anything can causes to remove, 
> to damage or to delete the files in the products directory of the 
> catalogs and after restarting the IC server, you will lost all the 
> datas. Another problem is, if you use an external SQL-Server and the 
> server which has your IC and catalog has a damage or a crash, you will 
> lost all the datas in your SQL-Server, if you rebuild your catalog and 
> IC once more in a newest server.
> 
> What happens, if one SQL-Server is shared with a lot of different IC and 
> one of the IC Administrator has a bad day and make a error or wrong work?
> 
> I think, it is better to not use any drop commands per default. Maybe it 
> is very usefull for the development. In that case, maybe it is better to 
> use a directive like
> 
> # for the development
> # use the drop command Yes or NO. Default NO!
> DropTables   Yes
> 
> in the catalog.cfg and use
> 
> $db->do("drop sequence ic_test_create_code_seq") if 
> $Vend::Cfg->{DropTables};
> 
> Or?
> 

IC 4.8 doesn't really support sequences. But in IC 4.9 I just added
a transparent AUTO_SEQUENCE which uses the same configuration.

 Database sequenced sequenced.txt __SQLDSN__
 Database sequenced AUTO_SEQUENCE sequenced_seq

And as you noted, you have to specify if you want the sequence
dropped on table creation:

 Database sequenced AUTO_SEQUENCE_DROP 1

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

I don't want to get to the end of my life and find I have just
lived the length of it. I want to have lived the width of it as
well. -- Diane Ackerman