[drupal-devel] Critical error in use of timestamp!

Carl McDade carl_mcdade at yahoo.com
Thu Mar 17 09:51:21 UTC 2005


I just spent two days trying to find out why database backups are not
running. It would seem that naming database columns with a reserved word
is the problem. Timestamp is used as a column name in about 15 instances.

Phpmyadmin and mySQL adminstrator both take the reserved word literally
and execute errors when trying to name a column with time when running
the script.

This is a basic database knowledge thing. Never should programming
language, database or columntypes reserved words be used as column names.

This use is present in 4.5.2 and 4.6

-- MySQL dump 8.22
--
-- Host: localhost    Database: drupal_devel
-- Server version  3.23.52-nt

--
-- Table structure for table 'access'
--

CREATE TABLE access (
  aid tinyint(10) NOT NULL auto_increment,
  mask varchar(255) NOT NULL default '',
  type varchar(255) NOT NULL default '',
  status tinyint(2) NOT NULL default '0',
  PRIMARY KEY  (aid)
) TYPE=MyISAM;

--
-- Table structure for table 'accesslog'
--

CREATE TABLE accesslog (
  aid int(10) NOT NULL auto_increment,
  title varchar(255) default NULL,
  path varchar(255) default NULL,
  url varchar(255) default NULL,
  hostname varchar(128) default NULL,
  uid int(10) unsigned default '0',
  timestamp int(11) unsigned NOT NULL default '0',
  KEY accesslog_timestamp (timestamp),
  PRIMARY KEY  (aid)
) TYPE=MyISAM;

--
-- Table structure for table 'aggregator_category'
--

CREATE TABLE aggregator_category (
  cid int(10) NOT NULL auto_increment,
  title varchar(255) NOT NULL default '',
  description longtext NOT NULL,
  block tinyint(2) NOT NULL default '0',
  PRIMARY KEY  (cid),
  UNIQUE KEY title (title)
) TYPE=MyISAM;

--
-- Table structure for table 'aggregator_category_feed'
--

CREATE TABLE aggregator_category_feed (
  fid int(10) NOT NULL default '0',
  cid int(10) NOT NULL default '0',
  PRIMARY KEY  (fid,cid)
) TYPE=MyISAM;

--
-- Table structure for table 'aggregator_category_item'
--

CREATE TABLE aggregator_category_item (
  iid int(10) NOT NULL default '0',
  cid int(10) NOT NULL default '0',
  PRIMARY KEY  (iid,cid)
) TYPE=MyISAM;

--
-- Table structure for table 'aggregator_feed'
--

CREATE TABLE aggregator_feed (
  fid int(10) NOT NULL auto_increment,
  title varchar(255) NOT NULL default '',
  url varchar(255) NOT NULL default '',
  refresh int(10) NOT NULL default '0',
  checked int(10) NOT NULL default '0',
  link varchar(255) NOT NULL default '',
  description longtext NOT NULL,
  image longtext NOT NULL,
  etag varchar(255) NOT NULL default '',
  modified int(10) NOT NULL default '0',
  block tinyint(2) NOT NULL default '0',
  PRIMARY KEY  (fid),
  UNIQUE KEY link (url),
  UNIQUE KEY title (title)
) TYPE=MyISAM;

--
-- Table structure for table 'aggregator_item'
--

CREATE TABLE aggregator_item (
  iid int(10) NOT NULL auto_increment,
  fid int(10) NOT NULL default '0',
  title varchar(255) NOT NULL default '',
  link varchar(255) NOT NULL default '',
  author varchar(255) NOT NULL default '',
  description longtext NOT NULL,
  timestamp int(11) default NULL,
  PRIMARY KEY  (iid)
) TYPE=MyISAM;

--
-- Table structure for table 'authmap'
--

CREATE TABLE authmap (
  aid int(10) unsigned NOT NULL auto_increment,
  uid int(10) NOT NULL default '0',
  authname varchar(128) NOT NULL default '',
  module varchar(128) NOT NULL default '',
  PRIMARY KEY  (aid),
  UNIQUE KEY authname (authname)
) TYPE=MyISAM;

