dbTalk Databases Forums  

Null value eliminated - but no aggregate function

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss Null value eliminated - but no aggregate function in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
youcantryreachingme
 
Posts: n/a

Default Null value eliminated - but no aggregate function - 11-08-2007 , 11:01 PM






A colleague is running the following in ISQL (for ASA9.0.2.3527)

----------
create variable current_transaction varchar(30);
set current_transaction='PASU256';

DELETE auction.note
FROM auction.note_type
WHERE note_type.note_type_id = note.note_type_id
AND note_type.code = 'Extra'
AND note.text = 'This Vehicle is Located In Alice Springs';

rollback;

drop variable current_transaction;
----------

(The ROLLBACK is only there until we resolve this issue)

During execution the warning comes up:

"Null value eliminated in aggregate function" (SQLCODE=109, ODBC 3
State="01003") Line 13, column 1 (on the DELETE statement).

Examining the NOTE table, it has a trigger before delete which reads
as follows:

----------
ALTER TRIGGER "tdb_note" .tdb_note before delete on auction.note
referencing old as old_del
for each row
begin
if current remote user is null then
insert into auction.note_audit(note_id,
transaction_date,transaction_type,transaction_user ,
transaction_name) values(
old_del.note_id,getdate(*),'D',current user,current_transaction)
end if
end
----------

There are no other triggers on the table.

Selecting the rows that are supposed to be deleted shows 432 records.
Using the Profiling feature shows that the INSERT statement in this
trigger is called 432 times.

Any suggestions why we're getting this aggregate function warning?
Similar triggers on other tables haven't caused this issue (that we're
aware of!)

The NOTE table schema is:

----------
CREATE TABLE "auction"."note" (
"note_id" integer NOT NULL,
"note_type_id" integer NOT NULL,
"note_ref_id" integer NOT NULL,
"internal_only_flag" char(1) NULL,
"text" varchar(250) NULL,
"date_created" timestamp NULL,
"date_last_modified" timestamp NULL,
"created_by" varchar(30) NULL,
"last_modified_by" varchar(30) NULL,
"added_by_pda_flag" char(1) NULL DEFAULT 'N',
"email_message_id" integer NULL,
PRIMARY KEY ( "note_id" )
);
----------

and the NOTE_AUDIT schema is:

----------
CREATE TABLE "auction"."note_audit" (
"note_id" integer NOT NULL,
"transaction_date" timestamp NOT NULL,
"transaction_type" char(1) NOT NULL,
"transaction_user" varchar(30) NOT NULL,
"transaction_name" varchar(30) NOT NULL,
"internal_only_flag" char(1) NULL,
"text" varchar(250) NULL,
"note_type_id" integer NOT NULL DEFAULT '',
"note_ref_id" integer NOT NULL DEFAULT ''
);
----------

TIA.

Chris.


Reply With Quote
  #2  
Old   
Bruce Hay
 
Posts: n/a

Default Re: Null value eliminated - but no aggregate function - 11-09-2007 , 08:42 AM






Perhaps there is a foreign key referencing one of the tables where the
deletes are happening that has ON DELETE CASCADE, and the table with that
foreign key has a trigger. Executing:
select traceback(*)
after the delete might give a clue as to where the problem is happening.

Whitepapers, TechDocs, bug fixes at http://www.ianywhere.com/developer

"youcantryreachingme" <youcantryreachingme (AT) gmail (DOT) com> wrote

Quote:
A colleague is running the following in ISQL (for ASA9.0.2.3527)

----------
create variable current_transaction varchar(30);
set current_transaction='PASU256';

DELETE auction.note
FROM auction.note_type
WHERE note_type.note_type_id = note.note_type_id
AND note_type.code = 'Extra'
AND note.text = 'This Vehicle is Located In Alice Springs';

rollback;

drop variable current_transaction;
----------

(The ROLLBACK is only there until we resolve this issue)

During execution the warning comes up:

