Invalid syntax for PostgreSQL INSERT statements
ximion opened this issue · comments
Hi!
When persisting an entity on PostgreSQL, I get this error:
2018-09-08T21:32:33.011:statement.d:execute:84 INSERT INTO public.users(users.name,users.money,users.email) VALUES('Brian',99.9,'mail@example.com') returning id
hunt.database.exception.DatabaseException@../source/hunt/database/driver/postgresql/connection.d(83): DB SQL : INSERT INTO public.users(users.name,users.money,users.email) VALUES('Brian',99.9,'brian@huntlabs.cn') returning id
DB status : 7
EXECUTE ERROR : 7
ERROR: Column »users« of relation »users« does not exist.
LINE 1: INSERT INTO public.users(users.name,users.money,users.email...
^
The problem is the table prefix before the column name.
A statement like INSERT INTO public.users(name,money,email) VALUES('Brian',99.9,'mail@example.com') returning id
would work.
This is easy to change, but I am not sure about the implications for other databases or JOIN statements in changing this, hence I filed this issue instead of a PR.