You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "A B (JIRA)" <de...@db.apache.org> on 2004/12/01 03:11:28 UTC

[jira] Created: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

NPE when creating a trigger on a table and default schema doesn't exist.
------------------------------------------------------------------------

         Key: DERBY-85
         URL: http://nagoya.apache.org/jira/browse/DERBY-85
     Project: Derby
        Type: Bug
    Versions: 10.0.2.0    
    Reporter: A B


BACKGROUND:

When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:

ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';

then the default schema is "SOMEUSER".

PROBLEM:

It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.

REPRO:

In ij:

-- Create database with default schema "SOMEUSER".
ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';

-- Create table t1 in a non-default schema; in this case, call it "ITKO".
ij> create table itko.t1 (i int);
0 rows inserted/updated/deleted

-- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.

-- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
ERROR XJ001: Java exception: ': java.lang.NullPointerException'.

A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...

java.lang.NullPointerException
	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Re: [jira] Created: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Daniel John Debrunner <dj...@debrunners.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Army wrote:

> A B (JIRA) wrote:
>
>> NPE when creating a trigger on a table and default schema doesn't
>> exist.
>> ------------------------------------------------------------------------
>
> [ snip ]
>
>>
>> A look at the derby.log file shows the stack trace given below.  In a
>> word, it looks like the "compilation schema"
>> field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being
>> null.  That causes the NPE in subsequent
>> processing...
>
> [ snip ]
>
> The compilation schema for a trigger is set to "current schema" at the
> time the trigger is created.  In the repro given for this bug, "current
> schema" is (by default) "SOMEUSER",  but since that schema doesn't
> exist, it looks like we end up setting compilation schema to null.
>
> So, which of the following would be the preferred fix?
>
> 1) Force the implicit creation of "current schema" if it doesn't exist,
> and _then_ set compilation schema to "current schema"?
>
> 2) Set "compilation schema" to something other than "current schema" if
> "current schema" doesn't exist?  What would we use, then?
>
> 3) Leave "compilation schema" null, and add logic to check for it and
> behave appropriately?  What exactly "appropriately" means would depend
> on the context...(this seems like a faulty approach, but I thought I'd
> mention it...).
>
> 4) Something else entirely?

I think 3) is correct.

A null compilation schema for a trigger, or any statement after
compilation indicates that the statement had no dependency on the
current schema, that is, there are non-schema qualified identifiers in
the statement's text. This null compilation schema will be used by the
statement cache to allow plan sharing across connections that are in
different schemas.

So in the trigger case it is safe to compile the trigger in any schema
if its stored compilation schema is null, since it has no dependency on
being compiled in a specific schema.

Dan.





-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFBrkFWIv0S4qsbfuQRAl7HAJ9sCT9D++mHci/YL2LtqtTpYP+mVACfaYek
yCUqFUjwN6JOfSqNVzX+3vM=
=eJNM
-----END PGP SIGNATURE-----


Re: [jira] Created: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Army <ar...@golux.com>.
A B (JIRA) wrote:
> NPE when creating a trigger on a table and default schema doesn't exist. 
> ------------------------------------------------------------------------
[ snip ]
> 
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema"
> field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent
> processing...
[ snip ]

The compilation schema for a trigger is set to "current schema" at the time the trigger is created.  In the repro given 
for this bug, "current schema" is (by default) "SOMEUSER",  but since that schema doesn't exist, it looks like we end up 
setting compilation schema to null.

So, which of the following would be the preferred fix?

1) Force the implicit creation of "current schema" if it doesn't exist, and _then_ set compilation schema to "current 
schema"?

2) Set "compilation schema" to something other than "current schema" if "current schema" doesn't exist?  What would we 
use, then?

3) Leave "compilation schema" null, and add logic to check for it and behave appropriately?  What exactly 
"appropriately" means would depend on the context...(this seems like a faulty approach, but I thought I'd mention it...).

4) Something else entirely?

Anyone have any suggestions?
Army

[jira] Assigned: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll reassigned DERBY-85:
-----------------------------------

    Assign To: Dyre Tjeldvoll

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll

>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Kathey Marsden (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12357302 ] 

Kathey Marsden commented on DERBY-85:
-------------------------------------

What is the status of this fix? From the comments it looked like it was pretty close to complete.

Thanks 

Kathey

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85-notabs.diff, derby-85.diff, derby-85.stat, derbyall_report.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Satheesh Bandaram (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12365856 ] 

Satheesh Bandaram commented on DERBY-85:
----------------------------------------

Looks like this patch keeps dropping off the radar... Dyre, why exactly are you adding a new test script with one simple test? Could it be possible to add this test to existing trigger tests? It is possible to get a connection to 'someUser' in the middle of an existing test.

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85.diff, derby-85.stat, derbyall_report.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Attachment: derby-85-notabs.diff

New diff without tabs.

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85-notabs.diff, derby-85.diff, derby-85.stat, derbyall_report.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Attachment:     (was: Bugs.java)

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85.diff, derby-85.stat, derbyall_report.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Rick Hillegas (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12356438 ] 

Rick Hillegas commented on DERBY-85:
------------------------------------

The patch itself looks good. I'm running derbyall now. The patch, however, needs to add a regression test case to one of the language tests to verify that the bug is fixed.

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85-notabs.diff, derby-85.diff, derby-85.stat, derbyall_report.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12313519 ] 

Dyre Tjeldvoll commented on DERBY-85:
-------------------------------------

Full example provided by Mamta Satoor <ms...@gmail.com> in <d9...@mail.gmail.com>:

Actually, in addition to Dan's suggestion of CREATE SCHMEA, you have to next 
do SET SCHEMA, and then you don't need to create a dummy table in the 
schema. To be specific, following eg worked in ij
ij> connect 
'jdbc:derby:c:/dellater/db1;create=true;user=mamta;password=mamta';
ij> create table itko.t1 (i int);
0 rows inserted/updated/deleted
ij> create schema mamta;
0 rows inserted/updated/deleted
ij> set schema mamta;
0 rows inserted/updated/deleted
ij> create trigger itko.trig1 after update on itko.t1 for each row mode 
db2sql select * from sys.systables;
0 rows inserted/updated/deleted
ij> exit;


> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>     Versions: 10.0.2.0
>     Reporter: A B

>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Daniel John Debrunner <dj...@debrunners.com>.
Dyre.Tjeldvoll@Sun.COM wrote:

> "David W. Van Couvering" <Da...@Sun.COM> writes:
> 
> 
>>I got this too, I was pretty sure it was that junit is trying to read 
>>system properties, the first one being "user.dir".  I think it also then 
>>tries to read Junit properties out of the user's home directory?
>>
>>I spent some time trying to modify the test harness to indicate where 
>>the third party jars were to try and fix this, but finally gave up and 
>>turned off security manager for my JUnit test (I was going to log a 
>>separate bug for this, I just didn't think it was worth spending all my 
>>time trying to fix this right now).
> 
> 
> I tried that too, but I could not get it to work. I tried setting
> "noSecurityManager" to true, in all places that I could think of (prop
> file, commnad line, and in the code itself), but I still got the same
> errors.
> 
> After reading section 4.13 in the java/testing/readme.htm file I was
> unsure about whether this property was used in embedded mode.


Yes it is. In section 4.13 by client JVM I meant the JVM where the test
was running and calling the JDBC client directly, either embededded,
derby network client or JCC.

I will try and make that more clear, the formatting seems to have got
confused as well.

I haven't looked though to see how Junit tests are run by the harness
and how they interact with the security manager.

Dan.



Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Dy...@Sun.COM.
"David W. Van Couvering" <Da...@Sun.COM> writes:

> I got this too, I was pretty sure it was that junit is trying to read 
> system properties, the first one being "user.dir".  I think it also then 
> tries to read Junit properties out of the user's home directory?
>
> I spent some time trying to modify the test harness to indicate where 
> the third party jars were to try and fix this, but finally gave up and 
> turned off security manager for my JUnit test (I was going to log a 
> separate bug for this, I just didn't think it was worth spending all my 
> time trying to fix this right now).

I tried that too, but I could not get it to work. I tried setting
"noSecurityManager" to true, in all places that I could think of (prop
file, commnad line, and in the code itself), but I still got the same
errors.