"Null value eliminated in aggregate function" (SQLCODE=109, ODBC 3
State="01003") Line 13, column 1 (on the DELETE statement).

Examining the NOTE table, it has a trigger before delete which reads
as follows:

----------
ALTER TRIGGER "tdb_note" .tdb_note before delete on auction.note
referencing old as old_del
for each row
begin
if current remote user is null then
insert into auction.note_audit(note_id,
transaction_date,transaction_type,transaction_user ,
transaction_name) values(
old_del.note_id,getdate(*),'D',current user,current_transaction)
end if
end
----------

There are no other triggers on the table.

Selecting the rows that are supposed to be deleted shows 432 records.
Using the Profiling feature shows that the INSERT statement in this
trigger is called 432 times.

Any suggestions why we're getting this aggregate function warning?
Similar triggers on other tables haven't caused this issue (that we're
aware of!)

The NOTE table schema is:

----------
CREATE TABLE "auction"."note" (
"note_id" integer NOT NULL,
"note_type_id" integer NOT NULL,
"note_ref_id" integer NOT NULL,
"internal_only_flag" char(1) NULL,
"text" varchar(250) NULL,
"date_created" timestamp NULL,
"date_last_modified" timestamp NULL,
"created_by" varchar(30) NULL,
"last_modified_by" varchar(30) NULL,
"added_by_pda_flag" char(1) NULL DEFAULT 'N',
"email_message_id" integer NULL,
PRIMARY KEY ( "note_id" )
);
----------

and the NOTE_AUDIT schema is:

----------
CREATE TABLE "auction"."note_audit" (
"note_id" integer NOT NULL,
"transaction_date" timestamp NOT NULL,
"transaction_type" char(1) NOT NULL,
"transaction_user" varchar(30) NOT NULL,
"transaction_name" varchar(30) NOT NULL,
"internal_only_flag" char(1) NULL,
"text" varchar(250) NULL,
"note_type_id" integer NOT NULL DEFAULT '',
"note_ref_id" integer NOT NULL DEFAULT ''
);
----------

TIA.

Chris.




Reply With Quote
  #3  
Old   
youcantryreachingme
 
Posts: n/a

Default Re: Null value eliminated - but no aggregate function - 11-15-2007 , 06:20 PM



Hi Bruce,

thanks for the suggestions.

Traceback returned null.

The note table references the note_type table; it also references a
second table named email_message. It has no referencing tables.

The note_type table has no foreign keys and the only referencing table
is note.

The warning occurs on my colleagues local development database, my
local development database and our team development database, but not
on our UAT database; that is, I just ran (in ISQL, UAT database) a
statement "read X:\filename\etc" where the file named contained the
delete statement, and there was no warning dialogue box. I don't know
whether the same warning was still triggered but perhaps the dialogue
box was suppressed because of the "read" statement.

Chris.

Reply With Quote
  #4  
Old   
Bruce Hay
 
Posts: n/a

Default Re: Null value eliminated - but no aggregate function - 11-16-2007 , 08:49 AM



I have no other suggestions at this point, other than to contact Tech
Support with a repro that can be examined further to find the cause.

Whitepapers, TechDocs, bug fixes at http://www.ianywhere.com/developer

"youcantryreachingme" <youcantryreachingme (AT) gmail (DOT) com> wrote

Quote:
Hi Bruce,

thanks for the suggestions.

Traceback returned null.

The note table references the note_type table; it also references a
second table named email_message. It has no referencing tables.

The note_type table has no foreign keys and the only referencing table
is note.

The warning occurs on my colleagues local development database, my
local development database and our team development database, but not
on our UAT database; that is, I just ran (in ISQL, UAT database) a
statement "read X:\filename\etc" where the file named contained the
delete statement, and there was no warning dialogue box. I don't know
whether the same warning was still triggered but perhaps the dialogue
box was suppressed because of the "read" statement.

Chris.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.