Merge table weirdness

Mika Tuupola <[email protected]> Fri, 7 May 2004 15:25:12 +0300 (EEST)
Newsgroups gmane.comp.web.phpopentracker.devel
Message-ID <Pine.GSO.4.10.10405071520320.29225-100000@aurinko>
	Running 1.4.1 and after converting to mysql merge tables
	things stopped working. Loogin at the debug output
	from split_tables I can see it creates different
	structure to pot_visitor and pot_accesslog than what
	the per-month tables are:


	From split-tables:
-cut-
CREATE  TABLE IF NOT EXISTS pot_accesslog (
accesslog_id      INT(11)                NOT NULL,
timestamp         INT(10)    UNSIGNED    NOT NULL,
weekday           TINYINT(1) UNSIGNED    NOT NULL,
hour              TINYINT(2) UNSIGNED    NOT NULL,
document_id       INT(11)                NOT NULL,
exit_target_id    INT(11)    DEFAULT '0' NOT NULL,
entry_document    TINYINT(1) UNSIGNED    NOT NULL,

KEY accesslog_id   (accesslog_id),
KEY timestamp      (timestamp),
KEY document_id    (document_id),
KEY exit_target_id (exit_target_id)
) TYPE=MRG_MyISAM
UNION=(pot_accesslog_200301,pot_accesslog_200302,pot_accesslog_200303,pot_accesslog_200304,pot_accesslog_200305,pot_accesslog_200306,pot_accesslog_200307,pot_accesslog_200308,pot_accesslog_200309,pot_accesslog_200310,pot_accesslog_200311,pot_accesslog_200312,pot_accesslog_200401,pot_accesslog_200402,pot_accesslog_200403,pot_accesslog_200404,pot_accesslog_200405)
-cut-

	From SHOW CREATE TABLE pot_accesslog_200301;
-cut-
CREATE TABLE `pot_accesslog_200301` (
  `accesslog_id` int(11) NOT NULL default '0',
  `client_id` int(10) unsigned NOT NULL default '0',
  `timestamp` int(10) unsigned NOT NULL default '0',
  `document_id` int(11) NOT NULL default '0',
  `exit_target_id` int(11) NOT NULL default '0',
  `entry_document` set('0','1') NOT NULL default '',
  KEY `accesslog_id` (`accesslog_id`),
  KEY `timestamp` (`timestamp`),
  KEY `document_id` (`document_id`),
  KEY `exit_target_id` (`exit_target_id`)
) TYPE=MyISAM
-cut-

	Note that the per-month tables dont hae weekday and hour
	columns. Since the per-month tables and the "main"
	table have differing schemas the whole union is
	broken:

-cut-
mysql> describe pot_accesslog;
ERROR 1016: Can't open file: 'pot_accesslog.MRG'. (errno: 143)
mysql>           
-cut-



-- 
Mika Tuupola                      http://www.appelsiini.net/~tuupola/




-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3