After reading section 4.13 in the java/testing/readme.htm file I was
unsure about whether this property was used in embedded mode.

-- 
dt


Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "David W. Van Couvering" <Da...@Sun.COM>.
I got this too, I was pretty sure it was that junit is trying to read 
system properties, the first one being "user.dir".  I think it also then 
tries to read Junit properties out of the user's home directory?

I spent some time trying to modify the test harness to indicate where 
the third party jars were to try and fix this, but finally gave up and 
turned off security manager for my JUnit test (I was going to log a 
separate bug for this, I just didn't think it was worth spending all my 
time trying to fix this right now).

David

Daniel John Debrunner wrote:
> Dyre.Tjeldvoll@Sun.COM wrote:
> 
>>Daniel John Debrunner <dj...@debrunners.com> writes:
> 
> 
>>>Why do you need to grant permissions to read all files for the
>>>derbyTesting and junit jars?
>>
>>
>>I'm sorry, but I think you need to ask the junit developers about
>>that.  I don't know exactly which files junit wants to access, but the
>>last error I saw (before granting read access to all files), was an
>>access exception because junit was trying to read my home directory to
>>figure out if there was a junit.properties file there, I think. I
>>don't really understand why derbyTesting.jar needs the same access,
>>but I assume it is because the Bugs class (which inherits TestCase)
>>ends up there...
>>
>>I guess it is possible to find the minimal set of file and property
>>rights needed by junit, either by reading the junit source, or through
>>trial and error, but given the comment in the policy file about not
>>trying to make the test harness secure, I didn't think it was worth
>>it...
> 
> 
> Just trying to understand it. Adding broad permissions, in my mind,
> increases the chance of a SecurityManager related bug being hidden.
> 
> I think derbyTesting.jar would need the permission because it is in the
> calling stack of the junit code, and the junit code is not coded to use
> privileged blocks. I don't think it would have anything to do with the
> Bugs class, but what do you mean by it "ends up there"? Is junit copying
> classes out of derbyTesting.jar?
> 
> Dan.
> 
> 
> 
>>
>>>Why not just all files under the user.dir?
>>>
>>>
>>>Dan.
>>>
>>>
>>
>>
> 
> 

Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Dy...@Sun.COM.
Daniel John Debrunner <dj...@debrunners.com> writes:

> Dyre.Tjeldvoll@Sun.COM wrote:
>> Daniel John Debrunner <dj...@debrunners.com> writes:
>
>>>Why do you need to grant permissions to read all files for the
>>>derbyTesting and junit jars?
>> 
>> 
>> I'm sorry, but I think you need to ask the junit developers about
>> that.  I don't know exactly which files junit wants to access, but the
>> last error I saw (before granting read access to all files), was an
>> access exception because junit was trying to read my home directory to
>> figure out if there was a junit.properties file there, I think. I
>> don't really understand why derbyTesting.jar needs the same access,
>> but I assume it is because the Bugs class (which inherits TestCase)
>> ends up there...
>> 
>> I guess it is possible to find the minimal set of file and property
>> rights needed by junit, either by reading the junit source, or through
>> trial and error, but given the comment in the policy file about not
>> trying to make the test harness secure, I didn't think it was worth
>> it...
>
> Just trying to understand it. Adding broad permissions, in my mind,
> increases the chance of a SecurityManager related bug being hidden.
>
> I think derbyTesting.jar would need the permission because it is in the
> calling stack of the junit code, and the junit code is not coded to use
> privileged blocks. I don't think it would have anything to do with the
> Bugs class, but what do you mean by it "ends up there"? Is junit copying
> classes out of derbyTesting.jar?

No, I only meant that the .class file resulting from compiling
junitTests/lang/Bugs.java is put into derbyTesting.jar when you build
derby:

jar -tf ~/derby-85_sane_jars/derbyTesting.jar | egrep Bugs
org/apache/derbyTesting/functionTests/tests/junitTests/lang/Bugs.class

This happened automatically when I added the new file, without
changing any build.xml files, (but I had to modify a build.xml file to
get the property file added to the jar file).

And since the Bugs class inherits from TestCase I thought maybe it
pulled some Junit code with it into derbyTesting.jar... But maybe
that's just me thinking in C++ again. In Java I guess you resolve all
references to the parent class(es) at runtime...? 

-- 
dt


Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Daniel John Debrunner <dj...@debrunners.com>.
Dyre.Tjeldvoll@Sun.COM wrote:
> Daniel John Debrunner <dj...@debrunners.com> writes:

>>Why do you need to grant permissions to read all files for the
>>derbyTesting and junit jars?
> 
> 
> I'm sorry, but I think you need to ask the junit developers about
> that.  I don't know exactly which files junit wants to access, but the
> last error I saw (before granting read access to all files), was an
> access exception because junit was trying to read my home directory to
> figure out if there was a junit.properties file there, I think. I
> don't really understand why derbyTesting.jar needs the same access,
> but I assume it is because the Bugs class (which inherits TestCase)
> ends up there...
> 
> I guess it is possible to find the minimal set of file and property
> rights needed by junit, either by reading the junit source, or through
> trial and error, but given the comment in the policy file about not
> trying to make the test harness secure, I didn't think it was worth
> it...

Just trying to understand it. Adding broad permissions, in my mind,
increases the chance of a SecurityManager related bug being hidden.

I think derbyTesting.jar would need the permission because it is in the
calling stack of the junit code, and the junit code is not coded to use
privileged blocks. I don't think it would have anything to do with the
Bugs class, but what do you mean by it "ends up there"? Is junit copying
classes out of derbyTesting.jar?

Dan.


> 
> 
>>Why not just all files under the user.dir?
>>
>>
>>Dan.
>>
>>
> 
> 



Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by scott hutinger <S-...@wiu.edu>.
I think the properties file stuff needs re-written in the JVM.  It's not 
very user friendly! :-)  But, I don't have any better suggestions.  I 
was messing around with that for a while, and gave up in disgust.  One 
can't control it's search from my limited experience.  So I don't think 
it's the junit team :-)

just my thoughts on how the properties stuff works.

scott

Dyre.Tjeldvoll@Sun.COM wrote:
> Daniel John Debrunner <dj...@debrunners.com> writes:
>
>   
>> Dyre Tjeldvoll (JIRA) wrote:
>>
>>     
>>>      [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]
>>>
>>> Dyre Tjeldvoll updated DERBY-85:
>>> --------------------------------
>>>
>>>     Attachment: derby-85.diff
>>>                 derby-85.stat
>>>                 derbyall_report.txt
>>>
>>> New patch with Junit test case.
>>>
>>> Note that I had to modify the SecurityManager policy to grant more privileges to  derbyTesting.jar and junit.jar
>>> Anyone interested SecurityManager issues may want to review those changes carefully.
>>>       
>> Why do you need to grant permissions to read all files for the
>> derbyTesting and junit jars?
>>     
>
> I'm sorry, but I think you need to ask the junit developers about
> that.  I don't know exactly which files junit wants to access, but the
> last error I saw (before granting read access to all files), was an
> access exception because junit was trying to read my home directory to
> figure out if there was a junit.properties file there, I think. I
> don't really understand why derbyTesting.jar needs the same access,
> but I assume it is because the Bugs class (which inherits TestCase)
> ends up there...
>
> I guess it is possible to find the minimal set of file and property
> rights needed by junit, either by reading the junit source, or through
> trial and error, but given the comment in the policy file about not
> trying to make the test harness secure, I didn't think it was worth
> it...
>
>   
>> Why not just all files under the user.dir?
>>
>>
>> Dan.
>>
>>
>>     
>
>   


Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Dy...@Sun.COM.
Daniel John Debrunner <dj...@debrunners.com> writes:

> Dyre Tjeldvoll (JIRA) wrote:
>
>>      [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]
>> 
>> Dyre Tjeldvoll updated DERBY-85:
>> --------------------------------
>> 
>>     Attachment: derby-85.diff
>>                 derby-85.stat
>>                 derbyall_report.txt
>> 
>> New patch with Junit test case.
>> 
>> Note that I had to modify the SecurityManager policy to grant more privileges to  derbyTesting.jar and junit.jar
>> Anyone interested SecurityManager issues may want to review those changes carefully.
>
>
> Why do you need to grant permissions to read all files for the
> derbyTesting and junit jars?

