← Back to team overview

mudlet-makers team mailing list archive

[Bug 1120939] Re: compound unique/index is causing an Bad index error

 

The issue here was LuaSQL - it's slightly outdated and doesn't support
the new sqlite v2 statements. The effect of this is that table_info
pragma statement, to work out which rows are actually created in the db,
silently fails. db, due to this, cannot work out which rows already
exist as they should and bugs out (not its fault).

I've added a workaround for LuaSQL for now that'll allow your schemas to
be created, here is the output now:

CREATE TABLE people("_row_id" INTEGER PRIMARY KEY AUTOINCREMENT, "notes" TEXT NULL DEFAULT "", 
"faction" TEXT NULL DEFAULT "", "enemy" REAL NULL DEFAULT 0, "name" TEXT NULL DEFAULT "" UNIQUE, 
"_unique" TEXT NULL DEFAULT "")

CREATE UNIQUE INDEX IF NOT EXISTS idx_people_c_name ON people ("name");

COMMIT

CREATE TABLE improves("_row_id" INTEGER PRIMARY KEY AUTOINCREMENT, "who" TEXT NULL DEFAULT "" 
UNIQUE, "skill" TEXT NULL DEFAULT "" UNIQUE, "notes" TEXT NULL DEFAULT "", "count" REAL NULL 
DEFAULT 0, "_unique" TEXT NULL DEFAULT "", "_index" TEXT NULL DEFAULT "")

CREATE UNIQUE INDEX IF NOT EXISTS idx_improves_c_skill_who ON improves
("skill","who");

CREATE INDEX IF NOT EXISTS idx_improves_c_skill_who ON improves
("skill","who");

COMMIT

This fix should be available in Mudlet 2.2

** Changed in: mudlet
       Status: New => Fix Committed

-- 
You received this bug notification because you are a member of Mudlet
Makers, which is subscribed to Mudlet.
https://bugs.launchpad.net/bugs/1120939

Title:
  compound unique/index is causing an Bad index error

Status in Mudlet the MUD client:
  Fix Committed

Bug description:
  this is against Mudlet 2.1 on OSX (Mt Lion)
  local mydb = db:create("dartmud",
  {
      people = {
  		name = "",
  		faction = "",
  		notes = "",
  		enemy = 0,
  		_unique = { "name" }
  	},
  	improves = {
  		skill = "",
  		count = 0,
  		notes = "",
  		who = "",
  		_index = { { "skill", "who" } },
  		_unique = { { "skill", "who" } }
  	}
  })

  causes "Bad index skill" -- the goal is to create improves that ensure
  that values are unique based on skill and who

To manage notifications about this bug go to:
https://bugs.launchpad.net/mudlet/+bug/1120939/+subscriptions


References