DharmeshPatel33 / elmah

Automatically exported from code.google.com/p/elmah
Apache License 2.0
0 stars 0 forks source link

Field User in table ELMAH_Error breaks ORM mapping #284

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Put ELMAH in your MS-SQL DB (works fine btw)
2. Let NMG (nmg.codeplex.com) create the FluentNhibernate mappings for all 
tables in your MS-SQL DB
3. Try to create your DB on another MS-SQL/PostGre server with nHibernate 
schema export.

What is the expected output? 
All tables of my DB created in the target DB system, or updated to the most 
current version of the schema.

What do you see instead?
Syntax error near user 
(Table ELMAH_Error, field User)

What version of the product are you using? 
On what operating system?
elmah version from december 2011, Windows & Linux

Please provide any additional information below.

You shouldn't name your fields with protected keywords of RDBMS systems. If you 
do, prefix all columns with "ELMA_", so User ==> ELMAH_User, and there will be 
no more such errors.

Also, one could join tables without having to give an alias to every column in 
views (if joined to other tables where 1+ column name(s) collide)...

See here for a little more information:
http://stackoverflow.com/questions/9748237/fluentnhibernate-and-table-column-nam
e-capital-letter-preservation-and-escaping

Original issue reported on code.google.com by noob.mcn...@gmail.com on 17 Mar 2012 at 8:06

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
No Sebastian, that will only work on SQL-Server, which defeats the idea of
an ORM in the first place.
Then comes the next one and says `User` so it works on MySQL, etc.
The "solution" is to tell nhibernate to enable escape names, but that
escapes everything, very bad for postgresql, because then you always have
to match and quote all table and field names, which is not what I want...
SELECT "Field 1", "Field 2", etc... FROM "Elmah_Error" , etc...

Original comment by noob.mcn...@gmail.com on 5 May 2014 at 7:49

GoogleCodeExporter commented 9 years ago
This issue has been migrated to:
https://github.com/elmah/Elmah/issues/284
The conversation continues there.
DO NOT post any further comments to the issue tracker on Google Code as it is 
shutting down.
You can also just subscribe to the issue on GitHub to receive notifications of 
any further development.

Original comment by azizatif on 25 Aug 2015 at 8:22