I'm sorry, but I think you need to ask the junit developers about
that.  I don't know exactly which files junit wants to access, but the
last error I saw (before granting read access to all files), was an
access exception because junit was trying to read my home directory to
figure out if there was a junit.properties file there, I think. I
don't really understand why derbyTesting.jar needs the same access,
but I assume it is because the Bugs class (which inherits TestCase)
ends up there...

I guess it is possible to find the minimal set of file and property
rights needed by junit, either by reading the junit source, or through
trial and error, but given the comment in the policy file about not
trying to make the test harness secure, I didn't think it was worth
it...

>
> Why not just all files under the user.dir?
>
>
> Dan.
>
>

-- 
dt

However, experience shows that for many people and many applications a
dose of paranoia is reasonable - Bjarne Stroustrup


Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Daniel John Debrunner <dj...@debrunners.com>.
Dyre Tjeldvoll (JIRA) wrote:

>      [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]
> 
> Dyre Tjeldvoll updated DERBY-85:
> --------------------------------
> 
>     Attachment: derby-85.diff
>                 derby-85.stat
>                 derbyall_report.txt
> 
> New patch with Junit test case.
> 
> Note that I had to modify the SecurityManager policy to grant more privileges to  derbyTesting.jar and junit.jar
> Anyone interested SecurityManager issues may want to review those changes carefully.


Why do you need to grant permissions to read all files for the
derbyTesting and junit jars?

Why not just all files under the user.dir?


Dan.



[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Attachment: derby-85.diff
                derby-85.stat
                derbyall_report.txt

New patch with Junit test case.

Note that I had to modify the SecurityManager policy to grant more privileges to  derbyTesting.jar and junit.jar
Anyone interested SecurityManager issues may want to review those changes carefully.

Also note that the current patch does NOT use DDLConstantAction.getSchemaDescriptorForCreate() , but accesses the dictionary directly. This works fine because the trigger is NOT created in this schema. You ONLY need the oid of the default schema to fill in a column in the SYSSTATEMENTS table, (described in more detail in earlier comments).

lang/closed.java failed when I ran derbyall, but I don't think this is related to the patch (see DERBY-734).

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: Bugs.java, derby-85.diff, derby-85.stat, derbyall_report.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12312886 ] 

Dyre Tjeldvoll commented on DERBY-85:
-------------------------------------

Looks like the oid for the default schema is null until a row is
inserted in a table in the default schema. This oid is referenced when
creating a trigger, even if that trigger doesn't touch the default schema.

One can work around it by having a non-empty table in the default
schema:

s.execute("create table itko.t1 (i int)");

// Workaround   
s.execute("create table def (i int)");
s.execute("insert into def values (0), (1), (2)");

s.execute("create trigger ikto.trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables");

I THINK that when creating a trigger, the code needs a "compile schema" and it
assumes that it is safe to use the default schema, which it isn't in
this case.

So I guess you could attack this problem in (at least) two ways: 
1) Make the trigger code use a schema that is known to be ok
2) Ensure that the default schema always is valid.

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>     Versions: 10.0.2.0
>     Reporter: A B

>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Attachment:     (was: derby-85.diff)

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85-notabs.diff
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Satheesh Bandaram (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12376858 ] 

Satheesh Bandaram commented on DERBY-85:
----------------------------------------

I think it would be great to port this fix to 10.1 branch. I have seen some users hit this problem. Dyre, do you happen to have itch to port this to 10.1?

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug

>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>      Fix For: 10.2.0.0
>  Attachments: derby-85.diff, derby-85.stat, derby-85_2.diff, derby-85_2.stat, derbyall_report.txt, derbyall_report_2.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: [jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi Dyre,

I agree that writing the new test under JUnit would be a great idea. It 
would be great if your test extended DerbyJUnitTest and if you beefed up 
this class with any utility methods you need which you think other test 
writers might appreciate. This might be a good time to create a 
junitTests/lang/Bugs.java JUnit test where we can all hang test cases 
for language bugs.

Thanks,
-Rick

Kathey Marsden wrote:

>Dyre Tjeldvoll (JIRA) wrote:
>
>  
>
>>If am supposed to create a regression test for this; is there any chance that I can do that as JUnit test? 
>>
>>    
>>
>Junit sounds great to me. I think Rick set up the framework for running
>Junit tests under derbyall and could perhaps offer some quick tips. (I
>think this would make a great Wiki  page).  I became interested in your
>fix because we were recently approached by someone teaching a class who
>wanted to use Derby but  hit this and was ready to switch to another DB
>until they found out there was a  workaround.     Your fix will be very
>valuable  because even though there is an easy  workaround,  this bug is
>something that perhaps folks are most likely to hit when migrating to
>Derby and they might become discouraged by it.
>
>Thanks
>
>Kathey
>
>
>  
>


Re: [jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Kathey Marsden <km...@sbcglobal.net>.
Dyre Tjeldvoll (JIRA) wrote:

>If am supposed to create a regression test for this; is there any chance that I can do that as JUnit test? 
>
Junit sounds great to me. I think Rick set up the framework for running
Junit tests under derbyall and could perhaps offer some quick tips. (I
think this would make a great Wiki  page).  I became interested in your
fix because we were recently approached by someone teaching a class who
wanted to use Derby but  hit this and was ready to switch to another DB
until they found out there was a  workaround.     Your fix will be very
valuable  because even though there is an easy  workaround,  this bug is
something that perhaps folks are most likely to hit when migrating to
Derby and they might become discouraged by it.

Thanks

Kathey



[jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12357788 ] 

Dyre Tjeldvoll commented on DERBY-85:
-------------------------------------

Status? If you look at the dates you'll see that I have not looked at this for about 5 months, so I don't really know. I'm actually surprised that Rick was able to apply the patch without problems. 

If am supposed to create a regression test for this; is there any chance that I can do that as JUnit test? And, can someone please comment on my question from 21 June? About which method to use to obtain a schema descriptor?

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85-notabs.diff, derby-85.diff, derby-85.stat, derbyall_report.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]
     
Dyre Tjeldvoll resolved DERBY-85:
---------------------------------

    Fix Version: 10.2.0.0
     Resolution: Fixed

Committed by Sateesh Bandaram

Sending        java\engine\org\apache\derby\impl\sql\execute\CreateTriggerConstantAction.java
Sending        java\testing\org\apache\derbyTesting\functionTests\master\triggerGeneral.out
Sending        java\testing\org\apache\derbyTesting\functionTests\tests\lang\triggerGeneral.sql
Transmitting file data ...
Committed revision 378109.

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>      Fix For: 10.2.0.0
>  Attachments: derby-85.diff, derby-85.stat, derby-85_2.diff, derby-85_2.stat, derbyall_report.txt, derbyall_report_2.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Attachment:     (was: derbyall_report.txt)

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll

>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Other Info: [Patch available]

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85.diff, derby-85.stat, derbyall_report.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]
     
Dyre Tjeldvoll closed DERBY-85:
-------------------------------


Verified

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>      Fix For: 10.2.0.0
>  Attachments: derby-85.diff, derby-85.stat, derby-85_2.diff, derby-85_2.stat, derbyall_report.txt, derbyall_report_2.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Fix Version: 10.1.3.0
                 10.1.2.4

Setting fixin for merge to 10.1.3

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug

