Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute statement 'select ....' into new.... [CORE1444] #1862

Closed
firebird-automations opened this issue Sep 7, 2007 · 13 comments
Closed

Execute statement 'select ....' into new.... [CORE1444] #1862

firebird-automations opened this issue Sep 7, 2007 · 13 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: kotrc (pkotrc)

Is related to QA172

/*
Problem with

  execute statement 'select c1,c2 from \.\.\.'
  into new\.c1,new\.c2;

in before insert,update triggers.

When new.c1,... has null value before execution,
so execute ... do not fill new.c1,... with value
from select.

Server WI-V2.0.1.12855 Firebird 2.0
System Windows2000 5.00.2195 Service Pack 4
AMD Athalon(TM)

Server WI-V1.5.4.4910 Firebird 1.5
System Windows2000 5.00.2195 Service Pack 4
AMD Athalon(TM)XP 1800+
*/

CREATE EXCEPTION DEXC '???';

CREATE TABLE TEST
(
C1 char(31),
C2 char(31)
);

commit;

SET TERM ^ ;

CREATE TRIGGER TEST_BI FOR TEST
ACTIVE BEFORE INSERT POSITION 20
AS
declare variable sql varchar(30000);
declare variable wrk_c1 char(31);
declare variable wrk_c2 char(31);
BEGIN
/* when new.c1,new.... isn't NULL -> execute statement work ok.
when new.c1,new.c2, is null -> execute statement has some problem */

sql=' select first 1 RDB$CHARACTER_SET_NAME,RDB$DEFAULT_COLLATE_NAME
from RDB$CHARACTER_SETS
where RDB$CHARACTER_SET_NAME is not null';

execute statement sql
into new.c1,new.c2;

select first 1 RDB$CHARACTER_SET_NAME,RDB$DEFAULT_COLLATE_NAME
from RDB$CHARACTER_SETS
where RDB$CHARACTER_SET_NAME is not null
into :wrk_c1,:wrk_c2;

if (wrk_c1 is not null and
new.c1 is null) then
exception dexc 'Is it a bug ? I think yes, it is.';
END
^
set term ; ^

commit;

/* Bug */

insert into test(C1,C2) values (NULL,NULL);

/* OK */
insert into test(C1,C2) values ('A','A');

commit;

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

You are missing the ":" in front of the new.c1 and new.c2 references.

Try:

execute statement sql
into :new.c1,:new.c2;

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Variables in INTO doesn't need the colon anymore, and the colon is currently not a valid syntax with NEW or OLD.

The problem exists, but it's already fixed in HEAD.

I'm not sure if the colon should or should not be allowed with NEW and OLD.

@firebird-automations
Copy link
Collaborator Author

Commented by: kotrc (pkotrc)

Colon should not by used with NEW and OLD.

What is it "Fixed in HEAD" ?

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

Reason of a bug was removed by Adriano when adding INTL support to EXECUTE STATEMENT. Since given versions works fine.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.0.3 [ 10200 ]

Fix Version: 2.1 Beta 2 [ 10190 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 2.0.2 [ 10130 ]

Fix Version: 2.0.3 [ 10200 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is related to QA172 [ QA172 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pcisar

Verified, test added.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Workflow: jira [ 12990 ] => Firebird [ 14622 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test => Done successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants