Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#2161 closed defect (fixed)

[Patch] Trailing blank lines in inital data SQL file break syncdb

Reported by: russellm Owned by: adrian
Component: Core (Management commands) Version:
Severity: normal Keywords: management blank newline
Cc: freakboy@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

If the initial data SQL file for a model has trailing \n's, the sql regex in management.py's get_sql_initial_data_for_model() identifies the trailing \n's as a statement. When syncdb runs this statement (on Postgres - don't know if it affects other databases), it reports a "Failed to install initial SQL" error.

Attachments (1)

blanklines.diff (764 bytes) - added by russellm 10 years ago.
Fixed regex to eliminate blank lines from initial SQL

Download all attachments as: .zip

Change History (3)

comment:1 Changed 10 years ago by russellm

  • Component changed from Core framework to django-admin.py
  • Summary changed from Trailing blank lines in inital data SQL file break syncdb to [Patch] Trailing blank lines in inital data SQL file break syncdb

Added patch to exclude blank lines from initial data SQL statements.

Changed 10 years ago by russellm

Fixed regex to eliminate blank lines from initial SQL

comment:2 Changed 10 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(In [3177]) Fixed #2161 -- handle trailing newlines in initial SQL data. Includes
regression test. Thanks to russellm.

Note: See TracTickets for help on using tickets.
Back to Top