>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>      Fix For: 10.2.0.0, 10.1.3.0, 10.1.2.4
>  Attachments: derby-85.diff, derby-85.stat, derby-85_2.diff, derby-85_2.stat, derbyall_report.txt, derbyall_report_2.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Attachment:     (was: derby-85.stat)

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85-notabs.diff
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: [jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "David W. Van Couvering" <Da...@Sun.COM>.
You should be able to tell by looking what suites it is in.  If it's not 
in derbynetclientmats then it may very well not be able to run with the 
network client.

I too wish all our tests ran with the network client, but we're just not 
there yet.  Maybe someone can do a scan through the tests to see if some 
*could* be added but just haven't yet.

David

Dyre.Tjeldvoll@Sun.COM wrote:
>>>>>>"KAH" == Knut Anders Hatlen <Kn...@Sun.COM> writes:
> 
> 
>     KAH> See jdbcapi/users.sql for an example. It seems like you can skip
>     KAH> "jdbc:derby:" from the connection url.
> 
>     KAH> connect 'wombat;shutdown=true;user=francois;password=paceesalute';
>     KAH> connect 'myDB;create=true;user=dan;password=MakeItFaster';
> 
> Hmm, I just discovered, to my surprise and disappointment, that I
> am unable to test that this actually works, because
> lang/triggerGeneral.sql does not run under DerbyNet or DerbyNetClient.
> 
> Why is that? I assumed, in my naivete, that tests should run in
> all three frameworks, unless the test is testing something that is specific
> to a particular framework... 
> 
> Is there a way to know if a particular test is only intended for one,
> or some frameworks? Other than running it in that framework and seeing
> that it fails...? I guess could always run 
> find java/testing -name <testname>.out 
> and see how many master files the test has. Will that work, or is the output
> compared to a default master if there isn't one for that framework? 
> 

Re: [jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Dy...@Sun.COM.
>>>>> "SB" == Satheesh Bandaram <sa...@Sourcery.Org> writes:

    SB> Dyre.Tjeldvoll@Sun.COM wrote:

    SB>                         "KAH" == Knut Anders Hatlen <Kn...@Sun.COM> writes:

    SB>     Hmm, I just discovered, to my surprise and disappointment, that I
    SB>     am unable to test that this actually works, because
    SB>     lang/triggerGeneral.sql does not run under DerbyNet or DerbyNetClient.
    
    SB>     Why is that? I assumed, in my naivete, that tests should run in
    SB>     all three frameworks, unless the test is testing something that is specific
    SB>     to a particular framework... 

    SB> This is the general rule... For tests that verify pure SQL
    SB> behavior, the framework shouldn't matter. Many of the
    SB> derbyLang tests are meant to test just SQL behavior, so many
    SB> just run in embedded framework only. Running these tests in
    SB> other frameworks might generate different outputs so may have
    SB> to generate different masters. Is there a reason why you would
    SB> like your new test to run in all frameworks?

Not really. I just wanted to verify that the
specify-part-of-the-connection-url trick gave me a new and
valid connection even in a different framework.

    SB> It seems the behavior is likely to be the same if you
    SB> specify a userName in the URL.

I would hope so.

    SB> Looking at 'suites' directory is one way. You could also
    SB> invoke the tests without actually running them and then see if
    SB> your test gets picked up in the framework of your
    SB> interest. RunTest has listOnly option.

Sure, that would work. My problem was that after modifying
triggerGeneral.sql I ran it in embedded, and then in DerbyNet and
DerbyNetClient. It worked fine in embedded but failed with in the two
other frameworks. If I had looked at the suites I would have found out
that this particular test is not run with those frameworks. But I
still wasn't sure if the failure was caused by the change that I made, or
if it would have failed anyway. 

When running the test I only saw the last part of the diff in my
terminal window. And there I saw the text that I had just added
to the test script, so naturally I assumed that I had broken something.

As it happens I hadn't, but if the test actually had been working in
all frameowks before (even if it wasn't mentioned in the Net-suites),
I would not want to be the one who broke it. That's reasonable isn't
it?  Or am I just being paranoid? :)

-- 
dt


Re: [jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Dy...@Sun.COM.
>>>>> "KAH" == Knut Anders Hatlen <Kn...@Sun.COM> writes:

    KAH> See jdbcapi/users.sql for an example. It seems like you can skip
    KAH> "jdbc:derby:" from the connection url.

    KAH> connect 'wombat;shutdown=true;user=francois;password=paceesalute';
    KAH> connect 'myDB;create=true;user=dan;password=MakeItFaster';

Hmm, I just discovered, to my surprise and disappointment, that I
am unable to test that this actually works, because
lang/triggerGeneral.sql does not run under DerbyNet or DerbyNetClient.

Why is that? I assumed, in my naivete, that tests should run in
all three frameworks, unless the test is testing something that is specific
to a particular framework... 

Is there a way to know if a particular test is only intended for one,
or some frameworks? Other than running it in that framework and seeing
that it fails...? I guess could always run 
find java/testing -name <testname>.out 
and see how many master files the test has. Will that work, or is the output
compared to a default master if there isn't one for that framework? 

-- 
dt


Re: using multiple connections in an IJ test script (was DERBY-85)

Posted by Mamta Satoor <ms...@gmail.com>.
Hi Bryan,

My only suggestion would be to may be change the heading of the tip
page. Currently, it says MultiConnectionTip.

Thanks,
Mamta


On 2/12/06, Dyre.Tjeldvoll@sun.com <Dy...@sun.com> wrote:
>
> >>>>> "BP" == Bryan Pendleton <bp...@amberpoint.com> writes:
>
>    KAH> See jdbcapi/users.sql for an example. It seems like you can skip
>    KAH> "jdbc:derby:" from the connection url.
>
>    BP> I added this tip to the Wiki as:
>    BP> http://wiki.apache.org/db-derby/MultiConnectionTip
>
> Great! Thanks for putting this in Bryan!
>
>    BP> I think I got the essence of it, but I may have missed out some of
>    BP> the details. Please give it a quick read and fix any errors.
>
> Looks good to me :)
>
> --
> dt
>
>

Re: using multiple connections in an IJ test script (was DERBY-85)

Posted by Dy...@Sun.COM.
>>>>> "BP" == Bryan Pendleton <bp...@amberpoint.com> writes:

    KAH> See jdbcapi/users.sql for an example. It seems like you can skip
    KAH> "jdbc:derby:" from the connection url.

    BP> I added this tip to the Wiki as:
    BP> http://wiki.apache.org/db-derby/MultiConnectionTip

Great! Thanks for putting this in Bryan! 

    BP> I think I got the essence of it, but I may have missed out some of
    BP> the details. Please give it a quick read and fix any errors.

Looks good to me :)

-- 
dt


Re: using multiple connections in an IJ test script (was DERBY-85)

Posted by Bryan Pendleton <bp...@amberpoint.com>.
>     KAH> See jdbcapi/users.sql for an example. It seems like you can skip
>     KAH> "jdbc:derby:" from the connection url.

I added this tip to the Wiki as:
http://wiki.apache.org/db-derby/MultiConnectionTip

I think I got the essence of it, but I may have missed out some of
the details. Please give it a quick read and fix any errors.

thanks,

bryan



Re: [jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Dy...@Sun.COM.
>>>>> "KAH" == Knut Anders Hatlen <Kn...@Sun.COM> writes:
    >> But I still don't see how this can be used inside a test script,
    >> though. In the test scripts I have seen, the connection has already
    >> been established by the test harness. I suppose I could open a
    >> connection to a hard-coded URL inside the script, but how do you make
    >> that work with different frameworks? Is the connection URL available
    >> as some kind of variable or property that can be accessed in the ij-script?

    KAH> See jdbcapi/users.sql for an example. It seems like you can skip
    KAH> "jdbc:derby:" from the connection url.

    KAH> connect 'wombat;shutdown=true;user=francois;password=paceesalute';
    KAH> connect 'myDB;create=true;user=dan;password=MakeItFaster';

     Great, thanks, Knut-Anders! (again)

-- 
dt


Re: [jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
Dyre.Tjeldvoll@Sun.COM writes:

>>>>>> "KAH" == Knut Anders Hatlen <Kn...@Sun.COM> writes:
>     KAH> So you have never typed help in ij? ;)
>
> No I haven't.
>
>     ij> connect 'jdbc:derby:/tmp/mydb';
>     ij> show connections;
>     KAH> CONNECTION0* - 	jdbc:derby:/tmp/mydb
>     KAH> * = current connection
>     ij> connect 'jdbc:derby:/tmp/mydb';
>     KAH> ij(CONNECTION1)> show connections;
>     KAH> CONNECTION0 - 	jdbc:derby:/tmp/mydb
>     KAH> CONNECTION1* - 	jdbc:derby:/tmp/mydb
>     KAH> * = current connection
>     KAH> ij(CONNECTION1)> set connection connection0;
>     KAH> ij(CONNECTION0)> set connection connection1;
>     KAH> ij(CONNECTION1)> 
>
> Great, thanks, Knut-Anders! 
>
> But I still don't see how this can be used inside a test script,
> though. In the test scripts I have seen, the connection has already
> been established by the test harness. I suppose I could open a
> connection to a hard-coded URL inside the script, but how do you make
> that work with different frameworks? Is the connection URL available
> as some kind of variable or property that can be accessed in the ij-script?

See jdbcapi/users.sql for an example. It seems like you can skip
"jdbc:derby:" from the connection url.

connect 'wombat;shutdown=true;user=francois;password=paceesalute';
connect 'myDB;create=true;user=dan;password=MakeItFaster';

-- 
Knut Anders


Re: [jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Dy...@Sun.COM.
>>>>> "KAH" == Knut Anders Hatlen <Kn...@Sun.COM> writes:
    KAH> So you have never typed help in ij? ;)

No I haven't.

    ij> connect 'jdbc:derby:/tmp/mydb';
    ij> show connections;
    KAH> CONNECTION0* - 	jdbc:derby:/tmp/mydb
    KAH> * = current connection
    ij> connect 'jdbc:derby:/tmp/mydb';
    KAH> ij(CONNECTION1)> show connections;
    KAH> CONNECTION0 - 	jdbc:derby:/tmp/mydb
    KAH> CONNECTION1* - 	jdbc:derby:/tmp/mydb
    KAH> * = current connection
    KAH> ij(CONNECTION1)> set connection connection0;
    KAH> ij(CONNECTION0)> set connection connection1;
    KAH> ij(CONNECTION1)> 

Great, thanks, Knut-Anders! 

But I still don't see how this can be used inside a test script,
though. In the test scripts I have seen, the connection has already
been established by the test harness. I suppose I could open a
connection to a hard-coded URL inside the script, but how do you make
that work with different frameworks? Is the connection URL available
as some kind of variable or property that can be accessed in the ij-script?

-- 
dt


Re: [jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
"Dyre Tjeldvoll (JIRA)" <de...@db.apache.org> writes:

>     [ http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12365868 ] 
>
> Dyre Tjeldvoll commented on DERBY-85:
> -------------------------------------
>
> Hi Sateesh, thank you so much for taking the time to look at the
> patch! Is it really possible to get a different connection inside an
> ij-script? Wow, I did not know that, how do you do that? Do you have
> an example? 

So you have never typed help in ij? ;)

ij> connect 'jdbc:derby:/tmp/mydb';
ij> show connections;
CONNECTION0* - 	jdbc:derby:/tmp/mydb
* = current connection
ij> connect 'jdbc:derby:/tmp/mydb';
ij(CONNECTION1)> show connections;
CONNECTION0 - 	jdbc:derby:/tmp/mydb
CONNECTION1* - 	jdbc:derby:/tmp/mydb
* = current connection
ij(CONNECTION1)> set connection connection0;
ij(CONNECTION0)> set connection connection1;
ij(CONNECTION1)> 

-- 
Knut Anders


[jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12365868 ] 

Dyre Tjeldvoll commented on DERBY-85:
-------------------------------------

Hi Sateesh, thank you so much for taking the time to look at the patch! Is it really possible to get a different connection inside an ij-script? Wow, I did not know that, how do you do that? Do you have an example? 

Which test script should this go into? I find the following trigger-related test scripts in the lang directory:

triggerBeforeTrig.sql              triggerRefClause.sql
triggerGeneral.sql                 triggerRefClause_app.properties
triggerGeneral_app.properties      triggerStream.java
triggerGeneral_derby.properties    triggerStream_app.properties
triggerRecursion.sql               triggerStream_derby.properties
triggerRecursion_derby.properties

My money would be on trggerGeneral.sql, but since the "common sense" approach keeps letting me down, I thought I had better ask :)


> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85.diff, derby-85.stat, derbyall_report.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Attachment: derbyall_report.merge-to-10.1.txt

svn merge -r 378108:378109 trunk 10.1@397791M was clean

Ran derbyall after the merge with 3 failures, which I don't think are related (see attached report file for details).


> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug

>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>      Fix For: 10.2.0.0, 10.1.3.0, 10.1.2.4
>  Attachments: derby-85.diff, derby-85.stat, derby-85_2.diff, derby-85_2.stat, derbyall_report.merge-to-10.1.txt, derbyall_report.txt, derbyall_report_2.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Attachment: derby-85.stat
                derby-85.diff
                derbyall_report.txt

New patch based on the latest trunk. The patch is as before, but the test case is now a simple ij-test, that does not cause any SecurityManager problems. Hopefully this issue can be committed soon, (if I scratch this itch any more I'm going to get gangrene).

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85.diff, derby-85.stat, derbyall_report.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12313518 ] 

Dyre Tjeldvoll commented on DERBY-85:
-------------------------------------

Simpler workaround provided by Daniel John Debrunner <dj...@debrunners.com> in <42...@debrunners.com>:
Or simpler, just create the schema using CREATE SCHEMA.
 
CREATE SCHEMA user
SET SCHEMA user

CREATE TRIGGER...

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>     Versions: 10.0.2.0
>     Reporter: A B

>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Andrew McIntyre (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]
     
Andrew McIntyre resolved DERBY-85:
----------------------------------

    Resolution: Fixed

Committed to 10.1 branch with revision 398036.

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug

>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>      Fix For: 10.2.0.0, 10.1.3.0, 10.1.2.4
>  Attachments: derby-85.diff, derby-85.stat, derby-85_2.diff, derby-85_2.stat, derbyall_report.merge-to-10.1.txt, derbyall_report.txt, derbyall_report_2.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Reopened: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]
     