--
-- Table structure for table 'blocks'
--

CREATE TABLE blocks (
  module varchar(64) DEFAULT '' NOT NULL,
  delta varchar(32) NOT NULL default '0',
  status tinyint(2) DEFAULT '0' NOT NULL,
  weight tinyint(1) DEFAULT '0' NOT NULL,
  region tinyint(1) DEFAULT '0' NOT NULL,
  custom tinyint(2) DEFAULT '0' NOT NULL,
  throttle tinyint(1) DEFAULT '0' NOT NULL,
  visibility tinyint(1) DEFAULT '0' NOT NULL,
  pages text NOT NULL,
  types text NOT NULL
) TYPE=MyISAM;

--
-- Table structure for table 'book'
--

CREATE TABLE book (
  nid int(10) unsigned NOT NULL default '0',
  parent int(10) NOT NULL default '0',
  weight tinyint(3) NOT NULL default '0',
  log longtext,
  PRIMARY KEY  (nid),
  KEY parent (parent)
) TYPE=MyISAM;

--
-- Table structure for table 'boxes'
--

CREATE TABLE boxes (
  bid tinyint(4) NOT NULL auto_increment,
  title varchar(64) NOT NULL default '',
  body longtext,
  info varchar(128) NOT NULL default '',
  format int(4) NOT NULL default '0',
  PRIMARY KEY  (bid),
  UNIQUE KEY title (title),
  UNIQUE KEY info (info)
) TYPE=MyISAM;

--
-- Table structure for table 'cache'
--

CREATE TABLE cache (
  cid varchar(255) NOT NULL default '',
  data longtext,
  expire int(11) NOT NULL default '0',
  created int(11) NOT NULL default '0',
  headers text,
  PRIMARY KEY  (cid),
  INDEX expire (expire)
) TYPE=MyISAM;

--
-- Table structure for table 'comments'
--

CREATE TABLE comments (
  cid int(10) NOT NULL auto_increment,
  pid int(10) NOT NULL default '0',
  nid int(10) NOT NULL default '0',
  uid int(10) NOT NULL default '0',
  subject varchar(64) NOT NULL default '',
  comment longtext NOT NULL,
  hostname varchar(128) NOT NULL default '',
  timestamp int(11) NOT NULL default '0',
  score mediumint(9) NOT NULL default '0',
  status tinyint(3) unsigned NOT NULL default '0',
  format int(4) NOT NULL default '0',
  thread varchar(255) NOT NULL,
  users longtext,
  name varchar(60) default NULL,
  mail varchar(64) default NULL,
  homepage varchar(255) default NULL,
  PRIMARY KEY  (cid),
  KEY lid (nid)
) TYPE=MyISAM;

--
-- Table structre for table 'node_last_comment'
--

CREATE TABLE node_comment_statistics (
  nid int(10) unsigned NOT NULL auto_increment,
  last_comment_timestamp int(11) NOT NULL default '0',
  last_comment_name varchar(60)  default NULL,
  last_comment_uid int(10) NOT NULL default '0',
  comment_count int(10) unsigned NOT NULL default '0',
  PRIMARY KEY (nid),
  KEY node_comment_timestamp (last_comment_timestamp)
) TYPE=MyISAM;

--
-- Table structure for table 'directory'
--

CREATE TABLE directory (
  link varchar(255) NOT NULL default '',
  name varchar(128) NOT NULL default '',
  mail varchar(128) NOT NULL default '',
  slogan longtext NOT NULL,
  mission longtext NOT NULL,
  timestamp int(11) NOT NULL default '0',
  PRIMARY KEY  (link)
) TYPE=MyISAM;

--
-- Table structure for table 'files'
--

CREATE TABLE files (
  fid int(10) unsigned NOT NULL default '0',
  nid int(10) unsigned NOT NULL default '0',
  filename varchar(255) NOT NULL default '',
  filepath varchar(255) NOT NULL default '',
  filemime varchar(255) NOT NULL default '',
  filesize int(10) unsigned NOT NULL default '0',
  list tinyint(1) unsigned NOT NULL default '0',
  PRIMARY KEY  (fid)
) TYPE=MyISAM;

