I have a legacy PostgreSQL database that has its tables and field names 
created using a case-sensitive means. Whenever I try to do a select(), it 
returns no rows, and an insert() fails. This is the error that web2py gives:

ProgrammingError: relation "globalsettings_id_seq" does not exist
LINE 1: select currval('GlobalSettings_id_Seq')


This is the actual table definition from pgAdmin3:

CREATE TABLE "GlobalSettings"
(
  "settingName" character varying(255) NOT NULL,
  "settingValue" text NOT NULL,
  "settingID" serial NOT NULL,
  CONSTRAINT "GlobalSettings_pkey" PRIMARY KEY ("settingID")
)

Attempting to define my table in web2py using double-quotes between 
single-quotes, like this:

db.define_table('"GlobalSettings"',
    Field('"settingName"', length=255, unique=True),
    Field('"settingValue"', 'text'),
    Field('"settingID"', 'id')
)

results in the following error message: SyntaxError: only [0-9a-zA-Z_] allowed 
in table and field names, received "settingName"

Reply via email to