Dyre Tjeldvoll reopened DERBY-85:
---------------------------------


> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug

>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>      Fix For: 10.2.0.0
>  Attachments: derby-85.diff, derby-85.stat, derby-85_2.diff, derby-85_2.stat, derbyall_report.txt, derbyall_report_2.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Attachment:     (was: derbyall_report.txt)

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85-notabs.diff, derby-85.diff, derby-85.stat
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Mike Matrigali (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Mike Matrigali updated DERBY-85:
--------------------------------

      Component: SQL
    Description: 
BACKGROUND:

When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:

ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';

then the default schema is "SOMEUSER".

PROBLEM:

It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.

REPRO:

In ij:

-- Create database with default schema "SOMEUSER".
ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';

-- Create table t1 in a non-default schema; in this case, call it "ITKO".
ij> create table itko.t1 (i int);
0 rows inserted/updated/deleted

-- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.

-- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
ERROR XJ001: Java exception: ': java.lang.NullPointerException'.

A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...

java.lang.NullPointerException
	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
	at org.apache.derby.tools.ij.main(ij.java:60)

  was:
BACKGROUND:

When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:

ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';

then the default schema is "SOMEUSER".

PROBLEM:

It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.

REPRO:

In ij:

-- Create database with default schema "SOMEUSER".
ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';

-- Create table t1 in a non-default schema; in this case, call it "ITKO".
ij> create table itko.t1 (i int);
0 rows inserted/updated/deleted

-- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.

-- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
ERROR XJ001: Java exception: ': java.lang.NullPointerException'.

A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...

java.lang.NullPointerException
	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
	at org.apache.derby.tools.ij.main(ij.java:60)

    Environment: 

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85-notabs.diff, derby-85.diff, derby-85.stat, derbyall_report.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12313599 ] 

Dyre Tjeldvoll commented on DERBY-85:
-------------------------------------

The javadoc for the CreateTriggerConstantAction constructor seems to confirm that the default schema is used if no other compile schema is provided:

spsCompSchemaId - the compilation schema for the action and when spses. If null, will be set to the current default schema

