Re: [Modeling-users] Installation tests failure (datetime) - osx, pypgsql
Status: Abandoned
Brought to you by:
sbigaret
From: Mario R. <ma...@ru...> - 2003-01-28 17:22:12
|
Hi, OK, thanks for the postgres debugging (sorry i had not looked there myself). I am running postgres 7.3.1 (btw, postgres does not come by default on osx but has to be installed...). > I suggest that you edit > tests/testPackages/AuthorBooks/model_AuthorBooks.xml and ... > so that it says (change externalType DATETIME to TIMESTAMP): Changing datetime to timestamp works perfectly. From a clean database, the following sequence of tests run OK (except for dropping of non-existant tables): % python run.py % python test_EditingContext_Global.py -r % python test_EditingContext_Global.py % python test_EditingContext.py % python test_EditingContext_Global_Inheritance.py -r % python test_EditingContext_Global_Inheritance.py However, running the tests a 2nd time gives errors, namely because the now existent tables cannot be dropped. The first error occurs in the 2nd script step, for which I am including the output below. This should probably be corrected. I am also suggesting a slightly modified tests/README... mario ================================= # tests/README Test the installation of the Modeling framework -------------------------------- To test the installation, perform the following sequence of commands or manual operations: % cd <unpacked Modeling package>/Modeling/tests % python ./run.py # running with -h gives usage # Remaining tests require: # - that a PostgreSQL and/or MySQL database server is running somewhere # - you modify the file ./test.cfg to reflect you own PostgreSQL/MySQL installation # - two different databases (may be empty) with names: "AUTHOR_BOOKS" & "STORE_EMPLOYEES" # Initialise(*)(**) EditingContext test db (uses model in ./testPackages/AuthorBooks/model_AuthorBooks.xml): % python test_EditingContext_Global.py -r # initialise db % python test_EditingContext_Global.py # run tests % python test_EditingContext.py #- Initialise(*) Inheritance test db (uses model in ./testPackages/StoreEmployees) % python test_EditingContext_Global_Inheritance.py -r # initialise db % python test_EditingContext_Global_Inheritance.py # run test -- (*) Note that, the first time this script is run on an empty database, it is OK for the DROP statements to fail (but only the DROP statements), with error messages similar to: Evaluating: DROP SEQUENCE PK_SEQ_WRITER Couldn't evaluate expression DROP SEQUENCE PK_SEQ_WRITER. Reason: libpq.OperationalError:ERROR: sequence "pk_seq_writer" does not exist (**) For PostgreSQL versions > 7.0, models that use the deprecated types of datetime and timespan will give an error -- the respectively equivalent types timestamp and interval should be used instead. ================================= # output log % python test_EditingContext_Global.py -r PostgresqlAdaptor: using pypgsql Creating PostgresqlAdaptorChannel <PostgresqlAdaptorLayer.PostgresqlAdaptorChannel.PostgresqlAdaptorChanne l instance at 0xac64f0> Transaction: BEGIN Opening connection to the DB with conn.Dict: {'host': 'localhost', 'password': 'XXX', 'user': 'postgres', 'database': 'AUTHOR_BOOKS'} Opening channel <PostgresqlAdaptorLayer.PostgresqlAdaptorChannel.PostgresqlAdaptorChanne l instance at 0xac6310> (0xac6310) Called Evaluating: DROP TABLE WRITER Couldn't evaluate expression DROP TABLE WRITER. Reason: libpq.OperationalError:ERROR: Cannot drop table writer because other objects depend on it Use DROP ... CASCADE to drop the dependent objects too Transaction: ROLLBACK error: Couldn't evaluate expression DROP TABLE WRITER. Reason: libpq.OperationalError:ERROR: Cannot drop table writer because other objects depend on it Use DROP ... CASCADE to drop the dependent objects too Transaction: BEGIN Evaluating: DROP TABLE BOOK Transaction: COMMIT Transaction: BEGIN Evaluating: CREATE TABLE WRITER ( FIRST_NAME VARCHAR(40) , LAST_NAME VARCHAR(30) NOT NULL, FK_WRITER_ID INTEGER , AGE INTEGER , BIRTHDAY TIMESTAMP , ID INTEGER NOT NULL) Couldn't evaluate expression CREATE TABLE WRITER ( FIRST_NAME VARCHAR(40) , LAST_NAME VARCHAR(30) NOT NULL, FK_WRITER_ID INTEGER , AGE INTEGER , BIRTHDAY TIMESTAMP , ID INTEGER NOT NULL). Reason: libpq.OperationalError:ERROR: Relation 'writer' already exists Transaction: ROLLBACK error: Couldn't evaluate expression CREATE TABLE WRITER ( FIRST_NAME VARCHAR(40) , LAST_NAME VARCHAR(30) NOT NULL, FK_WRITER_ID INTEGER , AGE INTEGER , BIRTHDAY TIMESTAMP , ID INTEGER NOT NULL). Reason: libpq.OperationalError:ERROR: Relation 'writer' already exists Transaction: BEGIN Evaluating: CREATE TABLE BOOK ( PRICE NUMERIC(10,2) , title VARCHAR(40) NOT NULL, id INT NOT NULL, FK_WRITER_ID INTEGER ) Transaction: COMMIT Transaction: BEGIN Evaluating: ALTER TABLE WRITER ADD PRIMARY KEY (ID) Couldn't evaluate expression ALTER TABLE WRITER ADD PRIMARY KEY (ID). Reason: libpq.OperationalError:ERROR: ALTER TABLE / PRIMARY KEY multiple primary keys for table 'writer' are not allowed Transaction: ROLLBACK error: Couldn't evaluate expression ALTER TABLE WRITER ADD PRIMARY KEY (ID). Reason: libpq.OperationalError:ERROR: ALTER TABLE / PRIMARY KEY multiple primary keys for table 'writer' are not allowed Transaction: BEGIN Evaluating: ALTER TABLE BOOK ADD PRIMARY KEY (id) Transaction: COMMIT Transaction: BEGIN Evaluating: ALTER TABLE WRITER ADD CONSTRAINT pygmalion FOREIGN KEY (FK_WRITER_ID) REFERENCES WRITER(ID) INITIALLY DEFERRED Couldn't evaluate expression ALTER TABLE WRITER ADD CONSTRAINT pygmalion FOREIGN KEY (FK_WRITER_ID) REFERENCES WRITER(ID) INITIALLY DEFERRED. Reason: libpq.OperationalError:ERROR: constraint "pygmalion" already exists for relation "writer" Transaction: ROLLBACK error: Couldn't evaluate expression ALTER TABLE WRITER ADD CONSTRAINT pygmalion FOREIGN KEY (FK_WRITER_ID) REFERENCES WRITER(ID) INITIALLY DEFERRED. Reason: libpq.OperationalError:ERROR: constraint "pygmalion" already exists for relation "writer" Transaction: BEGIN Evaluating: ALTER TABLE BOOK ADD CONSTRAINT author FOREIGN KEY (FK_WRITER_ID) REFERENCES WRITER(ID) INITIALLY DEFERRED Transaction: COMMIT Transaction: BEGIN Evaluating: DROP SEQUENCE PK_SEQ_WRITER Transaction: COMMIT Transaction: BEGIN Evaluating: DROP SEQUENCE PK_SEQ_BOOK Transaction: COMMIT Transaction: BEGIN Evaluating: CREATE SEQUENCE PK_SEQ_WRITER START 1 Transaction: COMMIT Transaction: BEGIN Evaluating: CREATE SEQUENCE PK_SEQ_BOOK START 1 Transaction: COMMIT Transaction: BEGIN Evaluating: select nextval('PK_SEQ_WRITER') Evaluating: select nextval('PK_SEQ_WRITER') Evaluating: select nextval('PK_SEQ_WRITER') Transaction: COMMIT Transaction: BEGIN Evaluating: insert into WRITER (id, age, last_name,first_name,birthday,fk_writer_id) values (1,24,'Cleese','John','1939-10-27 08:31:15',null) Couldn't evaluate expression insert into WRITER (id, age, last_name,first_name,birthday,fk_writer_id) values (1,24,'Cleese','John','1939-10-27 08:31:15',null). Reason: libpq.OperationalError:ERROR: Cannot insert a duplicate key into unique index writer_pkey Transaction: ROLLBACK Traceback (most recent call last): File "test_EditingContext_Global.py", line 943, in ? errs = main(sys.argv) File "test_EditingContext_Global.py", line 927, in main if reinitDB_flag: reinitDB(); return File "test_EditingContext_Global.py", line 846, in reinitDB channel.evaluateExpression(sqlExpr) File "/Users/frdricva/Desktop/ModelingCore-0.8.1/Modeling/DatabaseAdaptors/ AbstractDBAPI2AdaptorLayer/AbstractDBAPI2AdaptorChannel.py", line 159, in evaluateExpression raise GeneralAdaptorException, msg Modeling.Adaptor.GeneralAdaptorException: Couldn't evaluate expression insert into WRITER (id, age, last_name,first_name,birthday,fk_writer_id) values (1,24,'Cleese','John','1939-10-27 08:31:15',null). Reason: libpq.OperationalError:ERROR: Cannot insert a duplicate key into unique index writer_pkey ================================= |