I’d like some thoughts on the use of UNSIGNED.

 

MYSQL supports the use of unsigned to change -2^N to 2^N to 0 to 4^N for range of SQL integer values

 

PGSQL does not support ‘unsigned’.  Therefore the range would be -2^N to 2^N.

(I think one of oracle/mssql may also do the same as pgsql )

 

Whilst, I can’t see this being a major issue for most things as I doubt we exceed the 2^32 value anyway – that would be a lot of users or bugs!

 

I see 3 options to try and make the behaviour similar:

 

a)      Ignore this difference/problem

b)      Drop the use of UNSIGNED from new mysql

c)       Add a check constraint to PGSQL that the integer’s must be positive if the field is set to unsigned. Add a check that values are not >2^N when sending from php (so that mysql’s upper limit is enforced to the signed value from php), and such that PGSQL cannot store negative values.

 

Any thoughts?