--
-- Table structure for table 'filter_formats'
--

CREATE TABLE filter_formats (
  format int(4) NOT NULL auto_increment,
  name varchar(255) NOT NULL default '',
  roles varchar(255) NOT NULL default '',
  cache tinyint(2) NOT NULL default '0',
  PRIMARY KEY format (format)
) TYPE=MyISAM;

--
-- Table structure for table 'filters'
--

CREATE TABLE filters (
  format int(4) NOT NULL default '0',
  module varchar(64) NOT NULL default '',
  delta tinyint(2) DEFAULT '0' NOT NULL,
  weight tinyint(2) DEFAULT '0' NOT NULL,
  INDEX (weight)
) TYPE=MyISAM;

--
-- Table structure for table 'flood'
--

CREATE TABLE flood (
  event varchar(64) NOT NULL default '',
  hostname varchar(128) NOT NULL default '',
  timestamp int(11) NOT NULL default '0'
) TYPE=MyISAM;

--
-- Table structure for table 'forum'
--

CREATE TABLE forum (
  nid int(10) unsigned NOT NULL default '0',
  tid int(10) unsigned NOT NULL default  '0',
  PRIMARY KEY  (nid),
  KEY tid (tid)
) TYPE=MyISAM;

--
-- Table structure for table 'history'
--

CREATE TABLE history (
  uid int(10) NOT NULL default '0',
  nid int(10) NOT NULL default '0',
  timestamp int(11) NOT NULL default '0',
  PRIMARY KEY  (uid,nid)
) TYPE=MyISAM;

--
-- Table structure for table 'locales_meta'
--

CREATE TABLE locales_meta (
  locale varchar(12) NOT NULL default '',
  name varchar(64) NOT NULL default '',
  enabled int(2) NOT NULL default '0',
  isdefault int(2) NOT NULL default '0',
  plurals int(1) NOT NULL default '0',
  formula varchar(128) NOT NULL default '',
  PRIMARY KEY  (locale)
) TYPE=MyISAM;

--
-- Table structure for table 'locales_source'
--

CREATE TABLE locales_source (
  lid int(11) NOT NULL auto_increment,
  location varchar(128) NOT NULL default '',
  source blob NOT NULL,
  PRIMARY KEY  (lid)
) TYPE=MyISAM;

--
-- Table structure for table 'locales_target'
--

CREATE TABLE locales_target (
  lid int(11) NOT NULL default '0',
  translation blob NOT NULL,
  locale varchar(12) NOT NULL default '',
  plid int(11) NOT NULL default '0',
  plural int(1) NOT NULL default '0',
  KEY lid (lid),
  KEY lang (locale),
  KEY plid (plid),
  KEY plural (plural)
) TYPE=MyISAM;

--
-- Table structure for table 'menu'
--

CREATE TABLE menu (
  mid int(10) unsigned NOT NULL default '0',
  pid int(10) unsigned NOT NULL default '0',
  path varchar(255) NOT NULL default '',
  title varchar(255) NOT NULL default '',
  description varchar(255) NOT NULL default '',
  weight tinyint(4) NOT NULL default '0',
  type int(2) unsigned NOT NULL default '0',
  PRIMARY KEY  (mid)
) TYPE=MyISAM;

--
-- Table structure for table 'moderation_filters'
--

CREATE TABLE moderation_filters (
  fid int(10) unsigned NOT NULL auto_increment,
  filter varchar(255) NOT NULL default '',
  minimum smallint(6) NOT NULL default '0',
  PRIMARY KEY  (fid)
) TYPE=MyISAM;

--
-- Table structure for table 'moderation_roles'
--

CREATE TABLE moderation_roles (
  rid int(10) unsigned NOT NULL default '0',
  mid int(10) unsigned NOT NULL default '0',
  value tinyint(4) NOT NULL default '0',
  KEY idx_rid (rid),
  KEY idx_mid (mid)
) TYPE=MyISAM;

