I'm reposting with only the D7 patch here, and I'll create another entry for the D6 patch since there seems to be a "potential problem" with the test system.

This is a copy of node http://drupal.org/node/334598 which I will close.

Whether the SQL92 should be followed, my answer will be yes. Now it is easy to fix the core to fix this problem.

PostgreSQL does NOT document any unsigned type, but supports unsigned integer types. Only integer types. What works:

smallint_unsigned, int_unsigned, bigint_unsigned

Anything else does not work under PostgreSQL, but does in MySQL and thus we should do something about it.

My suggest patch (for D6 & D7) is to check whether we have a smallint, int or bigint. If so, use the '_unsigned' as defined. Otherwise, use the CHECK($name >= 0) as for the serial type. This works for all numeric types including float, numeric and serial.

It would be really appreciated if you were to patch D6 too. For 6.7.

In case you wanted to test, create an unsigned numeric with some precision/scale before the patch. Then install the patch and see. Floats/real have the same problem in PostgreSQL.

I found the problem while working with Ubercart that uses unsigned numeric in several places.

Thank you.
Alexis Wilke

CommentFileSizeAuthor
drupal-postgresql-unsigned-7.x.patch823 bytesAlexisWilke

Comments

Status: Needs review » Needs work

The last submitted patch failed testing.

lilou’s picture

Status: Needs work » Needs review
damien tournoud’s picture

Status: Needs review » Closed (duplicate)