The code confirms this:

		return	getGenericConstantActionFactory().getCreateTriggerConstantAction(
											triggerSchemaDescriptor.getSchemaName(),
											getRelativeName(),
											triggerEventMask,
											isBefore,
											isRow,
											isEnabled,
											triggerTableDescriptor,	
											(UUID)null,			// when SPSID
											whenText,
											(UUID)null,			// action SPSid 
											actionText,
											(actionCompSchemaId == null) ?
												compSchemaDescriptor.getUUID() :
												actionCompSchemaId,
											(Timestamp)null,	// creation time
											referencedColInts,
								
I tried to add:
		if (SanityManager.DEBUG) {
		    SanityManager.ASSERT((actionCompSchemaId != null ||
					  compSchemaDescriptor.getUUID()!=
					  null),
					 "No valid compile schema");
		}

		return	getGenericConstantActionFactory().getCreateTriggerConstantAction(...

and this shows that both are null in this case:

dt136804@atum10~/java$ run-app.sh Try
Try starting in embedded mode.
TRACE: Class.forName(driver).newInstance();  @Try.java.m4:89
TRACE: conn = DriverManager.getConnection(protocol + db + ";create=true", props);  @Try.java.m4:105
TRACE: conn.setAutoCommit(false);  @Try.java.m4:107
TRACE: Statement s = conn.createStatement();  @Try.java.m4:113
s=org.apache.derby.impl.jdbc.EmbedStatement@126e85f @Try.java.m4:114
conn=0 @Try.java.m4:115
TRACE: s.execute("create table itko.t1 (i int)");  @Try.java.m4:121
TRACE: s.execute("create schema USER1");  @Try.java.m4:122
TRACE: s.execute("create trigger ikto.trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables");  @Try.java.m4:128
exception thrown:
SQL Exception: Java exception: 'ASSERT FAILED No valid compile schema: org.apache.derby.iapi.services.sanity.AssertFailure'.
SQLState: XJ001 MessageId: XJ001.U
org.apache.derby.iapi.services.sanity.AssertFailure: ASSERT FAILED No valid compile schema
        at org.apache.derby.iapi.services.sanity.SanityManager.ASSERT(SanityManager.java:121)
        at org.apache.derby.impl.sql.compile.CreateTriggerNode.makeConstantAction(CreateTriggerNode.java:728)
        at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:459)
        at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:107)
        at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:688)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:501)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:475)
        at Try.go(Try.java:128)
        at Try.main(Try.java:73)
null
Try finished


> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>     Versions: 10.0.2.0
>     Reporter: A B

>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Satheesh Bandaram (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12366556 ] 

Satheesh Bandaram commented on DERBY-85:
----------------------------------------

Thanks for addressing review comments. I have submitted this fix. Please resolve the fix (with fix version of 10.2) and then close after verifying the fix.

Sending        java\engine\org\apache\derby\impl\sql\execute\CreateTriggerConstantAction.java
Sending        java\testing\org\apache\derbyTesting\functionTests\master\triggerGeneral.out
Sending        java\testing\org\apache\derbyTesting\functionTests\tests\lang\triggerGeneral.sql
Transmitting file data ...
Committed revision 378109.

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85.diff, derby-85.stat, derby-85_2.diff, derby-85_2.stat, derbyall_report.txt, derbyall_report_2.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Rick Hillegas (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12357794 ] 

Rick Hillegas commented on DERBY-85:
------------------------------------

I don't think I understand the June 21 question about which schema descriptor method to call. DDLConstantAction.getSchemaDescriptorForCreate() will persistently create the schema if it doesn't already exist. I think you need to do that before you create any objects in the schema. I don't think that the DataDictionary methods, by themselves, will create any persistent objects. So the method you are calling looks like the right one to me.

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85-notabs.diff, derby-85.diff, derby-85.stat, derbyall_report.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Rick Hillegas <Ri...@Sun.COM>.
>
>> Should it be possible to run CompatibilitySuite with
>> junit.swingui.TestRunner? It does not work for me. I get an NPE...
>
>
> Got me on that one. Rick?
>
I've never tried running the compatibility suite under 
junit.swingui.TestRunner. Never scratched that itch. :)

Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Dy...@Sun.COM.
Rick Hillegas <Ri...@Sun.COM> writes:

> Hi Dyre,
>
> Have you taken a look at sections 4.3 and 4.4 of 
> java/testing/README.htm? Those sections talk briefly about configuring 
> unit test properties.

Thanks, Rick
Yes, I did. But now I have figured it out...

I'll submit a patch soon, but svn was down earlier today...

-- 
dt



Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi Dyre,

Have you taken a look at sections 4.3 and 4.4 of 
java/testing/README.htm? Those sections talk briefly about configuring 
unit test properties.

Regards,
-Rick

Dyre.Tjeldvoll@Sun.COM wrote:

>Kathey Marsden <km...@sbcglobal.net> writes:
>
>  
>
>>Dyre.Tjeldvoll@Sun.COM wrote:
>>
>>    
>>
>>>Hmm, yes I see your point, but derbyall already takes a long time,
>>>doesn't it?
>>>
>>> 
>>>
>>>      
>>>
>>I think efforts to reduce the time derbyall takes should be focused on
>>things that just make it run faster but not ever discourage addition of
>>tests.  For example running with relaxed durability (
>>-Dderby.system.durability=test) speeds things up quite a bit.  Efforts
>>to get multiple tests running against a single db seem like a good idea.
>>Adding tests to existing tests instead of making new ones can be a  way
>>to economize too.  Also ultimately if it got too long we could have a
>>high coverage subset that would be typically run for checkin instead of
>>derbyAll but that is more risky, but I tend to think that it is a really
>>good idea to have a test for every bug fix where reasonable.  Creating
>>database objects when the default schema  doesn't exist is an area where
>>we could definitely use more testing as evidenced by this bug, 
>>DERBY-230 and I think others.
>>
>>    
>>
>
>Can anyone tell me how I can get my test to interact with the test
>harness? Looking at other tests it seems like I should do the following
>
>ij.getPropertyArg(args);
>Connection c = ij.startJBMS();
>...
>
>but whenever I run the test c is always null.
>
>Do I need to add some magic property files in the new junitTests/lang
>directory? Or somewhere else?
>
>  
>


Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Dy...@Sun.COM.
Kathey Marsden <km...@sbcglobal.net> writes:

> Dyre.Tjeldvoll@Sun.COM wrote:
>
>>Hmm, yes I see your point, but derbyall already takes a long time,
>>doesn't it?
>>
>>  
>>
> I think efforts to reduce the time derbyall takes should be focused on
> things that just make it run faster but not ever discourage addition of
> tests.  For example running with relaxed durability (
> -Dderby.system.durability=test) speeds things up quite a bit.  Efforts
> to get multiple tests running against a single db seem like a good idea.
> Adding tests to existing tests instead of making new ones can be a  way
> to economize too.  Also ultimately if it got too long we could have a
> high coverage subset that would be typically run for checkin instead of
> derbyAll but that is more risky, but I tend to think that it is a really
> good idea to have a test for every bug fix where reasonable.  Creating
> database objects when the default schema  doesn't exist is an area where
> we could definitely use more testing as evidenced by this bug, 
> DERBY-230 and I think others.
>

Can anyone tell me how I can get my test to interact with the test
harness? Looking at other tests it seems like I should do the following

ij.getPropertyArg(args);
Connection c = ij.startJBMS();
...

but whenever I run the test c is always null.

Do I need to add some magic property files in the new junitTests/lang
directory? Or somewhere else?

-- 
dt



Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Kathey Marsden <km...@sbcglobal.net>.
Dyre.Tjeldvoll@Sun.COM wrote:

>Hmm, yes I see your point, but derbyall already takes a long time,
>doesn't it?
>
>  
>
I think efforts to reduce the time derbyall takes should be focused on
things that just make it run faster but not ever discourage addition of
tests.  For example running with relaxed durability (
-Dderby.system.durability=test) speeds things up quite a bit.  Efforts
to get multiple tests running against a single db seem like a good idea.
Adding tests to existing tests instead of making new ones can be a  way
to economize too.  Also ultimately if it got too long we could have a
high coverage subset that would be typically run for checkin instead of
derbyAll but that is more risky, but I tend to think that it is a really
good idea to have a test for every bug fix where reasonable.  Creating
database objects when the default schema  doesn't exist is an area where
we could definitely use more testing as evidenced by this bug, 
DERBY-230 and I think others.

Kathey









Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Dy...@Sun.COM.
>>>>> "DWVC" == David W Van Couvering <Da...@Sun.COM> writes:

    DWVC> Yes, I suppose it could use TestRunner directly, but that's not what the 
    DWVC> harness does today, it only works with main routines.  Are you 
    DWVC> suggesting that be changed?

