Opened 19 years ago

Closed 19 years ago

Last modified 18 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: no UI/UX: no

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 19 years ago.
Fixed regex to eliminate blank lines from initial SQL

Download all attachments as: .zip

Change History (3)

comment:1 by Russell Keith-Magee, 19 years ago

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.

by Russell Keith-Magee, 19 years ago

Attachment: blanklines.diff added

Fixed regex to eliminate blank lines from initial SQL

comment:2 by Malcolm Tredinnick, 19 years ago

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