type(N) in MySQL numeric type defs in core schema useless
Hi all, I'm going through the core database code (as part of my role as PostgreSQL maintainer) and have stumbled upon an interesting tidbit. The use of (N) declarations for integer types in CREATE TABLE statements is useless. From the MySQL manual: "Another extension is supported by MySQL for optionally specifying the display width of an integer value in parentheses following the base keyword for the type (for example, INT(4)). This optional display width specification is used to left-pad the display of values having a width less than the width specified for the column. The display width does not constrain the range of values that can be stored in the column, nor the number of digits that are displayed for values having a width exceeding that specified for the column." Given that, why on earth are we even using them? I propose to strip the (N) declaration from core schema files. It'll provide a much quicker path between MySQL and PostgreSQL declarations. Any complaints about this proposition? Cheers, -- Sammy Spets Synerger Pty Ltd http://www.synerger.com/
On 18 Aug 2006, at 08:32, Sammy Spets wrote:
Given that, why on earth are we even using them? I propose to strip the (N) declaration from core schema files. It'll provide a much quicker path between MySQL and PostgreSQL declarations.
Any complaints about this proposition?
Is this true for all types, or just of, say, integers or varchars? What URL did you get that information from? -- Dries Buytaert :: http://www.buytaert.net/
Dries Buytaert schrieb:
On 18 Aug 2006, at 08:32, Sammy Spets wrote:
Given that, why on earth are we even using them? I propose to strip the (N) declaration from core schema files. It'll provide a much quicker path between MySQL and PostgreSQL declarations.
Any complaints about this proposition?
Is this true for all types, or just of, say, integers or varchars?
See char [1] and binary[2] documentation. The (N) declaration is for reserving space in the specified column (for example char(4) stores 'a' as 'a '). Therefore I would support Sammy's proposal to strip the unneeded (N) declaration.
What URL did you get that information from?
I guess he took this one: http://dev.mysql.com/doc/refman/4.1/en/numeric-types.html [1] http://dev.mysql.com/doc/refman/4.1/en/char.html [2] http://dev.mysql.com/doc/refman/4.1/en/binary-varbinary.html
Sammy Spets wrote:
Hi all,
I'm going through the core database code (as part of my role as PostgreSQL maintainer) and have stumbled upon an interesting tidbit.
The use of (N) declarations for integer types in CREATE TABLE statements is useless. From the MySQL manual:
"Another extension is supported by MySQL for optionally specifying the display width of an integer value in parentheses following the base keyword for the type (for example, INT(4)). This optional display width specification is used to left-pad the display of values having a width less than the width specified for the column.
The display width does not constrain the range of values that can be stored in the column, nor the number of digits that are displayed for values having a width exceeding that specified for the column."
Given that, why on earth are we even using them? I propose to strip the (N) declaration from core schema files. It'll provide a much quicker path between MySQL and PostgreSQL declarations.
Agreed. They are not needed. The closer we can make database declarations to standard SQL and to a common denominator between MySQL and Postgres, the easier our job of supporting multiple databases will be.
On 18 Aug 2006, at 19:21, Chris Johnson wrote:
The closer we can make database declarations to standard SQL and to a common denominator between MySQL and Postgres, the easier our job of supporting multiple databases will be.
Let's nuke 'em! Go ahead and make that patch. :) -- Dries Buytaert :: http://www.buytaert.net/
Dries Buytaert wrote:
Let's nuke 'em! Go ahead and make that patch. :)
http://drupal.org/node/79428 Building patch now.
Dries Buytaert wrote:
On 18 Aug 2006, at 19:21, Chris Johnson wrote:
The closer we can make database declarations to standard SQL and to a common denominator between MySQL and Postgres, the easier our job of supporting multiple databases will be.
Let's nuke 'em! Go ahead and make that patch. :)
-- Dries Buytaert :: http://www.buytaert.net/
Patch available for review for core files only at http://drupal.org/node/79428.
participants (4)
-
Chris Johnson -
Dries Buytaert -
Sammy Spets -
Stefan Borchert