window is a reserved word in postgresql 8.4+ , but not recognized in postgresql dialect
Window is a reserved keyword in postgresql 8.4+, accoring to http://www.postgresql.org/docs/8.4/static/sql-keywords-appendix.html. And according to http://www.sqlalchemy.org/docs/core/schema.html#sqlalchemy.schema.Column.init columns given a name of a reserved word (if known by the dialect), should be automatically double quoted. But the code below illustrates that at least up to version 0.6.6, window is not known as a reserved word in the postgresql dialect.
import sqlalchemy sqlalchemy.version metadata=sqlalchemy.MetaData() metadata.bind=sqlalchemy.create_engine('postgresql://test:testpw@localhost/postgres') col=sqlalchemy.Column('window',sqlalchemy.Integer) table=sqlalchemy.Table('testtab',metadata,col) table.create()
this raises:
sqlalchemy.exc.ProgrammingError: (ProgrammingError) syntax error at or near "window"
LINE 3: window INTEGER
but metadata.clear() col=sqlalchemy.Column('window',sqlalchemy.Integer,quote=True) table=sqlalchemy.Table('testtab',metadata,col) table.create()
works fine.
Comments (4)
-
Account Deleted -
repo owner - changed milestone to 0.6.7
need to add explcit reserved word list to postgresql/base.py similar to that of mysql/base.py.
-
- changed status to resolved
Added reserved words for postgresql and informix. Added tests. Fixed in #fde2a7f8fe5fd16891ddff99511e2ed3c8eb9ab6
-
repo owner - removed milestone
Removing milestone: 0.6.7 (automated comment)
- Log in to comment
Window is a reserved keyword in postgresql 8.4+, accoring to http://www.postgresql.org/docs/8.4/static/sql-keywords-appendix.html.
And according to http://www.sqlalchemy.org/docs/core/schema.html#sqlalchemy.schema.Column.__init columns given a name of a reserved word (if known by the dialect), should be automatically double quoted. But the code below illustrates that at least up to version 0.6.6, window is not known as a reserved word in the postgresql dialect.
raises:[BR] sqlalchemy.exc.ProgrammingError: (ProgrammingError) syntax error at or near "window"[BR] LINE 3: window INTEGER
But
works fine