db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-1963) Routine parameter names displayed by dblook are not escaped.
Date Tue, 12 Oct 2010 21:42:36 GMT

     [ https://issues.apache.org/jira/browse/DERBY-1963?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Knut Anders Hatlen updated DERBY-1963:
--------------------------------------

    Attachment: d1963.diff

dblook uses the ALIASINFO column in SYS.SYSALIASES to produce the parameter list for procedures
and functions. I found this comment in RoutineAliasInfo.toString():

	/**
	 * Get this alias info as a string.  NOTE: The "ALIASINFO" column
	 * in the SYSALIASES table will return the result of this method
	 * on a ResultSet.getString() call.  That said, since the dblook
	 * utility uses ResultSet.getString() to retrieve ALIASINFO and
	 * to generate the DDL, THIS METHOD MUST RETURN A STRING THAT
	 * IS SYNTACTICALLY VALID, or else the DDL generated by dblook
	 * will be incorrect.
	 */

That method does however not escape the parameter names, and that's also why dblook doesn't.

The attached patch makes RoutineAliasInfo.toString() escape parameter names using IdUtil.normalToDelimited().
It also adds a test case that demonstrates the bug in tools/dblook_test.java. I haven't run
any other tests yet, and there will be other tests that need to be updated because of this
change (at least all the variants of dblook_test, and there may be tests that check the SYSALIASES
table and don't expect the quotes in the ALIASINFO column).

> Routine parameter names displayed by dblook are not escaped.
> ------------------------------------------------------------
>
>                 Key: DERBY-1963
>                 URL: https://issues.apache.org/jira/browse/DERBY-1963
>             Project: Derby
>          Issue Type: Bug
>          Components: Tools
>    Affects Versions: 10.3.1.4
>            Reporter: Daniel John Debrunner
>            Priority: Minor
>         Attachments: d1963.diff
>
>
> After using this SQL to create a function with a delimited parameter name
> CREATE FUNCTION FRED ("paramOne" INTEGER) RETURNS INTEGER
> LANGUAGE JAVA PARAMETER STYLE JAVA 
> EXTERNAL NAME 'fred.foo' 
> dblook will output a CREATE FUNCTION statement with the parameter name without quotes:
> CREATE FUNCTION "APP"."FRED" (paramOne INTEGER) RETURNS INTEGER
> LANGUAGE JAVA PARAMETER STYLE JAVA
> READS SQL DATA CALLED ON NULL INPUT
> EXTERNAL NAME 'fred.foo';
> Using the output from dblook to re-create the function will result in a function with
a different parameter name.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message