Firebird: What to do when a framework uses a reserved word?

Asked

Viewed 58 times

-2

I have a problem creating the database when using Adianti with Firebird 2.1, because the words PASSWORD AND ACTIVE are reserved in Firebird and I can’t set them as an attribute. What can I do to resolve this situation? Remember that by changing the ACTIVE AND PASSWORD fields the table is generated, but the system does not work! The following is the SQL table creation!

CREATE TABLE system_user (
    id INTEGER PRIMARY KEY NOT NULL,
    name varchar(100),
    login varchar(100),
    password varchar(100), <--------------------------- **OS ERROS OCORREM AQUI**
    email varchar(100),
    frontpage_id INTEGER REFERENCES system_program(id),
    system_unit_id INTEGER references system_unit(id),
    active char(1) <----------------------------------- **OS ERROS OCORREM AQUI**
);

  • 2

    The ideal answer would be obvious. Do not use reserved words.

  • 1

    Try quoting the column name, for example "password"

  • I thank everyone for the answers, it helped a lot. This question had a low level, I hope you will forgive me for something. I’m new here at stackoverflow and I’m learning every day. Maybe people got it wrong, but this table system_user is created by the adianti framework. There were reserved words because it was using Firebird 2.1 and if changing the attribute would result in malfunctioning in the Framework. I was suggested to change the framework to adapt to the database (which would be a bit of a hassle), so I abandoned the project and started using Django, because the database would not change.

1 answer

1


the ideal is not to use reserved words, but sometimes there are special situations that we need to use such words.

In these cases you should name the field(column name) between quotation marks "field".

Considering the past example, your SQL would look like this:

CREATE TABLE system_user ( id INTEGER PRIMARY KEY NOT NULL, name varchar(100), login varchar(100), "password" varchar(100), email varchar(100), frontpage_id INTEGER REFERENCES system_program(id), system_unit_id INTEGER references system_unit(id), "active" char(1) );

Any doubt I’m here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.