Bug 161 - EXECUTE SCRIPT fails to execute multi-line commands
Summary: EXECUTE SCRIPT fails to execute multi-line commands
Status: RESOLVED FIXED
Alias: None
Product: Slony-I
Classification: Unclassified
Component: slonik (show other bugs)
Version: devel
Hardware: PC Linux
: low enhancement
Assignee: Slony Bugs List
URL:
Depends on:
Blocks:
 
Reported: 2010-10-28 01:43 UTC by n.byl
Modified: 2011-11-09 08:44 UTC (History)
1 user (show)

See Also:


Attachments
Patch to fix this issue. (3.97 KB, patch)
2010-10-28 01:43 UTC, n.byl
Details
alternate patch for 161 (1.14 KB, patch)
2010-10-28 13:39 UTC, Steve Singer
Details
Patch to DDL script test (527 bytes, patch)
2010-10-28 15:09 UTC, Christopher Browne
Details

Note You need to log in before you can comment on or make changes to this bug.
Description n.byl 2010-10-28 01:43:38 UTC
Created attachment 69 [details]
Patch to fix this issue.

When executing DDL script using the EXECUTE SCRIPT command, multi-line statements are not handled correctly. When a line is longer than subsequent lines, concatenation does not work.

An example statement:

ALTER TABLE customers ADD COLUMN
 description TEXT;

The attached patch fixes the issue on version 1.2.21.
Comment 1 Steve Singer 2010-10-28 13:39:03 UTC
Created attachment 70 [details]
alternate patch for 161

This is an alternate way of fixing the bug.
I think the real issue is that the length passed to memcpy doesn't account for
the terminating null character.

I'm not convinced the other patch will work if the first line is 256 characters long.
Comment 2 Christopher Browne 2010-10-28 15:09:40 UTC
Created attachment 71 [details]
Patch to DDL script test

I added a multiline statement of the appropriate form into the DDL test; it completes fine.

I suspect what we need, instead, is to have a sample DDL statement that is rather a lot longer, e.g.  about 300 bytes long.

Steve's patch seems more general in purpose to me...
Comment 3 Steve Singer 2011-11-09 08:44:01 UTC
Applied to REL_2_1_STABLE and master.  I am not sure why this wasn't committed when a year ago when Chris gave the okay.

http://git.postgresql.org/gitweb/?p=slony1-engine.git;a=commit;h=96a7cad9f90758677273aa9a4e95c9a30062e62e
http://git.postgresql.org/gitweb/?p=slony1-engine.git;a=commit;h=0b6ee7ebcde56ff2f9819341547b9e147f8e1ff1