odiszapc / c5-db-migration

Automatically exported from code.google.com/p/c5-db-migration
0 stars 0 forks source link

Migration fails on postgresql's CREATE TYPE x AS (... syntax #47

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a postgresql migration with the following:
CREATE TYPE imagedata AS (
    imageid integer,
    activity character varying,
    imagecategory character varying,
    path character varying,
    whentaken timestamp with time zone,
    imagecaption character varying
);
2. Migrate

What is the expected output? What do you see instead?
I expect no output, instead I get a failure:
[ERROR] Error executing: CREATE TYPE imagedata AS ( imageid integer, activity 
character varying, imagecategory character varying, path character varying, 
whentaken timestamp with time zone, imagecaption character varying ); ALTER 
TYPE...  

It includes the next statement.

What version of the product are you using? On what operating system?
0.9.9-SNAPSHOT, max os x snow leopard.

Please provide any additional information below.
Line 90 in scriptrunner looks for create and as in a line and uses the 
characters after the "as" as the delimiter.  In this case, it is looking for 
the "(" character to end the statement, which is clearly wrong.

This can be fixed by changing line 90 to this:
                    else if ((command.length() == 0) && startsWithIgnoreCase(line, "create ") && containsIgnoreCase(line, " as ")  && (containsIgnoreCase(line, " type ") != true))

I have attached a patch with tests and source code modification for this issue 
and issue 46.  Sorry about not separating these out, but it makes some sense to 
keep the test resource file together.

Original issue reported on code.google.com by jer...@musicsmith.net on 8 Jul 2011 at 5:10

Attachments: