remove backticks that break Postgres for raw sql in backup create task
Created by: kyledrake
I don't think this will break MySQL, but I haven't tested. If it does, then this fix will have to be slightly better. I didn't have any problems running the script after making this change for PSQL.
Created by: kyledrake
@vsizov I'm extremely confident that it will work just fine in mysql. Here is the one line change: https://github.com/gitlabhq/gitlabhq/pull/2437/files#L0R168
By Administrator on 2013-01-23T18:21:52 (imported from GitLab project)
Created by: Philzen
The ``` sign is just mysql's wrapping sign to allow non-ANSI-table names (i.e. multi-word table name containing spaces or equalling a keyword). Due to lack of an ER-diagramm or such at hand i just checked my own DB (gitlab 4.1), see below.
The table name
keys
is actually a showstopper here: MySql reserved wordsgitlabhq_production=# \d List of relations Schema | Name | Type | Owner --------+---------------------------+----------+-------- public | events | table | gitlab public | events_id_seq | sequence | gitlab public | groups | table | gitlab public | groups_id_seq | sequence | gitlab public | issues | table | gitlab public | issues_id_seq | sequence | gitlab public | keys | table | gitlab public | keys_id_seq | sequence | gitlab public | merge_requests | table | gitlab public | merge_requests_id_seq | sequence | gitlab public | milestones | table | gitlab public | milestones_id_seq | sequence | gitlab public | namespaces | table | gitlab public | namespaces_id_seq | sequence | gitlab public | notes | table | gitlab public | notes_id_seq | sequence | gitlab public | projects | table | gitlab public | projects_id_seq | sequence | gitlab public | protected_branches | table | gitlab public | protected_branches_id_seq | sequence | gitlab public | schema_migrations | table | gitlab public | services | table | gitlab public | services_id_seq | sequence | gitlab public | snippets | table | gitlab public | snippets_id_seq | sequence | gitlab public | taggings | table | gitlab public | taggings_id_seq | sequence | gitlab public | tags | table | gitlab public | tags_id_seq | sequence | gitlab public | users | table | gitlab public | users_id_seq | sequence | gitlab public | users_projects | table | gitlab public | users_projects_id_seq | sequence | gitlab public | web_hooks | table | gitlab public | web_hooks_id_seq | sequence | gitlab public | wikis | table | gitlab public | wikis_id_seq | sequence | gitlab
Sorry i'm a ruby-noob, but if somebody simply could change this code to use an "escape sign" variable and concatenate the SQL from that. That variable needs to be
"
for PostgreSql and ``` for MySql.Cheers - Phil
By Administrator on 2013-01-23T23:17:23 (imported from GitLab project)
Created by: Philzen
Welcome - any progress on this? I reckon if the RoR-DB-Access Wrappers were used here to generate the SQL it will be fine straightaway w/o the need to introduce another if/else in order to set the appropriate table name escaping character.
If somebody doesn't pick this up soon i'll have to learn ruby myself and fix it (which will presumably end up in really awful ruby beginners' code ;) )
By Administrator on 2013-02-25T18:05:49 (imported from GitLab project)