Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#2161 closed defect (fixed)

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

Reported by: Russell Keith-Magee Owned by: Adrian Holovaty
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 Russell Keith-Magee 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 Russell Keith-Magee

Component: Core frameworkdjango-admin.py
Summary: Trailing blank lines in inital data SQL file break syncdb[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 Russell Keith-Magee

Attachment: blanklines.diff added

Fixed regex to eliminate blank lines from initial SQL

comment:2 Changed 10 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(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