On pgsql, system.install does CREATE DOMAIN {,small,big}int_unsigned CHECK (VALUE >= 0) during installation. This works fine, but during the Schema API now supports more kinds of unsigned types (float and numeric). So we either need to create unsigned domains for those types as well or put CHECK constraints on all unsigned columns.
The issue http://drupal.org/node/60871 discussed domains vs. check constraints and although domains ended up being used there did not seem to be a strong argument for one over the other.
Now, there is an argument: All simpletests throw exceptions on pgsql because the test re-runs the installation against a prefixed set of tables. The domains are not prefixed, however, so we get "already exists" errors when the install tries to re-create them.
Now that we have Schema API generating our CREATE TABLE SQL for us, I think the simplest solution is to use CHECK constraints on all unsigned columns.
There is an update gotcha here. We should delete the domains once we are no longer using them, but that means the system update will have to convert all the tables in the database to use a CHECK constraint even if the table does not exist in the schema (some module may not be enabled yet). Schema.module's inspection code can make this possible, but then system.install depends on a contrib module. This will take some thought.
Comments
Comment #1
bjaspan commentedI filed http://drupal.org/node/257009 for the related (but not duplicate) simpletest bug.
I guess I'll add that the reason they are not duplicates is that this bug is about an unnecessary lack of symmetry in the way int, float, and numeric unsigned columns are handled. http://drupal.org/node/256001 fixed the issue of float and numeric unsigned not being supported, and has been committed, but now we have two ways of doing the same thing.
Comment #2
bjaspan commentedI fixed the problem with simpletests reported in http://drupal.org/node/257009 with a simpler workaround. Now, the only motivation to fix this issue is that unsigned constraints are enforced via two different mechanisms in the pgsql driver: one for ints, another for serial, float, and numeric. It works fine this way, though, and maybe we should just leave well enough alone.
I'll leave this open for now but I anticipate a 'wontfix' coming in the future.
Comment #3
linuxpoet commentedActually there is an argument about check constraints against domains. Domains are slower.
Comment #4
Crell commentedPostgreSQL maintainers, your thoughts? What shall we do here?
Comment #5
josh waihi commentedI'm against domains as PDO doesn't support custom data types very well. We had this issue earlier and took out a how bunch of domains I thought. I can't see and domains in D7.
grep -irn 'create domain' *Comment #6
josh waihi commentedWe've already addressed this. See this snippet as an example from
createFieldSql:Comment #7
Crell commentedSo is this fixed? Are there update hooks needed to clear out old domains from upgrading installs?
Comment #8
josh waihi commentedNo, thats the only thing left todo I think.
Comment #9
josh waihi commentedMarking this as apart of the surge. Need to define the upgrade path.
Comment #10
josh waihi commentedAn upgrade path needed makes this issue critical.
Comment #11
josh waihi commentednaming more appropriately
Comment #12
damien tournoud commentedGiven the level of breakage of Drupal 6 on PostgreSQL, this cannot be possibly critical. I would be already very happy if Drupal 7 ships with 100% pass rate on PostgreSQL, even without any upgrade path.
Comment #13
josh waihi commentedThat cleaned out all old domains and updated existing domains. That makes this issue fixed.