Menu

#230 ForeignKey gets error with column names that contain "

open
nobody
Postgres (36)
5
2013-01-18
2007-11-02
No

Maybe this is PostgreSQL specific problem. Postgres needs table/column names to be quoted by "" when the name is non-ASCII or when you need to preserve cases.

With such tables/columns SQLObject failes to create constraint because the constraint naming rule simply appends '_exists' after the names.

Say I have a ForeignKey constraint like this;

class Order(SQLObject):
class sqlmeta:
table = '"Order"'
...
store = ForeignKey('Store', dbName='"StoreID"')

This definition generates a wrong SQL like this;

ALTER TABLE "Order" ADD CONSTRAINT "StoreID"_exists FOREIGN ...

It's a simple problem that _exists need to be inside of the quote if original name is quoted by "".

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.