From: Ricardo B. <rb...@gm...> - 2006-01-17 12:05:40
|
Angel, I followed all the steps that you indicated me. I saved the PostgresWriter.diff file that you sent in $PROJECT_HOME. I executed the commands 1. patch - p0 < PostgresWriter.diff 2. build GUS/DBAdmin install - append 3. dbaDumpSchema - sourceType xml - source GusSchema/Definition/config/gus_schema.xml - targetType postgres - target gus.pg.ddl, that generated the gus.pg.ddl file with all the creation of the database. However, the rules of table versioning had not been created correctly because only some common fields are involved in the rules (modification_date, user_read, user_write, group_read, group_write, other_read, other_write, row_user_id, row_group_id, row_project_id, row_alg_invocation_id, version_alg_invocation_id, version_date, version_transaction_id). If the other fields will no be created, errors in the execution of ISF plugin occur when trying to insert null fields. It follows the example of three bred rules: CREATE RULE AAFeatureVer_5159 AS ON INSERT TO DoTSVer.AAFeatureVer DO INSTEAD INSERT INTO DoTSVer.AAFeatureImpVer ( MODIFICATION_DATE, USER_READ= , USER_WRITE, GROUP_READ, GROUP_WRITE, OTHER_READ, OTHER_WRITE, ROW_USER_ID, ROW_GROUP_ID, ROW_PROJECT_ID, ROW_ALG_INVOCATION_ID, VERSION_ALG_INVOCATION_ID, VERSION_DATE, VERSION_TRANSACTION_ID ) VALUES ( new.MODIFICATION_DATE, new.USER_READ, new.USER_WRITE, new.GROUP_READ, new.GROUP_WRITE, new.OTHER_READ, new.OTHER_WRITE, new.ROW_USER_ID, new.ROW_GROUP_ID, new.ROW_PROJECT_ID, new.ROW_ALG_INVOCATION_ID, new.VERSION_ALG_INVOCATION_ID, new.VERSION_DATE, new.VERSION_TRANSACTION_ID= ); CREATE RULE AffymetrixCELVer_10403 AS ON INSERT TO RADVer.AffymetrixCELVerDO INSTEAD INSERT INTO RADVer.ElementResultImpVer ( MODIFICATION_DATE, USER_READ, USER_WRITE, GROUP_READ, GROUP_WRITE, OTHER_READ, OTHER_WRITE, ROW_USER_ID, ROW_GROUP_ID= , ROW_PROJECT_ID, ROW_ALG_INVOCATION_ID, VERSION_ALG_INVOCATION_ID, VERSION_DATE, VERSION_TRANSACTION_ID ) VALUES ( new.MODIFICATION_DATE, new.USER_READ, new.USER_WRITE, new.GROUP_READ, new.GROUP_WRITE, new.OTHER_READ, new.OTHER_WRITE, new.ROW_USER_ID, new.ROW_GROUP_ID, new.ROW_PROJECT_ID, new.ROW_ALG_INVOCATION_ID, new.VERSION_ALG_INVOCATION_I= D, new.VERSION_DATE, new.VERSION_TRANSACTION_ID ); CREATE RULE BioSourceVer_45682 AS ON INSERT TO StudyVer.BioSourceVer DO INSTEAD INSERT INTO StudyVer.BioMaterialImpVer ( MODIFICATION_DATE, USER_READ, USER_WRITE, GROUP_READ, GROUP_WRITE, OTHER_READ, OTHER_WRITE, ROW_USER_ID, ROW_GROUP_ID, ROW_PROJECT_ID, ROW_ALG_INVOCATION_ID, VERSION_ALG_INVOCATION_ID, VERSION_DATE, VERSION_TRANSACTION_ID ) VALUES ( new.MODIFICATION_DATE, new.USER_READ, new.USER_WRITE, new.GROUP_READ, new.GROUP_WRITE, new.OTHER_READ, new.OTHER_WRITE, new.ROW_USER_ID, new.ROW_GROUP_ID, new.ROW_PROJECT_ID, new.ROW_ALG_INVOCATION_ID, new.VERSION_ALG_INVOCATION_ID, new.VERSION_DATE, new.VERSION_TRANSACTION_ID= ); Do you have any idea why this is happening ? Thanks in advance, Ricardo 2006/1/10, Angel Pizarro <an...@ma...>: > > Hi Ricardo, > I imagine that Mike has not had a chance to get to this, so I took a > stab at fixing this problem. Could you test out the attached patch? Copy > the file to $PROJECT_HOME then: > > cd $PROJECT_HOME > patch -p0 <PostgresWriter.diff > > Then rebuild the GUS/DBAdmin project and redump the schema from the XML > schema file: > > build GUS/DBAdmin install -append > dbaDumpSchema -sourceType xml -source > GusSchema/Definition/config/gus_schema.xml -targetType postgres -target > gus.pg.ddl > > That should produce the proper PostgreSQL ddl from which you can grep > the version views and test the loads. If your tests are successful, I'll > commit the file and post the patch on the bug. > > -angel > > Ricardo Balbi wrote: > > > Mike / Steve, > > We would like to know if you already had created the rules of the > > version tables. > > We believe that with these rules we will go to obtain the loads, > > using the ISF. > > In case that you have some position, you he could inform to me, > please. > > > > thanks in advance, > > Ricardo > > > > 2006/1/3, bug...@pc... > > <mailto:bug...@pc...> > > <bug...@pc... <mailto:bug...@pc... > >>: > > > > https://www.cbil.upenn.edu/tracker/show_bug.cgi?id=3D257 > > <https://www.cbil.upenn.edu/tracker/show_bug.cgi?id=3D257> > > > > > > msa...@pc... <mailto:msa...@pc...> changed: > > > > What |Removed |Added > > > -------------------------------------------------------------------------= --- > > Status|RESOLVED |REOPENED > > Resolution|INVALID | > > > > > > > > > > ------- Comment #4 from msa...@pc... > > <mailto:msa...@pc...> 2006-01-03 12:05 ------- > > version table rules are indeed not being created. this should be > > relatively > > straight forward to fix. > > > > > > -- > > Configure bugmail: > > https://www.cbil.upenn.edu/tracker/userprefs.cgi?tab=3Demail > > ------- You are receiving this mail because: ------- > > You reported the bug, or are watching the reporter. > > > > > > > -- > > Angel Pizarro > Director, Bioinformatics Facility > Institute for Translational Medicine and Therapeutics > University of Pennsylvania > 806 BRB II/III > 421 Curie Blvd. > Philadelphia, PA 19104-6160 > > P: 215-573-3736 > F: 215-573-9004 > > > > Index: GUS/DBAdmin/src/java/org/gusdb/dbadmin/writer/PostgresWriter.java > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- GUS/DBAdmin/src/java/org/gusdb/dbadmin/writer/PostgresWriter.java > (revision 4068) > +++ GUS/DBAdmin/src/java/org/gusdb/dbadmin/writer/PostgresWriter.java > (working copy) > @@ -12,6 +12,7 @@ > import org.gusdb.dbadmin.model.GusSchema; > import org.gusdb.dbadmin.model.GusTable; > import org.gusdb.dbadmin.model.GusView; > +import org.gusdb.dbadmin.model.VersionView; > import org.gusdb.dbadmin.model.Schema; > import org.gusdb.dbadmin.model.Sequence; > import org.gusdb.dbadmin.model.Table; > @@ -105,6 +106,8 @@ > super.writeView( view ); > if ( view instanceof GusView ) { > writeViewRules( (GusView) view ); > + }else if ( view instanceof VersionView ) { > + writeVersionViewRules( (VersionView) view ); > } > } > > @@ -112,8 +115,6 @@ > * Since PostgreSQL doesn't support updatable views, this is a hack > that > * uses rules to mimick the updatable view functionality. > * > - * TODO: Note that this means version views are now not updatable > since they > - * don't have a PK. > * > * @param view DOCUMENT ME! > * @throws IOException DOCUMENT ME! > @@ -174,7 +175,47 @@ > oStream.flush( ); > } > > + > /** > + * Since PostgreSQL doesn't support updatable views, this is a hack > that > + * uses rules to mimick the updatable view functionality. > + * > + * Version views are now not updatable since they > + * don't have a PK, so we limit rules to insertion > + * > + * @param view DOCUMENT ME! > + * @throws IOException DOCUMENT ME! > + */ > + private void writeVersionViewRules( VersionView view ) throws > IOException { > + oStream.write( "CREATE RULE " + view.getName( ) + "_" + > random.nextInt( 100000 ) + " AS ON INSERT TO " > + + view.getSchema( ).getName( ) + "." + view.getName( ) + > " DO INSTEAD INSERT INTO " > + + view.getTable( ).getSchema( ).getName( ) + "." + > view.getTable( ).getName( ) + " ( " ); > + > + boolean first =3D true; > + for ( ColumnPair columnPair : view.getColumns() ) { > + if ( !first ) { > + oStream.write( ", " ); > + } > + oStream.write( columnPair.getTableName( ) ); > + first =3D false; > + } > + > + oStream.write( " ) VALUES ( " ); > + > + first =3D true; > + for ( ColumnPair columnPair : view.getColumns() ) { > + if ( !first ) { > + oStream.write( ", " ); > + } > + oStream.write( "new." + columnPair.getViewName( ) ); > + first =3D false; > + } > + > + oStream.write( " );\n\n" ); > + > + } > + > + /** > * DOCUMENT ME! > * > * @param type DOCUMENT ME! > > > |