Jason (squeaky19) wrote in lj_dev,
Jason
squeaky19
lj_dev

Problem with SQL in update-db-general.pl



In the insert command

# global
register_tablecreate("usertrans", <<'EOC');
CREATE TABLE usertrans (
  userid INT UNSIGNED NOT NULL,
  time INT UNSIGNED NOT NULL,
  what VARCHAR(25) NOT NULL,
  before VARCHAR(25) NOT NULL,
  after VARCHAR(25) NOT NULL,
  KEY (userid),
  KEY (time)
)
EOC


I am getting an error when it tries to use "before" as a column name as that is a reserved word. If there is something I need to do to get this table in let me know, but for now running update-db.pl -r -p gives me the following

./update-db.pl -r -p
Updating cluster: 0
# Warning: unknown live table: events
# Warning: unknown live table: userupdate
CREATE TABLE usertrans (
  userid INT UNSIGNED NOT NULL,
  time INT UNSIGNED NOT NULL,
  what VARCHAR(25) NOT NULL,
  before VARCHAR(25) NOT NULL,
  after VARCHAR(25) NOT NULL,
  KEY (userid),
  KEY (time)
);
# Running...
#  ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'before VARCHAR(25) NOT NULL,
  after VARCHAR(25) NOT NULL,
  KEY (userid),
  KEY' at line 5
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 6 comments