--
-- Table structure for table 'moderation_votes'
--

CREATE TABLE moderation_votes (
  mid int(10) unsigned NOT NULL auto_increment,
  vote varchar(255) default NULL,
  weight tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (mid)
) TYPE=MyISAM;

--
-- Table structure for table 'node'
--

CREATE TABLE node (
  nid int(10) unsigned NOT NULL auto_increment,
  type varchar(16) NOT NULL default '',
  title varchar(128) NOT NULL default '',
  uid int(10) NOT NULL default '0',
  status int(4) NOT NULL default '1',
  created int(11) NOT NULL default '0',
  changed int(11) NOT NULL default '0',
  comment int(2) NOT NULL default '0',
  promote int(2) NOT NULL default '0',
  moderate int(2) NOT NULL default '0',
  teaser longtext NOT NULL,
  body longtext NOT NULL,
  revisions longtext NOT NULL,
  sticky int(2) NOT NULL default '0',
  format int(4) NOT NULL default '0',
  PRIMARY KEY  (nid),
  KEY node_type (type(4)),
  KEY node_title_type (title,type(4)),
  KEY status (status),
  KEY uid (uid),
  KEY node_moderate (moderate),
  KEY node_promote_status (promote, status),
  KEY node_created (created),
  KEY node_changed (changed),
  KEY node_status_type (status, type, nid)
) TYPE=MyISAM;

--
-- Table structure for table `node_access`
--

CREATE TABLE node_access (
  nid int(10) unsigned NOT NULL default '0',
  gid int(10) unsigned NOT NULL default '0',
  realm varchar(255) NOT NULL default '',
  grant_view tinyint(1) unsigned NOT NULL default '0',
  grant_update tinyint(1) unsigned NOT NULL default '0',
  grant_delete tinyint(1) unsigned NOT NULL default '0',
  PRIMARY KEY  (nid,gid,realm)
) TYPE=MyISAM;

--
-- Table structure for table 'profile_fields'
--

CREATE TABLE profile_fields (
  fid int(10) NOT NULL auto_increment,
  title varchar(255) default NULL,
  name varchar(128) default NULL,
  explanation TEXT default NULL,
  category varchar(255) default NULL,
  page varchar(255) default NULL,
  type varchar(128) default NULL,
  weight tinyint(1) DEFAULT '0' NOT NULL,
  required tinyint(1) DEFAULT '0' NOT NULL,
  register tinyint(1) DEFAULT '0' NOT NULL,
  visibility tinyint(1) DEFAULT '0' NOT NULL,
  options text,
  KEY category (category),
  UNIQUE KEY name (name),
  PRIMARY KEY (fid)
);

--
-- Table structure for table 'profile_values'
--

CREATE TABLE profile_values (
  fid int(11) unsigned default '0',
  uid int(11) unsigned default '0',
  value text,
  KEY uid (uid),
  KEY fid (fid)
);


--
-- Table structure for table 'url_alias'
--

CREATE TABLE url_alias (
  pid int(10) unsigned NOT NULL auto_increment,
  src varchar(128) NOT NULL default '',
  dst varchar(128) NOT NULL default '',
  PRIMARY KEY  (pid),
  UNIQUE KEY dst (dst)
) TYPE=MyISAM;

--
-- Table structure for table 'permission'
--

CREATE TABLE permission (
  rid int(10) unsigned NOT NULL default '0',
  perm longtext,
  tid int(10) unsigned NOT NULL default '0',
  KEY rid (rid)
) TYPE=MyISAM;

--
-- Table structure for table 'poll'
--

CREATE TABLE poll (
  nid int(10) unsigned NOT NULL default '0',
  runtime int(10) NOT NULL default '0',
  voters longtext NOT NULL,
  active int(2) unsigned NOT NULL default '0',
  PRIMARY KEY  (nid)
) TYPE=MyISAM;

--
-- Table structure for table 'poll_choices'

Carl McDade



More information about the drupal-devel mailing list