Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #2928 (closed defect: fixed)

Opened 4 years ago

Last modified 2 years ago

[PATCH] Fix for db_schema_dump when table names are the same as SQL keywords

Reported by: keithm@infused.org Assigned to: bitsweat
Priority: normal Milestone:
Component: ActiveRecord Version: edge
Severity: normal Keywords: tiny verified sqlserver
Cc:

Description

If a table name is the same as a SQL keyword, db_schema_dump will fail with an error. If one of the tables is named 'Group' then the following error will be shown:

37000 (156) [Microsoft][ODBC SQL Server Driver]Incorrect syntax near the keywork 'Group'.: EXEC sp_helpindex Group

This patch simply adds single quotes around the table name.

Attachments

quote_table_names_in_sqlserver_adapter.diff (0.7 kB) - added by keithm@infused.org on 11/17/05 23:42:09.

Change History

11/17/05 23:42:09 changed by keithm@infused.org

  • attachment quote_table_names_in_sqlserver_adapter.diff added.

11/18/05 05:21:42 changed by bitsweat

  • status changed from new to closed.
  • resolution set to duplicate.

See #2919.

01/15/07 15:30:21 changed by Jakob S

  • status changed from closed to reopened.
  • version changed from 0.14.3 to edge.
  • resolution deleted.

This is *not* a duplicate of #2919. This is a defect specific to the SQL Server adapter, and it still exists in the current Edge Rails (Active Record revision 5941).

The schema_dumper_test.rb currently fails on SQL Server because of this defect:

1) Failure: test_no_dump_errors(SchemaDumperTest) [schema_dumper_test.rb:48]: </\# Could not dump table/> expected to not match

After applying the attached patch, the schema_dumper_test passes with no failures.

01/18/07 03:52:49 changed by rrich

  • keywords changed from mssql to tiny verified sqlserver.
  • owner changed from David to bitsweat.
  • status changed from reopened to new.

This will resolve one of the SQLServer unit test errors.

01/23/07 04:23:35 changed by bitsweat

  • status changed from new to closed.
  • resolution set to fixed.

(In [6014]) SQLServer: quote table name in indexes query. Closes #2928.

01/23/07 04:25:34 changed by bitsweat

(In [6015]) Merge [6014] from trunk. References #2928.