db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-6894) Enhance COLUMNINDEXES parsing for SYSCS_IMPORT_DATA_BULK to recognize columns by name
Date Sat, 16 Jul 2016 02:21:21 GMT

    [ https://issues.apache.org/jira/browse/DERBY-6894?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15380430#comment-15380430
] 

Bryan Pendleton commented on DERBY-6894:
----------------------------------------

I spent some time looking at the behavior of these two test cases in detail:
{code}
        cSt = prepareCall(
            " call SYSCS_UTIL.SYSCS_IMPORT_TABLE_BULK(null, 'PET', 'extinout/petlist.dat',
null, null, null, 0, 0) ");

        assertStatementError("38000", cSt);


        //Skip=2 and non-existent input file
        cSt = prepareCall(
            " call SYSCS_UTIL.SYSCS_IMPORT_TABLE_BULK(null, 'PET', 'extinout/petlist.dat',
null, null, null, 0, 2) ");

        assertStatementError("XJ001", cSt);
{code}

It puzzled me that the two cases returned different SQLState values (38000 vs XJ001).

After a fair amount of study, it seemed to me that the issue was just the detail
of precisely when the error was detect: In the "skip == 2" case, the error is
detected during the construction of the ColumnInfo data structure, while in
the "skip == 0" case the error is detected when we prepareStatement the
INSERT statement we will use to import the data.

So I think this is acceptable behavior, although it sort of seems like it would have
been ideal if both those test cases got the same SQLState, because it seems like
at the root of things, the cause is the same (file not found).

Although the SQLState is different, the exception's message is clear, and the
exception stack trace provides full details for anyone who really needs to
understand what caused their error.

So I have concluded that all is well; I just wanted to document my reasoning in case
anyone looks at this subsequently.

> Enhance COLUMNINDEXES parsing for SYSCS_IMPORT_DATA_BULK to recognize columns by name
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-6894
>                 URL: https://issues.apache.org/jira/browse/DERBY-6894
>             Project: Derby
>          Issue Type: Sub-task
>          Components: SQL
>            Reporter: Bryan Pendleton
>            Assignee: Danoja Dias
>            Priority: Minor
>         Attachments: Derby-6894.diff, NewDerby6894.diff, NewDerby6894_2.diff, NewDerby6894_3.diff,
noHeaderLines.csv, petlist.csv, readHeadersLoadError.diff, repro.java, repro.java
>
>
> To ease maintainability and legibility of client programs, it would be
> nice if callers of SYSCS_IMPORT_DATA_BULK (and possibly also
> SYSCS_IMPORT_DATA) could refer to columns in the COLUMNINDEXES
> argument by column *NAME*, as well as by index *NUMBER*.
> So, for example, a valid COLUMNINDEXES specification might be:
>     '1,3,LastName,FirstName,7'



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message