Well, no if there is a good reason for using a main method, I guess
that's ok. It's just that it is a deviation from the standard JUnit
cookbook (or so it seems to me, and I'm a Junit newbie), so it is yet
another thing that has to be documented and remembered...

    >> Should it be possible to run CompatibilitySuite with
    >> junit.swingui.TestRunner? It does not work for me. I get an NPE...

    DWVC> Got me on that one. Rick?

This illustrates another problem with deviating from common JUnit
practice: I works in the harness, but you may not be able to use other
utilities developed for Junit...

    >>> - Add your test to a test suite (e.g. derbylang)
    >> Will that not make it part of derbyall? Do we really want all
    >> bugfix-regression-unit tests to be run in derbyall?
    >> 

    DWVC> Well, that's your choice, it seems to me in general bugfix unit tests 
    DWVC> should be part of some kind of regression test, and as far as I know 
    DWVC> derbyall is all we have.

Hmm, yes I see your point, but derbyall already takes a long time,
doesn't it?

-- 
dt


Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "David W. Van Couvering" <Da...@Sun.COM>.
Hi, Dyre, my responses inline.

Dyre.Tjeldvoll@Sun.COM wrote:
> "David W. Van Couvering" <Da...@Sun.COM> writes:
> 
> 
>>Hi, Dyre.  It is fairly easy to integrate with the test harness.
>>
>>- Place your test under tests/junitTests.  Create a new subdirectory 
>>(lang is most likely correct) if it seems appropriate.
>>
>>- Have your test extend 
>>org.apache.derbyTesting.functionTests.util.DerbyJUnitTest
>>
> 
> Thanks David. Rick also mentioned this in
>  http://article.gmane.org/gmane.comp.apache.db.derby.devel/10429/match=derbyjunittest
> 
> 
>>- Make sure it has a main() routine, which runs the unit test.  See 
>>junitTests.compatibility.CompatibilitySuite for an example
> 
> 
> This I didn't know. Is it documented anywhere? And why does it need
> that? Couldn't the harness just start it with junit.textui.TestRunner?
> 

I don't know if it's documented anywhere.  If it isn't, it would be 
great if someone took the initiative to do so.

Yes, I suppose it could use TestRunner directly, but that's not what the 
harness does today, it only works with main routines.  Are you 
suggesting that be changed?

> Should it be possible to run CompatibilitySuite with
> junit.swingui.TestRunner? It does not work for me. I get an NPE...

Got me on that one. Rick?

> 
> 
>>- All public methods with the pattern testXXX() will automatically be run
>>
>>- Add your test to a test suite (e.g. derbylang)
> 
> 
> Will that not make it part of derbyall? Do we really want all
> bugfix-regression-unit tests to be run in derbyall?
> 

Well, that's your choice, it seems to me in general bugfix unit tests 
should be part of some kind of regression test, and as far as I know 
derbyall is all we have.

Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Dy...@Sun.COM.
"David W. Van Couvering" <Da...@Sun.COM> writes:

> Hi, Dyre.  It is fairly easy to integrate with the test harness.
>
> - Place your test under tests/junitTests.  Create a new subdirectory 
> (lang is most likely correct) if it seems appropriate.
>
> - Have your test extend 
> org.apache.derbyTesting.functionTests.util.DerbyJUnitTest
>
Thanks David. Rick also mentioned this in
 http://article.gmane.org/gmane.comp.apache.db.derby.devel/10429/match=derbyjunittest

> - Make sure it has a main() routine, which runs the unit test.  See 
> junitTests.compatibility.CompatibilitySuite for an example

This I didn't know. Is it documented anywhere? And why does it need
that? Couldn't the harness just start it with junit.textui.TestRunner?

Should it be possible to run CompatibilitySuite with
junit.swingui.TestRunner? It does not work for me. I get an NPE...

> - All public methods with the pattern testXXX() will automatically be run
>
> - Add your test to a test suite (e.g. derbylang)

Will that not make it part of derbyall? Do we really want all
bugfix-regression-unit tests to be run in derbyall?

-- 
dt


Re: [jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "David W. Van Couvering" <Da...@Sun.COM>.
Hi, Dyre.  It is fairly easy to integrate with the test harness.

- Place your test under tests/junitTests.  Create a new subdirectory 
(lang is most likely correct) if it seems appropriate.

- Have your test extend 
org.apache.derbyTesting.functionTests.util.DerbyJUnitTest

- Make sure it has a main() routine, which runs the unit test.  See 
junitTests.compatibility.CompatibilitySuite for an example

- All public methods with the pattern testXXX() will automatically be run

- Add your test to a test suite (e.g. derbylang)

HTH

David

Dyre Tjeldvoll (JIRA) wrote:
>      [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]
> 
> Dyre Tjeldvoll updated DERBY-85:
> --------------------------------
> 
>     Attachment: Bugs.java
> 
> This is my attempt at creating a JUnit test for DERBY-85. It is currently just an ordinary JUnit test, I have not done anything to try to integrate it with the existing 
> test harness (I could not find any info on how to do that). I have run the test using junit.swingui.TestRunner and that seems to work. If someone would like to review it that would be great.
> 
> 
>>NPE when creating a trigger on a table and default schema doesn't exist.
>>------------------------------------------------------------------------
>>
>>         Key: DERBY-85
>>         URL: http://issues.apache.org/jira/browse/DERBY-85
>>     Project: Derby
>>        Type: Bug
>>  Components: SQL
>>    Versions: 10.0.2.0
>>    Reporter: A B
>>    Assignee: Dyre Tjeldvoll
>> Attachments: Bugs.java, derby-85-notabs.diff
>>
>>BACKGROUND:
>>When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
>>ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
>>then the default schema is "SOMEUSER".
>>PROBLEM:
>>It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
>>REPRO:
>>In ij:
>>-- Create database with default schema "SOMEUSER".
>>ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
>>-- Create table t1 in a non-default schema; in this case, call it "ITKO".
>>ij> create table itko.t1 (i int);
>>0 rows inserted/updated/deleted
>>-- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
>>-- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
>>ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
>>ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>>A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
>>java.lang.NullPointerException
>>	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
>>	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
>>	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
>>	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
>>	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
>>	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
>>	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
>>	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
>>	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
>>	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
>>	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
>>	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
>>	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
>>	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
>>	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
>>	at org.apache.derby.tools.ij.main(ij.java:60)
> 
> 

[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Attachment: Bugs.java

This is my attempt at creating a JUnit test for DERBY-85. It is currently just an ordinary JUnit test, I have not done anything to try to integrate it with the existing 
test harness (I could not find any info on how to do that). I have run the test using junit.swingui.TestRunner and that seems to work. If someone would like to review it that would be great.

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: Bugs.java, derby-85-notabs.diff
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "A B (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]
     
A B closed DERBY-85:
--------------------


Verified fix and it has been ported to 10.1, so I'm closing the issue.

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug

>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>      Fix For: 10.2.0.0, 10.1.3.0, 10.1.2.4
>  Attachments: derby-85.diff, derby-85.stat, derby-85_2.diff, derby-85_2.stat, derbyall_report.merge-to-10.1.txt, derbyall_report.txt, derbyall_report_2.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Attachment:     (was: derby-85-notabs.diff)

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: Bugs.java, derby-85.diff, derby-85.stat, derbyall_report.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: [jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by Rick Hillegas <Ri...@Sun.COM>.
Yep, Windows it was.

Cheers,
-Rick

David W. Van Couvering wrote:

> How did you get derbyall to pass with all the failures we are having 
> right now?  Did you run on Windows?
>
> Thanks,
>
> David
>
> Rick Hillegas (JIRA) wrote:
>
>>     [ 
>> http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12356444 
>> ]
>> Rick Hillegas commented on DERBY-85:
>> ------------------------------------
>>
>> Derbyall passed. When a new patch is submitted including a regression 
>> test, I'll just run the appropriate suite.
>>
>>
>>> NPE when creating a trigger on a table and default schema doesn't 
>>> exist.
>>> ------------------------------------------------------------------------ 
>>>
>>>
>>>         Key: DERBY-85
>>>         URL: http://issues.apache.org/jira/browse/DERBY-85
>>>     Project: Derby
>>>        Type: Bug
>>>  Components: SQL
>>>    Versions: 10.0.2.0
>>>    Reporter: A B
>>>    Assignee: Dyre Tjeldvoll
>>> Attachments: derby-85-notabs.diff, derby-85.diff, derby-85.stat, 
>>> derbyall_report.txt
>>>
>>> BACKGROUND:
>>> When connecting to a Derby db with a user id and password, the 
>>> default schema is USER.  For example, if I connect with:
>>> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
>>> then the default schema is "SOMEUSER".
>>> PROBLEM:
>>> It turns out that if a table t1 exists in a non-default schema and 
>>> the default schema (in this case, "SOMEUSER") doesn't exist yet 
>>> (because no objects have been created in that schema), then attempts 
>>> to create a trigger on t1 using its qualified name will lead to a 
>>> null pointer exception in the Derby engine.
>>> REPRO:
>>> In ij:
>>> -- Create database with default schema "SOMEUSER".
>>> ij> connect 
>>> 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
>>> -- Create table t1 in a non-default schema; in this case, call it 
>>> "ITKO".
>>> ij> create table itko.t1 (i int);
>>> 0 rows inserted/updated/deleted
>>> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default 
>>> schema SOMEUSER does NOT exist, because we haven't created any 
>>> objects in that schema yet.
>>> -- So now we try to create a trigger in the ITKO (i.e. the 
>>> non-default) schema...
>>> ij> create trigger trig1 after update on itko.t1 for each row mode 
>>> db2sql select * from sys.systables;
>>> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>>> A look at the derby.log file shows the stack trace given below.  In 
>>> a word, it looks like the "compilation schema" field of 
>>> SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  
>>> That causes the NPE in subsequent processing...
>>> java.lang.NullPointerException
>>>     at 
>>> org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200) 
>>>
>>>     at 
>>> org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890) 
>>>
>>>     at 
>>> org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354) 
>>>
>>>     at 
>>> org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258) 
>>>
>>>     at 
>>> org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56) 
>>>
>>>     at 
>>> org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366) 
>>>
>>>     at 
>>> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100) 
>>>
>>>     at 
>>> org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509) 
>>>
>>>     at 
>>> org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467) 
>>>
>>>     at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
>>>     at 
>>> org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
>>>     at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
>>>     at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
>>>     at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
>>>     at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
>>>     at org.apache.derby.tools.ij.main(ij.java:60)
>>
>>
>>


