propelorm/Propel — Issue #246: [postgres] tests failing
Author: c33s
Created: 2011-12-31 22:33:29+00:00
State: open

trying to get the tests for PR https://github.com/propelorm/Propel/pull/144 up and running i noticed that the tests for postgres are failing. its failing on windows7x64 with postgresql-x64-9.0 and on debian squeeze with postgres 8.4.9-0squeeze1
i also tested my old patch-1 branch and i tested the current propelorm/Propel master branch.

at the beginning i thought its a windows problem, but after testing it on linux i think its a general problem while using postgres as test database.

most of the errors are quotation errors like:

```
-'DELETE FROM `book` WHERE book.TITLE='War And Peace' AND book.ID=12'
+'DELETE FROM book WHERE book.TITLE='War And Peace' AND book.ID=12'
```

also postgres is much more strict than mysql, maybe it is a discussion point to switch to postgres for testing. if a test works with postgres it will work for mysql (for stuff like null values and so on).

```
1) GeneratedObjectRelTest::testSetterCollectionSavesForeignObjects
PropelException: Unable to execute INSERT statement [INSERT INTO book (ID, TITLE) VALUES (:p0, :p1)] [wrapped: SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "isbn" violates not-null constraint]
```

for fixtures: namespaced and bookstore

build.properties
```
propel.project = bookstore_namespaced
propel.database = pgsql
propel.database.url = pgsql:dbname=test
propel.disableIdentifierQuoting = true
propel.schema.autoPrefix = true
propel.database.user = test
propel.database.password = test
propel.targetPackage = bookstore
```

runtime-conf.xml

```

pgsql

DebugPDO
pgsql:dbname=test
test
test

false

true

utf8

```

used commands/config
```
aptitude install postgresql php5-cli php5-pgsql php5-sqlite3 php-pear php5-mysql
pear upgrade
pear channel-discover pear.phpunit.de
pear install -a -f phpunit/PHPUnit
pear channel-discover pear.phing.info
pear install -a -f phing/phing

su postgres
createuser --pwprompt --encrypted --echo test
createdb --owner=test --echo --encoding=UTF8 test

cd /path/to/propel/test
bash ../generator/bin/propel-gen fixtures/bookstore main
bash ../generator/bin/propel-gen fixtures/bookstore insert-sql

bash ../generator/bin/propel-gen fixtures/namespaced main
bash ../generator/bin/propel-gen fixtures/namespaced insert-sql

/etc/postgresql/8.4/main/pg_hba.conf
local	test	test	trust

phpunit testsuite
```

**its quite difficult to create tested pull requests for postgres if so many postgres tests are failing per default.**

happy new year :)