Drizzledump not handling MySQL CHAR(0) /VARCHAR(0) columns gracefully

Bug #685046 reported by Patrick Crews
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Drizzle
Fix Released
Low
Andrew Hutchings
7.0
Fix Released
Low
Andrew Hutchings

Bug Description

If a MySQL table has a CHAR 0 column, such as this:
CREATE TABLE char_table(description TEXT,
col_char0 char(0)
) ENGINE=MyISAM;

Drizzledump will produce this output:
CREATE TABLE `char_table` (
  `description` TEXT COLLATE utf8_general_ci DEFAULT NULL,
  `col_char0` VARCHAR COLLATE utf8_general_ci DEFAULT NULL
) ENGINE='InnoDB' COLLATE='utf8_general_ci';

The plain VARCHAR isn't friends with the parser.

Related branches

Revision history for this message
Patrick Crews (patrick-crews) wrote :

Why anyone would use a CHAR(0) column, I dunno. But I figure if one can live on MySQL, we should test for it : ) This is probably very much an edge case though.

Changed in drizzle:
assignee: nobody → Andrew Hutchings (linuxjedi)
status: New → Confirmed
importance: Undecided → Low
summary: - Drizzledump not handline MySQL CHAR(0) columns gracefully
+ Drizzledump not handling MySQL CHAR(0) columns gracefully
summary: - Drizzledump not handling MySQL CHAR(0) columns gracefully
+ Drizzledump not handling MySQL CHAR(0) /VARCHAR(0) columns gracefully
Revision history for this message
Stewart Smith (stewart) wrote : Re: [Bug 685046] Re: Drizzledump not handline MySQL CHAR(0) columns gracefully

On Sat, 04 Dec 2010 01:19:34 -0000, Patrick Crews <email address hidden> wrote:
> Why anyone would use a CHAR(0) column, I dunno. But I figure if one can
> live on MySQL, we should test for it : ) This is probably very much an
> edge case though.

from http://dev.mysql.com/doc/refman/5.0/en/string-type-overview.html

MySQL permits you to create a column of type CHAR(0). This is useful
primarily when you have to be compliant with old applications that
depend on the existence of a column but that do not actually use its
value. CHAR(0) is also quite nice when you need a column that can take
only two values: A column that is defined as CHAR(0) NULL occupies only
one bit and can take only the values NULL and '' (the empty string).

For a start, very Oracle incompatible behaviour :)

--
Stewart Smith

Revision history for this message
Patrick Crews (patrick-crews) wrote :

Very cool. I suppose I should've RTFM'd a bit more before I spoke ; )
Thanks for educati-fying me on this.

On Sun, Dec 5, 2010 at 7:11 PM, Stewart Smith <email address hidden>wrote:

> On Sat, 04 Dec 2010 01:19:34 -0000, Patrick Crews <
> <email address hidden>> wrote:
> > Why anyone would use a CHAR(0) column, I dunno. But I figure if one can
> > live on MySQL, we should test for it : ) This is probably very much an
> > edge case though.
>
> from http://dev.mysql.com/doc/refman/5.0/en/string-type-overview.html
>
> MySQL permits you to create a column of type CHAR(0). This is useful
> primarily when you have to be compliant with old applications that
> depend on the existence of a column but that do not actually use its
> value. CHAR(0) is also quite nice when you need a column that can take
> only two values: A column that is defined as CHAR(0) NULL occupies only
> one bit and can take only the values NULL and '' (the empty string).
>
>
> For a start, very Oracle incompatible behaviour :)
>
> --
> Stewart Smith
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/685046
>
> Title:
> Drizzledump not handling MySQL CHAR(0) /VARCHAR(0) columns gracefully
>
> Status in A Lightweight SQL Database for Cloud Infrastructure and Web
> Applications:
> Fix Committed
> Status in Drizzle elliott series:
> Fix Committed
>
> Bug description:
> If a MySQL table has a CHAR 0 column, such as this:
> CREATE TABLE char_table(description TEXT,
> col_char0 char(0)
> ) ENGINE=MyISAM;
>
> Drizzledump will produce this output:
> CREATE TABLE `char_table` (
> `description` TEXT COLLATE utf8_general_ci DEFAULT NULL,
> `col_char0` VARCHAR COLLATE utf8_general_ci DEFAULT NULL
> ) ENGINE='InnoDB' COLLATE='utf8_general_ci';
>
> The plain VARCHAR isn't friends with the parser.
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/drizzle/+bug/685046/+subscribe
>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.