Re: [jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "David W. Van Couvering" <Da...@Sun.COM>.
How did you get derbyall to pass with all the failures we are having 
right now?  Did you run on Windows?

Thanks,

David

Rick Hillegas (JIRA) wrote:
>     [ http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12356444 ] 
> 
> Rick Hillegas commented on DERBY-85:
> ------------------------------------
> 
> Derbyall passed. When a new patch is submitted including a regression test, I'll just run the appropriate suite.
> 
> 
>>NPE when creating a trigger on a table and default schema doesn't exist.
>>------------------------------------------------------------------------
>>
>>         Key: DERBY-85
>>         URL: http://issues.apache.org/jira/browse/DERBY-85
>>     Project: Derby
>>        Type: Bug
>>  Components: SQL
>>    Versions: 10.0.2.0
>>    Reporter: A B
>>    Assignee: Dyre Tjeldvoll
>> Attachments: derby-85-notabs.diff, derby-85.diff, derby-85.stat, derbyall_report.txt
>>
>>BACKGROUND:
>>When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
>>ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
>>then the default schema is "SOMEUSER".
>>PROBLEM:
>>It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
>>REPRO:
>>In ij:
>>-- Create database with default schema "SOMEUSER".
>>ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
>>-- Create table t1 in a non-default schema; in this case, call it "ITKO".
>>ij> create table itko.t1 (i int);
>>0 rows inserted/updated/deleted
>>-- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
>>-- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
>>ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
>>ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>>A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
>>java.lang.NullPointerException
>>	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
>>	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
>>	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
>>	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
>>	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
>>	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
>>	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
>>	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
>>	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
>>	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
>>	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
>>	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
>>	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
>>	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
>>	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
>>	at org.apache.derby.tools.ij.main(ij.java:60)
> 
> 

[jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Rick Hillegas (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12356444 ] 

Rick Hillegas commented on DERBY-85:
------------------------------------

Derbyall passed. When a new patch is submitted including a regression test, I'll just run the appropriate suite.

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85-notabs.diff, derby-85.diff, derby-85.stat, derbyall_report.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Attachment: derby-85_2.diff
                derby-85_2.stat
                derbyall_report_2.txt

New patch addressing Sateesh concerns about the regression test being a separate test script. Please review. Thanks.

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85.diff, derby-85.stat, derby-85_2.diff, derby-85_2.stat, derbyall_report.txt, derbyall_report_2.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Attachment: derby-85.diff
                derby-85.stat
                derbyall_report.txt

The patch appears to fix the problem and passes derbyall (see attached derbyall_report.txt), but I'm a bit unsure if this is the best way to fix the problem. 
It would be really nice if a committer could look at it, and perhaps give some feedback. 

Some comments to the patch:
- The compile schema is needed in the CREATE TRIGGER statement in order to fill in column 8 of the SYSSTATEMENTS table
- The CREATE TRIGGER code uses LanguageConnectionContext.getDefaultSchema() as a fallback when no other compile schema is specified. The object returned by this method has a null oid unless one has done SET SCHEMA. But a SchemaDescriptor containing a valid oid can be obtained by calling 
getSchemaDescriptorForCreate(DataDictionary, Activation, String). The patch uses this method to get the oid as the ultimate fallback.

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85.diff, derby-85.stat, derbyall_report.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-85?page=comments#action_12314140 ] 

Dyre Tjeldvoll commented on DERBY-85:
-------------------------------------

Looking at the code again, I wondering if it would be better to use DataDictionary.getSchemaDescriptor(...) rather than DDLConstantAction.getSchemaDescriptorForCreate(...) since we just want to look at the Descriptor object...

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll
>  Attachments: derby-85-notabs.diff, derby-85.diff, derby-85.stat, derbyall_report.txt
>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Attachment:     (was: derby-85.stat)

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll

>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-85) NPE when creating a trigger on a table and default schema doesn't exist.

Posted by "Dyre Tjeldvoll (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-85?page=all ]

Dyre Tjeldvoll updated DERBY-85:
--------------------------------

    Attachment:     (was: derby-85.diff)

> NPE when creating a trigger on a table and default schema doesn't exist.
> ------------------------------------------------------------------------
>
>          Key: DERBY-85
>          URL: http://issues.apache.org/jira/browse/DERBY-85
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.0
>     Reporter: A B
>     Assignee: Dyre Tjeldvoll

>
> BACKGROUND:
> When connecting to a Derby db with a user id and password, the default schema is USER.  For example, if I connect with:
> ij> connect 'jdbc:derby:myDB;user=someUser;password=somePwd';
> then the default schema is "SOMEUSER".
> PROBLEM:
> It turns out that if a table t1 exists in a non-default schema and the default schema (in this case, "SOMEUSER") doesn't exist yet (because no objects have been created in that schema), then attempts to create a trigger on t1 using its qualified name will lead to a null pointer exception in the Derby engine.
> REPRO:
> In ij:
> -- Create database with default schema "SOMEUSER".
> ij> connect 'jdbc:derby:myDB;create=true;user=someUser;password=somePwd';
> -- Create table t1 in a non-default schema; in this case, call it "ITKO".
> ij> create table itko.t1 (i int);
> 0 rows inserted/updated/deleted
> -- Now schema ITKO exists, and T1 exists in schema ITKO, but default schema SOMEUSER does NOT exist, because we haven't created any objects in that schema yet.
> -- So now we try to create a trigger in the ITKO (i.e. the non-default) schema...
> ij> create trigger trig1 after update on itko.t1 for each row mode db2sql select * from sys.systables;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> A look at the derby.log file shows the stack trace given below.  In a word, it looks like the "compilation schema" field of SYS.SYSTRIGGERS isn't getting set, and so it ends up being null.  That causes the NPE in subsequent processing...
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.SYSSTATEMENTSRowFactory.makeSYSSTATEMENTSrow(SYSSTATEMENTSRowFactory.java:200)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addSPSDescriptor(DataDictionaryImpl.java:2890)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.createSPS(CreateTriggerConstantAction.java:354)
> 	at org.apache.derby.impl.sql.execute.CreateTriggerConstantAction.executeConstantAction(CreateTriggerConstantAction.java:258)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:509)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:467)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:299)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:433)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:210)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:176)
> 	at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
> 	at org.apache.derby.tools.ij.main(ij.java:60)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira